Skip to content

Commit bab63fd

Browse files
Merge pull request #13254 from tclinkenbeard-oai/dev/tclinkenbeard/inline-buggify-function
Replace `BUGGIFY` macros with inline functions
2 parents 685b3e8 + 09b654d commit bab63fd

66 files changed

Lines changed: 568 additions & 555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fdbclient/BackupAgentBase.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ Future<Void> readCommitted(Database cx,
483483

484484
// When this buggify line is enabled, if there are more than 1 result then use half of the results
485485
// Copy the data instead of messing with the results directly to avoid TSS issues.
486-
if (values.size() > 1 && BUGGIFY) {
486+
if (values.size() > 1 && buggify()) {
487487
RangeResult copy;
488488
// only copy first half of values into copy
489489
for (int i = 0; i < values.size() / 2; i++) {
@@ -566,7 +566,7 @@ Future<Void> readCommitted(Database cx,
566566

567567
// When this buggify line is enabled, if there are more than 1 result then use half of the results.
568568
// Copy the data instead of messing with the results directly to avoid TSS issues.
569-
if (rangevalue.size() > 1 && BUGGIFY) {
569+
if (rangevalue.size() > 1 && buggify()) {
570570
RangeResult copy;
571571
// only copy first half of rangevalue into copy
572572
for (int i = 0; i < rangevalue.size() / 2; i++) {
@@ -928,7 +928,7 @@ Future<Void> applyMutations(Database cx,
928928
co_await coalesceKeyVersionCache(
929929
uid, newEndVersion, keyVersion, commit, committedVersion, addActor, &commitLock);
930930
beginVersion = newEndVersion;
931-
if (BUGGIFY) {
931+
if (buggify()) {
932932
co_await delay(2.0);
933933
}
934934
}
@@ -1012,7 +1012,7 @@ static Future<Void> _eraseLogData(Reference<ReadYourWritesTransaction> tr,
10121012
}
10131013
}
10141014

1015-
if (endVersion.present() || backupVersions.size() != 1 || BUGGIFY) {
1015+
if (endVersion.present() || backupVersions.size() != 1 || buggify()) {
10161016
if (!endVersion.present()) {
10171017
// Clear current backup version history
10181018
tr->clear(backupLatestVersionsKey);
@@ -1028,7 +1028,7 @@ static Future<Void> _eraseLogData(Reference<ReadYourWritesTransaction> tr,
10281028
if (clearLogRangesRequired) {
10291029
if ((nextSmallestVersion - currBeginVersion) / CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE >=
10301030
std::numeric_limits<uint8_t>::max() ||
1031-
BUGGIFY) {
1031+
buggify()) {
10321032
Key baLogRangePrefix = destUidValue.withPrefix(backupLogKeys.begin);
10331033

10341034
for (int h = 0; h <= std::numeric_limits<uint8_t>::max(); h++) {

fdbclient/BackupContainerFileSystem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ Future<Reference<IBackupFile>> BackupContainerFileSystem::writeRangeFile(Version
15611561
}
15621562

15631563
return writeFile(BackupContainerFileSystemImpl::snapshotFolderString(snapshotBeginVersion) +
1564-
format("/%d/", snapshotFileCount / (BUGGIFY ? 1 : 5000)) + fileName);
1564+
format("/%d/", snapshotFileCount / (buggify() ? 1 : 5000)) + fileName);
15651565
}
15661566

15671567
Future<Void> BackupContainerFileSystem::writePartitionListFile(Version v, std::string contents) {
@@ -2017,7 +2017,7 @@ Future<Void> testBackupContainer(std::string url,
20172017
writes.push_back(c->writeKeyspaceSnapshotFile(snapshots.rbegin()->second,
20182018
snapshotBeginEndKeys.rbegin()->second,
20192019
snapshotSizes.rbegin()->second,
2020-
IncludeKeyRangeMap(BUGGIFY)));
2020+
IncludeKeyRangeMap(buggify())));
20212021
snapshots[v] = {};
20222022
snapshotBeginEndKeys[v] = {};
20232023
snapshotSizes[v] = 0;
@@ -2440,7 +2440,7 @@ Future<Void> testBackupContainerWithMissingLogRanges(std::string url, Optional<s
24402440
writes.push_back(c->writeKeyspaceSnapshotFile(rangeFileNames,
24412441
snapshotBeginEndKeys,
24422442
deterministicRandom()->randomInt(0, 2e6),
2443-
IncludeKeyRangeMap(BUGGIFY)));
2443+
IncludeKeyRangeMap(buggify())));
24442444

24452445
// if the last missing log file overlaps with the current snapshot,
24462446
// mark snapshotsMissingLogs for current snapshot as true.
@@ -2575,7 +2575,7 @@ Future<Void> testBackupContinuousLogEndVer(std::string url, Optional<std::string
25752575

25762576
// writing snapshot file
25772577
writes.push_back(c->writeKeyspaceSnapshotFile(
2578-
rangeFileNames, snapshotBeginEndKeys, deterministicRandom()->randomInt(0, 2e6), IncludeKeyRangeMap(BUGGIFY)));
2578+
rangeFileNames, snapshotBeginEndKeys, deterministicRandom()->randomInt(0, 2e6), IncludeKeyRangeMap(buggify())));
25792579
co_await waitForAll(writes);
25802580

25812581
BackupFileList fileList = co_await c->dumpFileList();

fdbclient/BackupContainerLocalDirectory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BackupFile : public IBackupFile, ReferenceCounted<BackupFile> {
3434
BackupFile(const std::string& fileName, Reference<IAsyncFile> file, const std::string& finalFullPath)
3535
: IBackupFile(fileName), m_file(file), m_writeOffset(0), m_finalFullPath(finalFullPath),
3636
m_blockSize(CLIENT_KNOBS->BACKUP_LOCAL_FILE_WRITE_BLOCK) {
37-
if (BUGGIFY) {
37+
if (buggify()) {
3838
m_blockSize = deterministicRandom()->randomInt(100, 20000);
3939
}
4040
m_buffer.reserve(m_buffer.arena(), m_blockSize);

0 commit comments

Comments
 (0)