Change initialSnapshotIntervalSeconds from knob to a backup argument.
This commit is contained in:
parent
7e1d60c924
commit
ebf37594f7
|
@ -244,6 +244,9 @@ The ``start`` subcommand is used to start a backup. If there is already a backu
|
|||
``-s <DURATION>`` or ``--snapshot_interval <DURATION>``
|
||||
Specifies the duration, in seconds, of the inconsistent snapshots written to the backup in continuous mode. The default is 864000 which is 10 days.
|
||||
|
||||
``--init_snapshot_interval <DURATION>``
|
||||
Specifies the duration, in seconds, of the first inconsistent snapshot written to the backup. The default is 0, which means as fast as possible.
|
||||
|
||||
``--partitioned_log_experimental``
|
||||
Specifies the backup uses the partitioned mutation logs generated by backup workers. Since FDB version 6.3, this option is experimental and requires using fast restore for restoring the database from the generated files. The default is to use non-partitioned mutation logs generated by backup agents.
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ enum {
|
|||
// Backup constants
|
||||
OPT_DESTCONTAINER,
|
||||
OPT_SNAPSHOTINTERVAL,
|
||||
OPT_INIT_SNAPSHOT_INTERVAL,
|
||||
OPT_ERRORLIMIT,
|
||||
OPT_NOSTOPWHENDONE,
|
||||
OPT_EXPIRE_BEFORE_VERSION,
|
||||
|
@ -232,6 +233,7 @@ CSimpleOpt::SOption g_rgBackupStartOptions[] = {
|
|||
{ OPT_USE_PARTITIONED_LOG, "--partitioned_log_experimental", SO_NONE },
|
||||
{ OPT_SNAPSHOTINTERVAL, "-s", SO_REQ_SEP },
|
||||
{ OPT_SNAPSHOTINTERVAL, "--snapshot_interval", SO_REQ_SEP },
|
||||
{ OPT_INIT_SNAPSHOT_INTERVAL, "--init_snapshot_interval", SO_REQ_SEP },
|
||||
{ OPT_TAGNAME, "-t", SO_REQ_SEP },
|
||||
{ OPT_TAGNAME, "--tagname", SO_REQ_SEP },
|
||||
{ OPT_BACKUPKEYS, "-k", SO_REQ_SEP },
|
||||
|
@ -1879,6 +1881,7 @@ ACTOR Future<Void> submitDBBackup(Database src,
|
|||
|
||||
ACTOR Future<Void> submitBackup(Database db,
|
||||
std::string url,
|
||||
int initialSnapshotIntervalSeconds,
|
||||
int snapshotIntervalSeconds,
|
||||
Standalone<VectorRef<KeyRangeRef>> backupRanges,
|
||||
std::string tagName,
|
||||
|
@ -1935,6 +1938,7 @@ ACTOR Future<Void> submitBackup(Database db,
|
|||
else {
|
||||
wait(backupAgent.submitBackup(db,
|
||||
KeyRef(url),
|
||||
initialSnapshotIntervalSeconds,
|
||||
snapshotIntervalSeconds,
|
||||
tagName,
|
||||
backupRanges,
|
||||
|
@ -3212,6 +3216,7 @@ int main(int argc, char* argv[]) {
|
|||
std::string destinationContainer;
|
||||
bool describeDeep = false;
|
||||
bool describeTimestamps = false;
|
||||
int initialSnapshotIntervalSeconds = CLIENT_KNOBS->BACKUP_INIT_SNAPSHOT_INTERVAL_SEC;
|
||||
int snapshotIntervalSeconds = CLIENT_KNOBS->BACKUP_DEFAULT_SNAPSHOT_INTERVAL_SEC;
|
||||
std::string clusterFile;
|
||||
std::string sourceClusterFile;
|
||||
|
@ -3467,6 +3472,7 @@ int main(int argc, char* argv[]) {
|
|||
modifyOptions.destURL = destinationContainer;
|
||||
break;
|
||||
case OPT_SNAPSHOTINTERVAL:
|
||||
case OPT_INIT_SNAPSHOT_INTERVAL:
|
||||
case OPT_MOD_ACTIVE_INTERVAL: {
|
||||
const char* a = args->OptionArg();
|
||||
int seconds;
|
||||
|
@ -3478,6 +3484,8 @@ int main(int argc, char* argv[]) {
|
|||
if (optId == OPT_SNAPSHOTINTERVAL) {
|
||||
snapshotIntervalSeconds = seconds;
|
||||
modifyOptions.snapshotIntervalSeconds = seconds;
|
||||
} else if (optId == OPT_INIT_SNAPSHOT_INTERVAL) {
|
||||
initialSnapshotIntervalSeconds = seconds;
|
||||
} else if (optId == OPT_MOD_ACTIVE_INTERVAL) {
|
||||
modifyOptions.activeSnapshotIntervalSeconds = seconds;
|
||||
}
|
||||
|
@ -3888,6 +3896,7 @@ int main(int argc, char* argv[]) {
|
|||
openBackupContainer(argv[0], destinationContainer);
|
||||
f = stopAfter(submitBackup(db,
|
||||
destinationContainer,
|
||||
initialSnapshotIntervalSeconds,
|
||||
snapshotIntervalSeconds,
|
||||
backupKeys,
|
||||
tagName,
|
||||
|
|
|
@ -357,6 +357,7 @@ public:
|
|||
|
||||
Future<Void> submitBackup(Reference<ReadYourWritesTransaction> tr,
|
||||
Key outContainer,
|
||||
int initialSnapshotIntervalSeconds,
|
||||
int snapshotIntervalSeconds,
|
||||
std::string tagName,
|
||||
Standalone<VectorRef<KeyRangeRef>> backupRanges,
|
||||
|
@ -365,6 +366,7 @@ public:
|
|||
bool incrementalBackupOnly = false);
|
||||
Future<Void> submitBackup(Database cx,
|
||||
Key outContainer,
|
||||
int initialSnapshotIntervalSeconds,
|
||||
int snapshotIntervalSeconds,
|
||||
std::string tagName,
|
||||
Standalone<VectorRef<KeyRangeRef>> backupRanges,
|
||||
|
@ -374,6 +376,7 @@ public:
|
|||
return runRYWTransactionFailIfLocked(cx, [=](Reference<ReadYourWritesTransaction> tr) {
|
||||
return submitBackup(tr,
|
||||
outContainer,
|
||||
initialSnapshotIntervalSeconds,
|
||||
snapshotIntervalSeconds,
|
||||
tagName,
|
||||
backupRanges,
|
||||
|
@ -404,7 +407,8 @@ public:
|
|||
Future<std::string> getStatus(Database cx, bool showErrors, std::string tagName);
|
||||
Future<std::string> getStatusJSON(Database cx, std::string tagName);
|
||||
|
||||
Future<Optional<Version>> getLastRestorable(Reference<ReadYourWritesTransaction> tr, Key tagName,
|
||||
Future<Optional<Version>> getLastRestorable(Reference<ReadYourWritesTransaction> tr,
|
||||
Key tagName,
|
||||
bool snapshot = false);
|
||||
void setLastRestorable(Reference<ReadYourWritesTransaction> tr, Key tagName, Version version);
|
||||
|
||||
|
@ -835,6 +839,11 @@ public:
|
|||
typedef KeyBackedMap<Key, bool> RangeDispatchMapT;
|
||||
RangeDispatchMapT snapshotRangeDispatchMap() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
|
||||
|
||||
// Interval to use for the first (initial) snapshot.
|
||||
KeyBackedProperty<int64_t> initialSnapshotIntervalSeconds() {
|
||||
return configSpace.pack(LiteralStringRef(__FUNCTION__));
|
||||
}
|
||||
|
||||
// Interval to use for determining the target end version for new snapshots
|
||||
KeyBackedProperty<int64_t> snapshotIntervalSeconds() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
|
||||
|
||||
|
@ -864,8 +873,9 @@ public:
|
|||
|
||||
Future<Version> beginVersion = tr->getReadVersion();
|
||||
Future<int64_t> defaultInterval = 0;
|
||||
if (intervalSeconds < 0)
|
||||
if (intervalSeconds < 0) {
|
||||
defaultInterval = copy.snapshotIntervalSeconds().getOrThrow(tr);
|
||||
}
|
||||
|
||||
// Make sure read version and possibly the snapshot interval value are ready, then clear/init the snapshot
|
||||
// config members
|
||||
|
|
|
@ -2778,7 +2778,7 @@ struct StartFullBackupTaskFunc : BackupTaskFuncBase {
|
|||
state Reference<TaskFuture> backupFinished = futureBucket->future(tr);
|
||||
|
||||
// Initialize the initial snapshot and create tasks to continually write logs and snapshots.
|
||||
wait(config.initNewSnapshot(tr, CLIENT_KNOBS->BACKUP_INIT_SNAPSHOT_INTERVAL_SEC));
|
||||
wait(config.initNewSnapshot(tr, config.initialSnapshotIntervalSeconds().get(tr).get().orDefault(0)));
|
||||
|
||||
// Using priority 1 for both of these to at least start both tasks soon
|
||||
// Do not add snapshot task if we only want the incremental backup
|
||||
|
@ -4439,6 +4439,7 @@ public:
|
|||
ACTOR static Future<Void> submitBackup(FileBackupAgent* backupAgent,
|
||||
Reference<ReadYourWritesTransaction> tr,
|
||||
Key outContainer,
|
||||
int initialSnapshotIntervalSeconds,
|
||||
int snapshotIntervalSeconds,
|
||||
std::string tagName,
|
||||
Standalone<VectorRef<KeyRangeRef>> backupRanges,
|
||||
|
@ -4554,6 +4555,7 @@ public:
|
|||
config.backupContainer().set(tr, bc);
|
||||
config.stopWhenDone().set(tr, stopWhenDone);
|
||||
config.backupRanges().set(tr, normalizedRanges);
|
||||
config.initialSnapshotIntervalSeconds().set(tr, initialSnapshotIntervalSeconds);
|
||||
config.snapshotIntervalSeconds().set(tr, snapshotIntervalSeconds);
|
||||
config.partitionedLogEnabled().set(tr, partitionedLog);
|
||||
config.incrementalBackupOnly().set(tr, incrementalBackupOnly);
|
||||
|
@ -5541,6 +5543,7 @@ Future<ERestoreState> FileBackupAgent::waitRestore(Database cx, Key tagName, boo
|
|||
|
||||
Future<Void> FileBackupAgent::submitBackup(Reference<ReadYourWritesTransaction> tr,
|
||||
Key outContainer,
|
||||
int initialSnapshotIntervalSeconds,
|
||||
int snapshotIntervalSeconds,
|
||||
std::string tagName,
|
||||
Standalone<VectorRef<KeyRangeRef>> backupRanges,
|
||||
|
@ -5550,6 +5553,7 @@ Future<Void> FileBackupAgent::submitBackup(Reference<ReadYourWritesTransaction>
|
|||
return FileBackupAgentImpl::submitBackup(this,
|
||||
tr,
|
||||
outContainer,
|
||||
initialSnapshotIntervalSeconds,
|
||||
snapshotIntervalSeconds,
|
||||
tagName,
|
||||
backupRanges,
|
||||
|
|
|
@ -133,7 +133,7 @@ void ClientKnobs::initialize(bool randomize) {
|
|||
init( BACKUP_RANGE_TIMEOUT, TASKBUCKET_TIMEOUT_VERSIONS/CORE_VERSIONSPERSECOND/2.0 );
|
||||
init( BACKUP_RANGE_MINWAIT, std::max(1.0, BACKUP_RANGE_TIMEOUT/2.0));
|
||||
init( BACKUP_SNAPSHOT_DISPATCH_INTERVAL_SEC, 10 * 60 ); // 10 minutes
|
||||
init( BACKUP_INIT_SNAPSHOT_INTERVAL_SEC, 0); if( randomize && BUGGIFY ) BACKUP_INIT_SNAPSHOT_INTERVAL_SEC = deterministicRandom()->randomInt(0, 60); // The initial snapshot has a desired duration of 0, meaning go as fast as possible. In simulation, choose a random value between 0 - 60 seconds.
|
||||
init( BACKUP_INIT_SNAPSHOT_INTERVAL_SEC, 0); // The initial snapshot has a desired duration of 0, meaning go as fast as possible.
|
||||
init( BACKUP_DEFAULT_SNAPSHOT_INTERVAL_SEC, 3600 * 24 * 10); // 10 days
|
||||
init( BACKUP_SHARD_TASK_LIMIT, 1000 ); if( randomize && BUGGIFY ) BACKUP_SHARD_TASK_LIMIT = 4;
|
||||
init( BACKUP_AGGREGATE_POLL_RATE_UPDATE_INTERVAL, 60);
|
||||
|
|
|
@ -93,6 +93,7 @@ struct AtomicRestoreWorkload : TestWorkload {
|
|||
try {
|
||||
wait(backupAgent.submitBackup(cx,
|
||||
StringRef(backupContainer),
|
||||
deterministicRandom()->randomInt(0, 60),
|
||||
deterministicRandom()->randomInt(0, 100),
|
||||
BackupAgentBase::getDefaultTagName(),
|
||||
self->backupRanges,
|
||||
|
|
|
@ -222,6 +222,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
|
|||
try {
|
||||
wait(backupAgent->submitBackup(cx,
|
||||
StringRef(backupContainer),
|
||||
deterministicRandom()->randomInt(0, 60),
|
||||
deterministicRandom()->randomInt(0, 100),
|
||||
tag.toString(),
|
||||
backupRanges,
|
||||
|
@ -477,6 +478,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
|
|||
// the configuration to disable backup workers before restore.
|
||||
extraBackup = backupAgent.submitBackup(cx,
|
||||
LiteralStringRef("file://simfdb/backups/"),
|
||||
deterministicRandom()->randomInt(0, 60),
|
||||
deterministicRandom()->randomInt(0, 100),
|
||||
self->backupTag.toString(),
|
||||
self->backupRanges,
|
||||
|
|
|
@ -248,6 +248,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
|
|||
try {
|
||||
wait(backupAgent->submitBackup(cx,
|
||||
StringRef(backupContainer),
|
||||
deterministicRandom()->randomInt(0, 60),
|
||||
deterministicRandom()->randomInt(0, 100),
|
||||
tag.toString(),
|
||||
backupRanges,
|
||||
|
@ -497,6 +498,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
|
|||
try {
|
||||
extraBackup = backupAgent.submitBackup(cx,
|
||||
LiteralStringRef("file://simfdb/backups/"),
|
||||
deterministicRandom()->randomInt(0, 60),
|
||||
deterministicRandom()->randomInt(0, 100),
|
||||
self->backupTag.toString(),
|
||||
self->backupRanges,
|
||||
|
|
|
@ -29,6 +29,7 @@ struct BackupToBlobWorkload : TestWorkload {
|
|||
double backupAfter;
|
||||
Key backupTag;
|
||||
Standalone<StringRef> backupURL;
|
||||
int initSnapshotInterval = 0;
|
||||
int snapshotInterval = 100000;
|
||||
|
||||
static constexpr const char* DESCRIPTION = "BackupToBlob";
|
||||
|
@ -60,7 +61,7 @@ struct BackupToBlobWorkload : TestWorkload {
|
|||
|
||||
wait(delay(self->backupAfter));
|
||||
wait(backupAgent.submitBackup(
|
||||
cx, self->backupURL, self->snapshotInterval, self->backupTag.toString(), backupRanges));
|
||||
cx, self->backupURL, self->initSnapshotInterval, self->snapshotInterval, self->backupTag.toString(), backupRanges));
|
||||
EBackupState backupStatus = wait(backupAgent.waitBackup(cx, self->backupTag.toString(), true));
|
||||
TraceEvent("BackupToBlob_BackupStatus").detail("Status", BackupAgentBase::getStateText(backupStatus));
|
||||
return Void();
|
||||
|
|
|
@ -151,7 +151,7 @@ struct IncrementalBackupWorkload : TestWorkload {
|
|||
TraceEvent("IBackupSubmitAttempt");
|
||||
try {
|
||||
wait(self->backupAgent.submitBackup(
|
||||
cx, self->backupDir, 1e8, self->tag.toString(), backupRanges, false, false, true));
|
||||
cx, self->backupDir, 0, 1e8, self->tag.toString(), backupRanges, false, false, true));
|
||||
} catch (Error& e) {
|
||||
TraceEvent("IBackupSubmitError").error(e);
|
||||
if (e.code() != error_code_backup_duplicate) {
|
||||
|
|
|
@ -33,6 +33,7 @@ struct SubmitBackupWorkload final : TestWorkload {
|
|||
Standalone<StringRef> backupDir;
|
||||
Standalone<StringRef> tag;
|
||||
double delayFor;
|
||||
int initSnapshotInterval;
|
||||
int snapshotInterval;
|
||||
bool stopWhenDone;
|
||||
bool incremental;
|
||||
|
@ -41,6 +42,7 @@ struct SubmitBackupWorkload final : TestWorkload {
|
|||
backupDir = getOption(options, LiteralStringRef("backupDir"), LiteralStringRef("file://simfdb/backups/"));
|
||||
tag = getOption(options, LiteralStringRef("tag"), LiteralStringRef("default"));
|
||||
delayFor = getOption(options, LiteralStringRef("delayFor"), 10.0);
|
||||
initSnapshotInterval = getOption(options, LiteralStringRef("initSnapshotInterval"), 0);
|
||||
snapshotInterval = getOption(options, LiteralStringRef("snapshotInterval"), 1e8);
|
||||
stopWhenDone = getOption(options, LiteralStringRef("stopWhenDone"), true);
|
||||
incremental = getOption(options, LiteralStringRef("incremental"), false);
|
||||
|
@ -55,6 +57,7 @@ struct SubmitBackupWorkload final : TestWorkload {
|
|||
try {
|
||||
wait(self->backupAgent.submitBackup(cx,
|
||||
self->backupDir,
|
||||
self->initSnapshotInterval,
|
||||
self->snapshotInterval,
|
||||
self->tag.toString(),
|
||||
backupRanges,
|
||||
|
|
Loading…
Reference in New Issue