mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-28 10:52:03 +08:00
Merge pull request #5152 from oleg68/master-dr-ver
Provide log version information to fdbdr status
This commit is contained in:
commit
4bfc510d9d
@ -85,6 +85,7 @@ public:
|
|||||||
static const Key keyConfigStopWhenDoneKey;
|
static const Key keyConfigStopWhenDoneKey;
|
||||||
static const Key keyStateStatus;
|
static const Key keyStateStatus;
|
||||||
static const Key keyStateStop;
|
static const Key keyStateStop;
|
||||||
|
static const Key keyStateLogBeginVersion;
|
||||||
static const Key keyLastUid;
|
static const Key keyLastUid;
|
||||||
static const Key keyBeginKey;
|
static const Key keyBeginKey;
|
||||||
static const Key keyEndKey;
|
static const Key keyEndKey;
|
||||||
|
@ -123,6 +123,7 @@ const Key BackupAgentBase::keyConfigBackupRanges = "config_backup_ranges"_sr;
|
|||||||
const Key BackupAgentBase::keyConfigStopWhenDoneKey = "config_stop_when_done"_sr;
|
const Key BackupAgentBase::keyConfigStopWhenDoneKey = "config_stop_when_done"_sr;
|
||||||
const Key BackupAgentBase::keyStateStop = "state_stop"_sr;
|
const Key BackupAgentBase::keyStateStop = "state_stop"_sr;
|
||||||
const Key BackupAgentBase::keyStateStatus = "state_status"_sr;
|
const Key BackupAgentBase::keyStateStatus = "state_status"_sr;
|
||||||
|
const Key BackupAgentBase::keyStateLogBeginVersion = "last_begin_version"_sr;
|
||||||
const Key BackupAgentBase::keyLastUid = "last_uid"_sr;
|
const Key BackupAgentBase::keyLastUid = "last_uid"_sr;
|
||||||
const Key BackupAgentBase::keyBeginKey = "beginKey"_sr;
|
const Key BackupAgentBase::keyBeginKey = "beginKey"_sr;
|
||||||
const Key BackupAgentBase::keyEndKey = "endKey"_sr;
|
const Key BackupAgentBase::keyEndKey = "endKey"_sr;
|
||||||
|
@ -1332,6 +1332,10 @@ struct CopyDiffLogsTaskFunc : TaskFuncBase {
|
|||||||
.detail("LogUID", task->params[BackupAgentBase::keyConfigLogUid]);
|
.detail("LogUID", task->params[BackupAgentBase::keyConfigLogUid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the log version to the state
|
||||||
|
tr->set(StringRef(states.pack(DatabaseBackupAgent::keyStateLogBeginVersion)),
|
||||||
|
BinaryWriter::toValue(beginVersion, Unversioned()));
|
||||||
|
|
||||||
if (!stopWhenDone.present()) {
|
if (!stopWhenDone.present()) {
|
||||||
state Reference<TaskFuture> allPartsDone = futureBucket->future(tr);
|
state Reference<TaskFuture> allPartsDone = futureBucket->future(tr);
|
||||||
std::vector<Future<Key>> addTaskVector;
|
std::vector<Future<Key>> addTaskVector;
|
||||||
@ -3091,6 +3095,9 @@ public:
|
|||||||
state Future<Optional<Key>> fBackupKeysPacked =
|
state Future<Optional<Key>> fBackupKeysPacked =
|
||||||
tr->get(backupAgent->config.get(BinaryWriter::toValue(logUid, Unversioned()))
|
tr->get(backupAgent->config.get(BinaryWriter::toValue(logUid, Unversioned()))
|
||||||
.pack(BackupAgentBase::keyConfigBackupRanges));
|
.pack(BackupAgentBase::keyConfigBackupRanges));
|
||||||
|
state Future<Optional<Value>> flogVersionKey =
|
||||||
|
tr->get(backupAgent->states.get(BinaryWriter::toValue(logUid, Unversioned()))
|
||||||
|
.pack(BackupAgentBase::keyStateLogBeginVersion));
|
||||||
|
|
||||||
state EBackupState backupState = wait(backupAgent->getStateValue(tr, logUid));
|
state EBackupState backupState = wait(backupAgent->getStateValue(tr, logUid));
|
||||||
|
|
||||||
@ -3106,7 +3113,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
state Optional<Value> stopVersionKey = wait(fStopVersionKey);
|
state Optional<Value> stopVersionKey = wait(fStopVersionKey);
|
||||||
|
Optional<Value> logVersionKey = wait(flogVersionKey);
|
||||||
|
state std::string logVersionText
|
||||||
|
= ". Last log version is "
|
||||||
|
+ (
|
||||||
|
logVersionKey.present()
|
||||||
|
? format("%lld", BinaryReader::fromStringRef<Version>(logVersionKey.get(), Unversioned()))
|
||||||
|
: "unset"
|
||||||
|
);
|
||||||
Optional<Key> backupKeysPacked = wait(fBackupKeysPacked);
|
Optional<Key> backupKeysPacked = wait(fBackupKeysPacked);
|
||||||
|
|
||||||
state Standalone<VectorRef<KeyRangeRef>> backupRanges;
|
state Standalone<VectorRef<KeyRangeRef>> backupRanges;
|
||||||
@ -3126,7 +3140,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case EBackupState::STATE_RUNNING_DIFFERENTIAL:
|
case EBackupState::STATE_RUNNING_DIFFERENTIAL:
|
||||||
statusText +=
|
statusText +=
|
||||||
"The DR on tag `" + tagNameDisplay + "' is a complete copy of the primary database.\n";
|
"The DR on tag `" + tagNameDisplay + "' is a complete copy of the primary database" + logVersionText + ".\n";
|
||||||
break;
|
break;
|
||||||
case EBackupState::STATE_COMPLETED: {
|
case EBackupState::STATE_COMPLETED: {
|
||||||
Version stopVersion =
|
Version stopVersion =
|
||||||
@ -3138,13 +3152,13 @@ public:
|
|||||||
} break;
|
} break;
|
||||||
case EBackupState::STATE_PARTIALLY_ABORTED: {
|
case EBackupState::STATE_PARTIALLY_ABORTED: {
|
||||||
statusText += "The previous DR on tag `" + tagNameDisplay + "' " +
|
statusText += "The previous DR on tag `" + tagNameDisplay + "' " +
|
||||||
BackupAgentBase::getStateText(backupState) + ".\n";
|
BackupAgentBase::getStateText(backupState) + logVersionText + ".\n";
|
||||||
statusText += "Abort the DR with --cleanup before starting a new DR.\n";
|
statusText += "Abort the DR with --cleanup before starting a new DR.\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
statusText += "The previous DR on tag `" + tagNameDisplay + "' " +
|
statusText += "The previous DR on tag `" + tagNameDisplay + "' " +
|
||||||
BackupAgentBase::getStateText(backupState) + ".\n";
|
BackupAgentBase::getStateText(backupState) + logVersionText + ".\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user