mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-03 03:41:53 +08:00
Remove epoch from DBCoreState
Use existing recoveryCount if needed.
This commit is contained in:
parent
580151e1d4
commit
a1095c8250
@ -194,10 +194,13 @@ ACTOR Future<Void> backupWorker(BackupInterface interf, InitializeBackupRequest
|
||||
loop choose {
|
||||
when(wait(dbInfoChange)) {
|
||||
dbInfoChange = db->onChange();
|
||||
self.logSystem.set(ILogSystem::fromServerDBInfo(self.myId, db->get(), true));
|
||||
TraceEvent("BackupWorkerLogSystem", interf.id())
|
||||
.detail("HasBackupLocality",
|
||||
self.logSystem.get() ? self.logSystem.get()->hasPseudoLocality(tagLocalityBackup) : false);
|
||||
Reference<ILogSystem> ls = ILogSystem::fromServerDBInfo(self.myId, db->get(), true);
|
||||
if (ls && ls->hasPseudoLocality(tagLocalityBackup)) {
|
||||
self.logSystem.set(ls);
|
||||
TraceEvent("BackupWorkerLogSystem", interf.id()).detail("HasBackupLocality", true);
|
||||
} else {
|
||||
TraceEvent("BackupWorkerLogSystem", interf.id()).detail("HasBackupLocality", false);
|
||||
}
|
||||
}
|
||||
when(HaltBackupRequest req = waitNext(interf.haltBackup.getFuture())) {
|
||||
req.reply.send(Void());
|
||||
|
@ -126,9 +126,8 @@ struct DBCoreState {
|
||||
DBRecoveryCount recoveryCount; // Increases with sequential successful recoveries.
|
||||
LogSystemType logSystemType;
|
||||
std::set<int8_t> pseudoLocalities;
|
||||
LogEpoch epoch;
|
||||
|
||||
DBCoreState() : logRouterTags(0), txsTags(0), recoveryCount(0), logSystemType(LogSystemType::empty), epoch(0) {}
|
||||
DBCoreState() : logRouterTags(0), txsTags(0), recoveryCount(0), logSystemType(LogSystemType::empty) {}
|
||||
|
||||
vector<UID> getPriorCommittedLogServers() {
|
||||
vector<UID> priorCommittedLogServers;
|
||||
@ -150,7 +149,7 @@ struct DBCoreState {
|
||||
bool isEqual(const DBCoreState& r) const {
|
||||
return logSystemType == r.logSystemType && recoveryCount == r.recoveryCount && tLogs == r.tLogs &&
|
||||
oldTLogData == r.oldTLogData && logRouterTags == r.logRouterTags && txsTags == r.txsTags &&
|
||||
pseudoLocalities == r.pseudoLocalities && epoch == r.epoch;
|
||||
pseudoLocalities == r.pseudoLocalities;
|
||||
}
|
||||
bool operator==(const DBCoreState& rhs) const { return isEqual(rhs); }
|
||||
|
||||
@ -171,9 +170,6 @@ struct DBCoreState {
|
||||
if (ar.protocolVersion().hasShardedTxsTags()) {
|
||||
serializer(ar, txsTags);
|
||||
}
|
||||
if (ar.protocolVersion().hasBackupWorker()) {
|
||||
serializer(ar, epoch);
|
||||
}
|
||||
} else if(ar.isDeserializing) {
|
||||
tLogs.push_back(CoreTLogSet());
|
||||
serializer(ar, tLogs[0].tLogs, tLogs[0].tLogWriteAntiQuorum, recoveryCount, tLogs[0].tLogReplicationFactor, logSystemType);
|
||||
|
@ -346,7 +346,6 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
|
||||
newState.logRouterTags = logRouterTags;
|
||||
newState.txsTags = txsTags;
|
||||
newState.pseudoLocalities = pseudoLocalities;
|
||||
newState.epoch = epoch;
|
||||
for (const auto &t : tLogs) {
|
||||
if (t->logServers.size()) {
|
||||
newState.tLogs.emplace_back(*t);
|
||||
@ -1335,6 +1334,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
|
||||
std::map<LogEpoch, Version> epochEndVersion;
|
||||
for (const auto& old : oldLogData) {
|
||||
epochEndVersion[old.epoch] = old.epochEnd;
|
||||
TraceEvent("BW", dbgid).detail("Epoch", old.epoch).detail("EndVersion", old.epochEnd);
|
||||
}
|
||||
return epochEndVersion;
|
||||
}
|
||||
@ -1692,7 +1692,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
|
||||
TEST( lastEnd.present() ); // Restarting recovery at an earlier point
|
||||
|
||||
Reference<TagPartitionedLogSystem> logSystem(
|
||||
new TagPartitionedLogSystem(dbgid, locality, prevState.epoch));
|
||||
new TagPartitionedLogSystem(dbgid, locality, prevState.recoveryCount));
|
||||
|
||||
lastEnd = minEnd;
|
||||
logSystem->tLogs = logServers;
|
||||
|
Loading…
x
Reference in New Issue
Block a user