Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fdbclient/ClientKnobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ void ClientKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
init( BACKUP_LOGFILE_BLOCK_SIZE, 1024 * 1024);
init( BACKUP_DISPATCH_ADDTASK_SIZE, 50 );
init( RESTORE_DISPATCH_ADDTASK_SIZE, 150 );
init( RESTORE_DISPATCH_TX_SIZE, 4 * 1024 * 1024 ); if( randomize && buggify() ) RESTORE_DISPATCH_TX_SIZE = 1 * 1024;
init( RESTORE_DISPATCH_BATCH_SIZE, 30000 ); if( randomize && buggify() ) RESTORE_DISPATCH_BATCH_SIZE = 20;
init (RESTORE_PARTITIONED_BATCH_VERSION_SIZE, 10000000); // each step restores 10s worth of data
init( RESTORE_WRITE_TX_SIZE, 256 * 1024 );
Expand Down
649 changes: 552 additions & 97 deletions fdbclient/FileBackupAgent.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions fdbclient/include/fdbclient/Knobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class SWIFT_CXX_IMMORTAL_SINGLETON_TYPE ClientKnobs : public KnobsImpl<ClientKno
int BACKUP_DISPATCH_ADDTASK_SIZE;
bool BACKUP_ALLOW_DRYRUN;
int RESTORE_DISPATCH_ADDTASK_SIZE;
int RESTORE_DISPATCH_TX_SIZE; // Target bytes for partitioned restore range-task dispatch.
int RESTORE_DISPATCH_BATCH_SIZE;
int RESTORE_WRITE_TX_SIZE;
int RESTORE_PARTITIONED_BATCH_VERSION_SIZE;
Expand Down
56 changes: 56 additions & 0 deletions fdbserver/workloads/RestoreWriterRecovery.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* RestoreWriterRecovery.cpp
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2026 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "fdbserver/tester/workloads.h"

namespace fileBackup {
Future<Void> testRestoreWriterRecovery(Database cx);
Future<Void> testRestoreDispatchRecovery(Database cx);
} // namespace fileBackup

struct RestoreWriterRecoveryWorkload : TestWorkload {
static constexpr auto NAME = "RestoreWriterRecovery";
explicit RestoreWriterRecoveryWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {}

void disableFailureInjectionWorkloads(std::set<std::string>& out) const override { out.insert("all"); }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
return clientId == 0 ? fileBackup::testRestoreWriterRecovery(cx) : Void();
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(std::vector<PerfMetric>& m) override {}
};

WorkloadFactory<RestoreWriterRecoveryWorkload> RestoreWriterRecoveryWorkloadFactory;

struct RestoreDispatchRecoveryWorkload : TestWorkload {
static constexpr auto NAME = "RestoreDispatchRecovery";
explicit RestoreDispatchRecoveryWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {}

void disableFailureInjectionWorkloads(std::set<std::string>& out) const override { out.insert("all"); }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
return clientId == 0 ? fileBackup::testRestoreDispatchRecovery(cx) : Void();
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(std::vector<PerfMetric>& m) override {}
};

WorkloadFactory<RestoreDispatchRecoveryWorkload> RestoreDispatchRecoveryWorkloadFactory;
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ if(WITH_PYTHON)
add_fdb_test(TEST_FILES fast/ReadHotDetectionCorrectness.toml IGNORE) # TODO re-enable once read hot detection is enabled.
add_fdb_test(TEST_FILES fast/ReportConflictingKeys.toml)
add_fdb_test(TEST_FILES fast/RESTUnit.toml IGNORE)
add_fdb_test(TEST_FILES fast/RestoreDispatchRecovery.toml)
add_fdb_test(TEST_FILES fast/RestoreWriterRecovery.toml)
add_fdb_test(TEST_FILES fast/SelectorCorrectness.toml)
add_fdb_test(TEST_FILES fast/ShardedRocksNondeterministicTest.toml)
add_fdb_test(TEST_FILES fast/StalePeerTest.toml)
Expand Down
15 changes: 15 additions & 0 deletions tests/fast/RestoreDispatchRecovery.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
testClass = "Backup"
buggify = false

[[knobs]]
# Let the injected age failures, rather than the byte target, bound dispatch.
restore_dispatch_tx_size = 4194304

[configuration]
tenantModes = ['disabled']

[[test]]
testTitle = 'RestoreDispatchRecovery'

[[test.workload]]
testName = 'RestoreDispatchRecovery'
16 changes: 16 additions & 0 deletions tests/fast/RestoreWriterRecovery.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
testClass = "Backup"

[[knobs]]
# The test caps writer transactions at 4 KiB, below their initial 16 KiB budget.
restore_write_tx_size = 16384
backup_logfile_block_size = 65536
mutation_block_size = 10000

[configuration]
tenantModes = ['disabled']

[[test]]
testTitle = 'RestoreWriterRecovery'

[[test.workload]]
testName = 'RestoreWriterRecovery'
9 changes: 7 additions & 2 deletions tests/slow/BackupCorrectnessPartitioned.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
testClass = "Backup"

# Exercise file/block continuations and transaction-byte limits.
[[knobs]]
backup_rangefile_block_size = 4096
restore_dispatch_addtask_size = 2
restore_dispatch_tx_size = 4096
restore_write_tx_size = 4096

[configuration]

[[test]]
Expand All @@ -18,5 +25,3 @@ simBackupAgents = 'BackupToFile'
backupAfter = 10.0
restoreAfter = 60.0
backupRangesCount = -1