FastRestore:Applier:Remove unused func

This commit is contained in:
Meng Xu 2020-02-13 23:06:44 -08:00
parent 3e2c19630a
commit c34a69df32
1 changed files with 11 additions and 98 deletions

View File

@ -214,7 +214,7 @@ ACTOR static Future<Void> getAndComputeStagingKeys(
//fValues.push_back(fKVs.back().second);
fValues.push_back(tr->get(key.first));
}
for(i = 0; i < fValues.size(); i++) {
for (i = 0; i < fValues.size(); i++) {
Optional<Value> val = wait(fValues[i]);
values.push_back(val);
}
@ -234,11 +234,16 @@ ACTOR static Future<Void> getAndComputeStagingKeys(
int i = 0;
for(auto& key : imcompleteStagingKeys) {
if (!values[i].present()) {
TraceEvent(SevWarnAlways, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError").detail("Key", key.first).detail("Reason", "Not found in DB")
.detail("PendingMutations", key.second->second.pendingMutations.size()).detail("StagingKeyType", (int) key.second->second.type);
for(auto& vm : key.second->second.pendingMutations) {
for(auto& m : vm.second) {
TraceEvent(SevWarnAlways, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError").detail("PendingMutationVersion", vm.first).detail("PendingMutation", m.toString());
TraceEvent(SevWarnAlways, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError")
.detail("Key", key.first)
.detail("Reason", "Not found in DB")
.detail("PendingMutations", key.second->second.pendingMutations.size())
.detail("StagingKeyType", (int)key.second->second.type);
for (auto& vm : key.second->second.pendingMutations) {
for (auto& m : vm.second) {
TraceEvent(SevWarnAlways, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError")
.detail("PendingMutationVersion", vm.first)
.detail("PendingMutation", m.toString());
}
}
key.second->second.precomputeResult();
@ -253,20 +258,6 @@ ACTOR static Future<Void> getAndComputeStagingKeys(
i++;
}
}
// for (auto& kv : fKVs) {
// if (!kv.second.get().present()) {
// TraceEvent(SevError, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError")
// .detail("ValueNotPresent", kv.first);
// continue;
// } else {
// std::map<Key, StagingKey>::iterator iter = imcompleteStagingKeys[kv.first];
// // The key's version ideally should be the most recently committed version.
// // But as long as it is > 1 and less than the start version of the version batch, it is the same result.
// MutationRef m(MutationRef::SetValue, kv.first, kv.second.get().get());
// iter->second.add(m, (Version)1);
// iter->second.precomputeResult();
// }
// }
TraceEvent("FastRestoreApplierGetAndComputeStagingKeysDone", applierID)
.detail("GetKeys", imcompleteStagingKeys.size());
@ -274,84 +265,6 @@ ACTOR static Future<Void> getAndComputeStagingKeys(
return Void();
}
// ACTOR static Future<Void> getAndComputeStagingKeysV2(
// std::map<Key, std::map<Key, StagingKey>::iterator> imcompleteStagingKeys, Database cx, UID applierID) {
// state std::vector<Future<Void> fRets;
// TraceEvent("FastRestoreApplierGetAndComputeStagingKeysStart", applierID)
// .detail("GetKeys", imcompleteStagingKeys.size());
// try {
// for (auto& key : imcompleteStagingKeys) {
// Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
// tr->reset();
// tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
// tr->setOption(FDBTransactionOptions::LOCK_AWARE);
// fRets.push_back(map(tr->get(key.first), [](Optional<Value> const &val) -> Void() {
// if (val.present()) {
// // The key's version ideally should be the most recently committed version.
// // But as long as it is > 1 and less than the start version of the version batch, it is the same result.
// MutationRef m(MutationRef::SetValue, key.first, val.get());
// key.second->second.add(m, (Version)1);
// key.second->second.precomputeResult();
// } else {
// TraceEvent(SevError, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError").detail("Key", key.first).detail("Reason", "Not found in DB")
// .detail("PendingMutations", key.second->second.pendingMutations.size()).detail("StagingKeyType", (int) key.second->second.type);
// }
// }) );
// }
// wait(waitForAll(fRets));
// } catch (Error& e) {
// TraceEvent(SevError, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError")
// .detail("GetKeys", imcompleteStagingKeys.size())
// .detail("Error", e.what())
// .detail("ErrorCode", e.code());
// wait(tr->onError(e));
// }
// TraceEvent("FastRestoreApplierGetAndComputeStagingKeysDone", applierID)
// .detail("GetKeys", imcompleteStagingKeys.size());
// return Void();
// }
// ACTOR static Future<Void> getAndComputeStagingKeysV3(
// std::map<Key, std::map<Key, StagingKey>::iterator> imcompleteStagingKeys, Database cx, UID applierID) {
// TraceEvent("FastRestoreApplierGetAndComputeStagingKeysStart", applierID)
// .detail("GetKeys", imcompleteStagingKeys.size());
// try {
// for (auto& key : imcompleteStagingKeys) {
// Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
// tr->reset();
// tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
// tr->setOption(FDBTransactionOptions::LOCK_AWARE);
// Optional<Value> val = wait(tr->get(key.first));
// if (val.present()) {
// // The key's version ideally should be the most recently committed version.
// // But as long as it is > 1 and less than the start version of the version batch, it is the same result.
// MutationRef m(MutationRef::SetValue, key.first, val.get());
// key.second->second.add(m, (Version)1);
// key.second->second.precomputeResult();
// } else {
// TraceEvent(SevError, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError").detail("Key", key.first).detail("Reason", "Not found in DB")
// .detail("PendingMutations", key.second->second.pendingMutations.size()).detail("StagingKeyType", (int) key.second->second.type);
// }
// }
// } catch (Error& e) {
// TraceEvent(SevError, "FastRestoreApplierGetAndComputeStagingKeysUnhandledError")
// .detail("GetKeys", imcompleteStagingKeys.size())
// .detail("Error", e.what())
// .detail("ErrorCode", e.code());
// wait(tr->onError(e));
// }
// TraceEvent("FastRestoreApplierGetAndComputeStagingKeysDone", applierID)
// .detail("GetKeys", imcompleteStagingKeys.size());
// return Void();
// }
ACTOR static Future<Void> precomputeMutationsResult(Reference<ApplierBatchData> batchData, UID applierID,
int64_t batchIndex, Database cx) {