FastRestore:FixTest:Remove unnecessary read

This commit is contained in:
Meng Xu 2020-06-20 20:07:18 -07:00
parent 11af1a6916
commit 9318ec033d
2 changed files with 8 additions and 8 deletions

View File

@ -35,8 +35,8 @@
#include <cstdint>
#include <cstdarg>
#define SevFRMutationInfo SevVerbose
// #define SevFRMutationInfo SevInfo
//#define SevFRMutationInfo SevVerbose
#define SevFRMutationInfo SevInfo
struct VersionedMutation {
MutationRef mutation;

View File

@ -351,13 +351,10 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
oldData.push_back_deep(oldData.arena(), KeyValueRef(kv.key, kv.value));
}
}
Standalone<RangeResultRef> kvs = wait(tr.getRange(normalKeys, CLIENT_KNOBS->TOO_MANY));
ASSERT(!kvs.more);
int i = 0;
// Convert data by removePrefix and addPrefix in memory
state Standalone<VectorRef<KeyValueRef>> newKVs;
for (i = 0; i < oldData.size(); ++i) {
for (int i = 0; i < oldData.size(); ++i) {
Key newKey(oldData[i].key);
TraceEvent("TransformDatabaseContents")
.detail("Keys", oldData.size())
@ -371,7 +368,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
continue;
}
newKey = newKey.removePrefix(removePrefix).withPrefix(addPrefix);
newKVs.push_back_deep(newKVs.arena(), KeyValueRef(newKey.contents(), kvs[i].value));
newKVs.push_back_deep(newKVs.arena(), KeyValueRef(newKey.contents(), oldData[i].value));
TraceEvent("TransformDatabaseContents")
.detail("Index", i)
.detail("NewKey", newKVs.back().key)
@ -379,11 +376,11 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
}
// Clear the transformed data (original data with removePrefix and addPrefix) in restoreRanges
TraceEvent("TransformDatabaseContents").detail("Clear", normalKeys);
wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
for (auto& range : restoreRanges) {
TraceEvent("TransformDatabaseContents").detail("Clear", range);
tr->clear(range); // Careful when we restore only a sub key range!
}
return Void();
@ -639,6 +636,9 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
KeyRange range(self->backupRanges[i]);
Key begin = range.begin.removePrefix(self->removePrefix).withPrefix(self->addPrefix);
Key end = range.end.removePrefix(self->removePrefix).withPrefix(self->addPrefix);
TraceEvent("FastRestoreWorkloadTransformDatabaseContents")
.detail("Begin", begin)
.detail("End", end);
restoreRanges.push_back_deep(restoreRanges.arena(),
KeyRangeRef(begin.contents(), end.contents()));
}