forked from bersler/OpenLogReplicator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReplicatorBatch.cpp
More file actions
65 lines (51 loc) · 2.45 KB
/
Copy pathReplicatorBatch.cpp
File metadata and controls
65 lines (51 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Thread reading Oracle Redo Logs using batch mode
Copyright (C) 2018-2024 Adam Leszczynski ([email protected])
This file is part of OpenLogReplicator.
OpenLogReplicator is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your option)
any later version.
OpenLogReplicator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenLogReplicator; see the file LICENSE; If not see
<http://www.gnu.org/licenses/>. */
#include "../common/exception/RuntimeException.h"
#include "../metadata/Metadata.h"
#include "../metadata/Schema.h"
#include "ReplicatorBatch.h"
namespace OpenLogReplicator {
ReplicatorBatch::ReplicatorBatch(Ctx* newCtx, void (* newArchGetLog)(Replicator* replicator), Builder* newBuilder, Metadata* newMetadata,
TransactionBuffer* newTransactionBuffer, const std::string& newAlias, const char* newDatabase) :
Replicator(newCtx, newArchGetLog, newBuilder, newMetadata, newTransactionBuffer, newAlias, newDatabase) {
}
ReplicatorBatch::~ReplicatorBatch() = default;
void ReplicatorBatch::positionReader() {
if (metadata->startSequence != ZERO_SEQ)
metadata->setSeqOffset(metadata->startSequence, 0);
else
metadata->setSeqOffset(0, 0);
metadata->sequence = 0;
}
void ReplicatorBatch::createSchema() {
if (ctx->flagsSet(Ctx::REDO_FLAGS_SCHEMALESS))
return;
ctx->hint("if you don't have earlier schema, try with schemaless mode ('flags': 2)");
if (metadata->schema->scn != ZERO_SCN)
ctx->hint("you can also set start SCN for writer: 'start-scn': " + std::to_string(metadata->schema->scn));
throw RuntimeException(10052, "schema file missing");
}
void ReplicatorBatch::updateOnlineRedoLogData() {
// No need to update online redo log data in batch mode
}
const char* ReplicatorBatch::getModeName() const {
return "batch";
}
bool ReplicatorBatch::continueWithOnline() {
ctx->info(0, "finished batch processing, exiting");
ctx->stopSoft();
return false;
}
}