diff --git a/design/special-key-space.md b/design/special-key-space.md index 5d22e9d7f3..7cdcfe460d 100644 --- a/design/special-key-space.md +++ b/design/special-key-space.md @@ -20,7 +20,7 @@ Consequently, the special-key-space framework wants to integrate all client func If your feature is exposing information to clients and the results are easily formatted as key-value pairs, then you can use special-key-space to implement your client function. ## How -If you choose to use, you need to implement a function class that inherits from `SpecialKeyRangeReadImpl`, which has an abstract method `Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr)`. +If you choose to use, you need to implement a function class that inherits from `SpecialKeyRangeReadImpl`, which has an abstract method `Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr)`. This method can be treated as a callback, whose implementation details are determined by the developer. Once you fill out the method, register the function class to the corresponding key range. Below is a detailed example. @@ -38,10 +38,10 @@ public: CountryToCapitalCity[LiteralStringRef("China")] = LiteralStringRef("Beijing"); } // Implement the getRange interface - Future> getRange(ReadYourWritesTransaction* ryw, + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override { - Standalone result; + RangeResult result; for (auto const& country : CountryToCapitalCity) { // the registered range here: [\xff\xff/example/, \xff\xff/example/\xff] Key keyWithPrefix = country.first.withPrefix(range.begin); @@ -71,7 +71,7 @@ ASSERT(res1.present() && res.getValue() == LiteralStringRef("Tokyo")); // getRange // Note: for getRange(key1, key2), both key1 and key2 should prefixed with \xff\xff // something like getRange("normal_key", "\xff\xff/...") is not supported yet -Standalone res2 = wait(tr.getRange(LiteralStringRef("\xff\xff/example/U"), LiteralStringRef("\xff\xff/example/U\xff"))); +RangeResult res2 = wait(tr.getRange(LiteralStringRef("\xff\xff/example/U"), LiteralStringRef("\xff\xff/example/U\xff"))); // res2 should contain USA and UK ASSERT( res2.size() == 2 && diff --git a/documentation/tutorial/tutorial.actor.cpp b/documentation/tutorial/tutorial.actor.cpp index 5ec749b1cb..4213ddd5c2 100644 --- a/documentation/tutorial/tutorial.actor.cpp +++ b/documentation/tutorial/tutorial.actor.cpp @@ -366,7 +366,7 @@ ACTOR Future fdbClient() { // 3. write 10 values in [k, k+100] beginIdx = deterministicRandom()->randomInt(0, 1e8 - 100); startKey = keyPrefix + std::to_string(beginIdx); - Standalone range = wait(tx.getRange(KeyRangeRef(startKey, endKey), 100)); + RangeResult range = wait(tx.getRange(KeyRangeRef(startKey, endKey), 100)); for (int i = 0; i < 10; ++i) { Key k = Key(keyPrefix + std::to_string(beginIdx + deterministicRandom()->randomInt(0, 100))); tx.set(k, LiteralStringRef("foo")); diff --git a/fdbbackup/backup.actor.cpp b/fdbbackup/backup.actor.cpp index f976de06a6..77e4b03f0d 100644 --- a/fdbbackup/backup.actor.cpp +++ b/fdbbackup/backup.actor.cpp @@ -1576,7 +1576,7 @@ ACTOR Future getLayerStatus(Reference tr state Reference tr2(new ReadYourWritesTransaction(dest)); tr2->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr2->setOption(FDBTransactionOptions::LOCK_AWARE); - state Standalone tagNames = wait(tr2->getRange(dba.tagNames.range(), 10000, snapshot)); + state RangeResult tagNames = wait(tr2->getRange(dba.tagNames.range(), 10000, snapshot)); state std::vector>> backupVersion; state std::vector> backupStatus; state std::vector> tagRangeBytesDR; @@ -1638,7 +1638,7 @@ ACTOR Future cleanupStatus(Reference tr, std::string name, std::string id, int limit = 1) { - state Standalone docs = wait(tr->getRange(KeyRangeRef(rootKey, strinc(rootKey)), limit, true)); + state RangeResult docs = wait(tr->getRange(KeyRangeRef(rootKey, strinc(rootKey)), limit, true)); state bool readMore = false; state int i; for (i = 0; i < docs.size(); ++i) { @@ -1667,7 +1667,7 @@ ACTOR Future cleanupStatus(Reference tr, } if (readMore) { limit = 10000; - Standalone docs2 = wait(tr->getRange(KeyRangeRef(rootKey, strinc(rootKey)), limit, true)); + RangeResult docs2 = wait(tr->getRange(KeyRangeRef(rootKey, strinc(rootKey)), limit, true)); docs = std::move(docs2); readMore = false; } @@ -1684,7 +1684,7 @@ ACTOR Future getLayerStatus(Database src, std::string root try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - state Standalone kvPairs = + state RangeResult kvPairs = wait(tr.getRange(KeyRangeRef(rootKey, strinc(rootKey)), GetRangeLimits::ROW_LIMIT_UNLIMITED)); json_spirit::mObject statusDoc; JSONDoc modifier(statusDoc); @@ -4246,4 +4246,4 @@ int main(int argc, char* argv[]) { } flushAndExit(status); -} \ No newline at end of file +} diff --git a/fdbcli/fdbcli.actor.cpp b/fdbcli/fdbcli.actor.cpp index d655601e22..a3578a95d4 100644 --- a/fdbcli/fdbcli.actor.cpp +++ b/fdbcli/fdbcli.actor.cpp @@ -3633,7 +3633,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { if (tokencmp(tokens[0], "kill")) { getTransaction(db, tr, options, intrans); if (tokens.size() == 1) { - Standalone kvs = wait( + RangeResult kvs = wait( makeInterruptable(tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -3700,7 +3700,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { if (tokencmp(tokens[0], "suspend")) { getTransaction(db, tr, options, intrans); if (tokens.size() == 1) { - Standalone kvs = wait( + RangeResult kvs = wait( makeInterruptable(tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -3911,7 +3911,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { continue; } getTransaction(db, tr, options, intrans); - Standalone kvs = wait( + RangeResult kvs = wait( makeInterruptable(tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -3940,7 +3940,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { continue; } getTransaction(db, tr, options, intrans); - Standalone kvs = wait(makeInterruptable( + RangeResult kvs = wait(makeInterruptable( tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -4019,7 +4019,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { continue; } getTransaction(db, tr, options, intrans); - Standalone kvs = wait( + RangeResult kvs = wait( makeInterruptable(tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -4061,7 +4061,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { if (tokencmp(tokens[0], "expensive_data_check")) { getTransaction(db, tr, options, intrans); if (tokens.size() == 1) { - Standalone kvs = wait( + RangeResult kvs = wait( makeInterruptable(tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")), CLIENT_KNOBS->TOO_MANY))); @@ -4177,7 +4177,7 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { endKey = strinc(tokens[1]); } - Standalone kvs = wait(makeInterruptable( + RangeResult kvs = wait(makeInterruptable( getTransaction(db, tr, options, intrans)->getRange(KeyRangeRef(tokens[1], endKey), limit))); printf("\nRange limited to %d keys\n", limit); diff --git a/fdbclient/BackupAgent.actor.h b/fdbclient/BackupAgent.actor.h index 1e3f41bb0e..c8903b9fe4 100644 --- a/fdbclient/BackupAgent.actor.h +++ b/fdbclient/BackupAgent.actor.h @@ -593,10 +593,10 @@ public: Reference futureBucket; }; -typedef std::pair, Version> RangeResultWithVersion; +using RangeResultWithVersion = std::pair; struct RCGroup { - Standalone items; + RangeResult items; Version version; uint64_t groupKey; diff --git a/fdbclient/BackupAgentBase.actor.cpp b/fdbclient/BackupAgentBase.actor.cpp index 72fce5a509..fba2e69954 100644 --- a/fdbclient/BackupAgentBase.actor.cpp +++ b/fdbclient/BackupAgentBase.actor.cpp @@ -401,7 +401,7 @@ ACTOR Future readCommitted(Database cx, releaser = FlowLock::Releaser( *lock, limits.bytes + CLIENT_KNOBS->VALUE_SIZE_LIMIT + CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); - state Standalone values = wait(tr.getRange(begin, end, limits)); + state RangeResult values = wait(tr.getRange(begin, end, limits)); // When this buggify line is enabled, if there are more than 1 result then use half of the results if (values.size() > 1 && BUGGIFY) { @@ -467,7 +467,7 @@ ACTOR Future readCommitted(Database cx, if (lockAware) tr.setOption(FDBTransactionOptions::LOCK_AWARE); - state Standalone rangevalue = wait(tr.getRange(nextKey, end, limits)); + state RangeResult rangevalue = wait(tr.getRange(nextKey, end, limits)); // When this buggify line is enabled, if there are more than 1 result then use half of the results if (rangevalue.size() > 1 && BUGGIFY) { @@ -778,7 +778,7 @@ ACTOR static Future _eraseLogData(Reference tr, return Void(); } - state Standalone backupVersions = wait( + state RangeResult backupVersions = wait( tr->getRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath)), CLIENT_KNOBS->TOO_MANY)); // Make sure version history key does exist and lower the beginVersion if needed @@ -870,7 +870,7 @@ ACTOR static Future _eraseLogData(Reference tr, } if (!endVersion.present() && backupVersions.size() == 1) { - Standalone existingDestUidValues = + RangeResult existingDestUidValues = wait(tr->getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY)); for (auto it : existingDestUidValues) { if (it.value == destUidValue) { @@ -903,7 +903,7 @@ ACTOR Future cleanupLogMutations(Database cx, Value destUidValue, bool del tr->setOption(FDBTransactionOptions::LOCK_AWARE); tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - state Standalone backupVersions = wait(tr->getRange( + state RangeResult backupVersions = wait(tr->getRange( KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath)), CLIENT_KNOBS->TOO_MANY)); state Version readVer = tr->getReadVersion().get(); @@ -990,7 +990,7 @@ ACTOR Future cleanupBackup(Database cx, bool deleteData) { tr->setOption(FDBTransactionOptions::LOCK_AWARE); tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - state Standalone destUids = wait( + state RangeResult destUids = wait( tr->getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY)); for (auto destUid : destUids) { diff --git a/fdbclient/DatabaseBackupAgent.actor.cpp b/fdbclient/DatabaseBackupAgent.actor.cpp index 9b8e02a102..20f9c6bcf2 100644 --- a/fdbclient/DatabaseBackupAgent.actor.cpp +++ b/fdbclient/DatabaseBackupAgent.actor.cpp @@ -157,7 +157,7 @@ struct BackupRangeTaskFunc : TaskFuncBase { tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr->setOption(FDBTransactionOptions::LOCK_AWARE); state Standalone> results; - Standalone values = wait(tr->getRange( + RangeResult values = wait(tr->getRange( KeyRangeRef(keyAfter(beginKey.withPrefix(keyServersPrefix)), endKey.withPrefix(keyServersPrefix)), limit)); for (auto& s : values) { @@ -314,19 +314,18 @@ struct BackupRangeTaskFunc : TaskFuncBase { applyMutationsKeyVersionMapRange.begin); state Key rangeCountKey = task->params[BackupAgentBase::keyConfigLogUid].withPrefix( applyMutationsKeyVersionCountRange.begin); - state Future> backupVersions = + state Future backupVersions = krmGetRanges(tr, prefix, KeyRangeRef(rangeBegin, rangeEnd), BUGGIFY ? 2 : 2000, 1e5); state Future> logVersionValue = tr->get( task->params[BackupAgentBase::keyConfigLogUid].withPrefix(applyMutationsEndRange.begin), true); state Future> rangeCountValue = tr->get(rangeCountKey, true); - state Future> prevRange = tr->getRange( + state Future prevRange = tr->getRange( firstGreaterOrEqual(prefix), lastLessOrEqual(rangeBegin.withPrefix(prefix)), 1, true, true); - state Future> nextRange = - tr->getRange(firstGreaterOrEqual(rangeEnd.withPrefix(prefix)), - firstGreaterOrEqual(strinc(prefix)), - 1, - true, - false); + state Future nextRange = tr->getRange(firstGreaterOrEqual(rangeEnd.withPrefix(prefix)), + firstGreaterOrEqual(strinc(prefix)), + 1, + true, + false); state Future verified = taskBucket->keepRunning(tr, task); wait(checkDatabaseLock(tr, @@ -725,7 +724,7 @@ struct CopyLogRangeTaskFunc : TaskFuncBase { state Subspace conf = Subspace(databaseBackupPrefixRange.begin) .get(BackupAgentBase::keyConfig) .get(task->params[BackupAgentBase::keyConfigLogUid]); - state std::vector> nextMutations; + state std::vector nextMutations; state bool isTimeoutOccured = false; state Optional lastKey; state Version lastVersion; @@ -736,9 +735,9 @@ struct CopyLogRangeTaskFunc : TaskFuncBase { return Optional(); } - state std::vector> mutations = std::move(nextMutations); + state std::vector mutations = std::move(nextMutations); state int64_t mutationSize = nextMutationSize; - nextMutations = std::vector>(); + nextMutations = std::vector(); nextMutationSize = 0; if (!endOfStream) { @@ -1470,7 +1469,7 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase { .get(BackupAgentBase::keyConfig) .get(task->params[BackupAgentBase::keyConfigLogUid]); - state std::vector> nextMutations; + state std::vector nextMutations; state int64_t nextMutationSize = 0; loop { try { @@ -1478,9 +1477,9 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase { return Void(); } - state std::vector> mutations = std::move(nextMutations); + state std::vector mutations = std::move(nextMutations); state int64_t mutationSize = nextMutationSize; - nextMutations = std::vector>(); + nextMutations = std::vector(); nextMutationSize = 0; if (!endOfStream) { @@ -1819,7 +1818,7 @@ struct CopyDiffLogsUpgradeTaskFunc : TaskFuncBase { } if (backupRanges.size() == 1) { - Standalone existingDestUidValues = wait(srcTr->getRange( + RangeResult existingDestUidValues = wait(srcTr->getRange( KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY)); bool found = false; for (auto it : existingDestUidValues) { @@ -2063,7 +2062,7 @@ struct StartFullBackupTaskFunc : TaskFuncBase { // Initialize destUid if (backupRanges.size() == 1) { - Standalone existingDestUidValues = wait(srcTr->getRange( + RangeResult existingDestUidValues = wait(srcTr->getRange( KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY)); bool found = false; for (auto it : existingDestUidValues) { @@ -2561,7 +2560,7 @@ public: if (backupAction == DatabaseBackupAgent::PreBackupAction::VERIFY) { // Make sure all of the ranges are empty before we backup into them. - state std::vector>> backupIntoResults; + state std::vector> backupIntoResults; for (auto& backupRange : backupRanges) { backupIntoResults.push_back( tr->getRange(backupRange.removePrefix(removePrefix).withPrefix(addPrefix), 1)); @@ -3060,13 +3059,13 @@ public: tr->setOption(FDBTransactionOptions::LOCK_AWARE); state Future> fPaused = tr->get(backupAgent->taskBucket->getPauseKey()); - state Future> fErrorValues = + state Future fErrorValues = errorLimit > 0 ? tr->getRange(backupAgent->errors.get(BinaryWriter::toValue(logUid, Unversioned())).range(), errorLimit, false, true) - : Future>(); + : Future(); state Future> fBackupUid = tr->get(backupAgent->states.get(BinaryWriter::toValue(logUid, Unversioned())) .pack(DatabaseBackupAgent::keyFolderId)); @@ -3141,7 +3140,7 @@ public: // Append the errors, if requested if (errorLimit > 0) { - Standalone values = wait(fErrorValues); + RangeResult values = wait(fErrorValues); // Display the errors, if any if (values.size() > 0) { diff --git a/fdbclient/FDBTypes.h b/fdbclient/FDBTypes.h index b2cd469ab8..59d7412d79 100644 --- a/fdbclient/FDBTypes.h +++ b/fdbclient/FDBTypes.h @@ -706,6 +706,7 @@ struct RangeResultRef : VectorRef { " readToBegin:" + std::to_string(readToBegin) + " readThroughEnd:" + std::to_string(readThroughEnd); } }; +using RangeResult = Standalone; template <> struct Traceable : std::true_type { diff --git a/fdbclient/FileBackupAgent.actor.cpp b/fdbclient/FileBackupAgent.actor.cpp index a09ed25789..dfd33b5b67 100644 --- a/fdbclient/FileBackupAgent.actor.cpp +++ b/fdbclient/FileBackupAgent.actor.cpp @@ -1025,7 +1025,7 @@ ACTOR static Future>> getBlockOfShards(ReferencesetOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr->setOption(FDBTransactionOptions::LOCK_AWARE); state Standalone> results; - Standalone values = wait(tr->getRange( + RangeResult values = wait(tr->getRange( KeyRangeRef(keyAfter(beginKey.withPrefix(keyServersPrefix)), endKey.withPrefix(keyServersPrefix)), limit)); for (auto& s : values) { @@ -4584,7 +4584,7 @@ public: state Key destUidValue(BinaryWriter::toValue(uid, Unversioned())); if (normalizedRanges.size() == 1) { - Standalone existingDestUidValues = wait( + RangeResult existingDestUidValues = wait( tr->getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY)); bool found = false; for (auto it : existingDestUidValues) { @@ -4691,7 +4691,7 @@ public: KeyRange restoreIntoRange = KeyRangeRef(restoreRanges[index].begin, restoreRanges[index].end) .removePrefix(removePrefix) .withPrefix(addPrefix); - Standalone existingRows = wait(tr->getRange(restoreIntoRange, 1)); + RangeResult existingRows = wait(tr->getRange(restoreIntoRange, 1)); if (existingRows.size() > 0 && !onlyAppyMutationLogs) { throw restore_destination_not_empty(); } @@ -5741,7 +5741,7 @@ ACTOR static Future writeKVs(Database cx, Standalone readKVs = wait(tr.getRange(KeyRangeRef(k1, k2), CLIENT_KNOBS->TOO_MANY)); + RangeResult readKVs = wait(tr.getRange(KeyRangeRef(k1, k2), CLIENT_KNOBS->TOO_MANY)); ASSERT(readKVs.size() > 0 || begin == end); break; } catch (Error& e) { @@ -5773,7 +5773,7 @@ ACTOR static Future transformDatabaseContents(Database cx, tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); for (i = 0; i < restoreRanges.size(); ++i) { - Standalone kvs = wait(tr.getRange(restoreRanges[i], CLIENT_KNOBS->TOO_MANY)); + RangeResult kvs = wait(tr.getRange(restoreRanges[i], CLIENT_KNOBS->TOO_MANY)); ASSERT(!kvs.more); for (auto kv : kvs) { oldData.push_back_deep(oldData.arena(), KeyValueRef(kv.key, kv.value)); @@ -5840,7 +5840,7 @@ ACTOR static Future transformDatabaseContents(Database cx, try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone emptyData = wait(tr.getRange(normalKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult emptyData = wait(tr.getRange(normalKeys, CLIENT_KNOBS->TOO_MANY)); for (int i = 0; i < emptyData.size(); ++i) { TraceEvent(SevError, "ExpectEmptyData") .detail("Index", i) @@ -5878,7 +5878,7 @@ ACTOR static Future transformDatabaseContents(Database cx, try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone allData = wait(tr.getRange(normalKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult allData = wait(tr.getRange(normalKeys, CLIENT_KNOBS->TOO_MANY)); TraceEvent(SevFRTestInfo, "SanityCheckData").detail("Size", allData.size()); for (int i = 0; i < allData.size(); ++i) { std::pair backupRestoreValid = insideValidRange(allData[i], restoreRanges, backupRanges); diff --git a/fdbclient/GlobalConfig.actor.cpp b/fdbclient/GlobalConfig.actor.cpp index e0991f4b44..e4f0791431 100644 --- a/fdbclient/GlobalConfig.actor.cpp +++ b/fdbclient/GlobalConfig.actor.cpp @@ -191,7 +191,7 @@ ACTOR Future GlobalConfig::refresh(GlobalConfig* self) { self->erase(KeyRangeRef(""_sr, "\xff"_sr)); Transaction tr(self->cx); - Standalone result = wait(tr.getRange(globalConfigDataKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult result = wait(tr.getRange(globalConfigDataKeys, CLIENT_KNOBS->TOO_MANY)); for (const auto& kv : result) { KeyRef systemKey = kv.key.removePrefix(globalConfigKeysPrefix); self->insert(systemKey, kv.value); diff --git a/fdbclient/IClientApi.h b/fdbclient/IClientApi.h index 45249f1509..05f64c1f64 100644 --- a/fdbclient/IClientApi.h +++ b/fdbclient/IClientApi.h @@ -42,24 +42,24 @@ public: // until the ThreadFuture's ThreadSingleAssignmentVar has its memory released or it is destroyed. virtual ThreadFuture> get(const KeyRef& key, bool snapshot = false) = 0; virtual ThreadFuture getKey(const KeySelectorRef& key, bool snapshot = false) = 0; - virtual ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot = false, - bool reverse = false) = 0; - virtual ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) = 0; - virtual ThreadFuture> getRange(const KeyRangeRef& keys, - int limit, - bool snapshot = false, - bool reverse = false) = 0; - virtual ThreadFuture> getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) = 0; + virtual ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot = false, + bool reverse = false) = 0; + virtual ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) = 0; + virtual ThreadFuture getRange(const KeyRangeRef& keys, + int limit, + bool snapshot = false, + bool reverse = false) = 0; + virtual ThreadFuture getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) = 0; virtual ThreadFuture>> getAddressesForKey(const KeyRef& key) = 0; virtual ThreadFuture> getVersionstamp() = 0; diff --git a/fdbclient/KeyBackedTypes.h b/fdbclient/KeyBackedTypes.h index dd6623e4ef..f92324e4ab 100644 --- a/fdbclient/KeyBackedTypes.h +++ b/fdbclient/KeyBackedTypes.h @@ -280,7 +280,7 @@ public: return map( tr->getRange( KeyRangeRef(s.pack(Codec::pack(begin)), endKey), GetRangeLimits(limit), snapshot, reverse), - [s](Standalone const& kvs) -> PairsType { + [s](RangeResult const& kvs) -> PairsType { PairsType results; for (int i = 0; i < kvs.size(); ++i) { KeyType key = Codec::unpack(s.unpack(kvs[i].key)); @@ -344,7 +344,7 @@ public: Key endKey = end.present() ? s.pack(Codec::pack(end.get())) : space.range().end; return map( tr->getRange(KeyRangeRef(s.pack(Codec::pack(begin)), endKey), GetRangeLimits(limit), snapshot), - [s](Standalone const& kvs) -> Values { + [s](RangeResult const& kvs) -> Values { Values results; for (int i = 0; i < kvs.size(); ++i) { results.push_back(Codec::unpack(s.unpack(kvs[i].key))); diff --git a/fdbclient/KeyRangeMap.actor.cpp b/fdbclient/KeyRangeMap.actor.cpp index 67992e3e95..7b7dcdf1e3 100644 --- a/fdbclient/KeyRangeMap.actor.cpp +++ b/fdbclient/KeyRangeMap.actor.cpp @@ -35,7 +35,7 @@ void KeyRangeActorMap::getRangesAffectedByInsertion(const KeyRangeRef& keys, vec affectedRanges.push_back(KeyRangeRef(keys.end, e.end())); } -Standalone krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Standalone kv) { +RangeResult krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, RangeResult kv) { ASSERT(!kv.more || kv.size() > 1); KeyRange withPrefix = KeyRangeRef(mapPrefix.toString() + keys.begin.toString(), mapPrefix.toString() + keys.end.toString()); @@ -46,7 +46,7 @@ Standalone krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Stan if (kv.size() && kv.end()[-1].key.startsWith(mapPrefix)) endValue = kv.end()[-1].value; - Standalone result; + RangeResult result; result.arena().dependsOn(kv.arena()); result.arena().dependsOn(keys.arena()); @@ -67,34 +67,28 @@ Standalone krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Stan } // Returns keys.begin, all transitional points in keys, and keys.end, and their values -ACTOR Future> krmGetRanges(Transaction* tr, - Key mapPrefix, - KeyRange keys, - int limit, - int limitBytes) { +ACTOR Future krmGetRanges(Transaction* tr, Key mapPrefix, KeyRange keys, int limit, int limitBytes) { KeyRange withPrefix = KeyRangeRef(mapPrefix.toString() + keys.begin.toString(), mapPrefix.toString() + keys.end.toString()); state GetRangeLimits limits(limit, limitBytes); limits.minRows = 2; - Standalone kv = - wait(tr->getRange(lastLessOrEqual(withPrefix.begin), firstGreaterThan(withPrefix.end), limits)); + RangeResult kv = wait(tr->getRange(lastLessOrEqual(withPrefix.begin), firstGreaterThan(withPrefix.end), limits)); return krmDecodeRanges(mapPrefix, keys, kv); } -ACTOR Future> krmGetRanges(Reference tr, - Key mapPrefix, - KeyRange keys, - int limit, - int limitBytes) { +ACTOR Future krmGetRanges(Reference tr, + Key mapPrefix, + KeyRange keys, + int limit, + int limitBytes) { KeyRange withPrefix = KeyRangeRef(mapPrefix.toString() + keys.begin.toString(), mapPrefix.toString() + keys.end.toString()); state GetRangeLimits limits(limit, limitBytes); limits.minRows = 2; - Standalone kv = - wait(tr->getRange(lastLessOrEqual(withPrefix.begin), firstGreaterThan(withPrefix.end), limits)); + RangeResult kv = wait(tr->getRange(lastLessOrEqual(withPrefix.begin), firstGreaterThan(withPrefix.end), limits)); return krmDecodeRanges(mapPrefix, keys, kv); } @@ -125,8 +119,7 @@ void krmSetPreviouslyEmptyRange(CommitTransactionRef& tr, ACTOR Future krmSetRange(Transaction* tr, Key mapPrefix, KeyRange range, Value value) { state KeyRange withPrefix = KeyRangeRef(mapPrefix.toString() + range.begin.toString(), mapPrefix.toString() + range.end.toString()); - Standalone old = - wait(tr->getRange(lastLessOrEqual(withPrefix.end), firstGreaterThan(withPrefix.end), 1, true)); + RangeResult old = wait(tr->getRange(lastLessOrEqual(withPrefix.end), firstGreaterThan(withPrefix.end), 1, true)); Value oldValue; bool hasResult = old.size() > 0 && old[0].key.startsWith(mapPrefix); @@ -147,8 +140,7 @@ ACTOR Future krmSetRange(Transaction* tr, Key mapPrefix, KeyRange range, V ACTOR Future krmSetRange(Reference tr, Key mapPrefix, KeyRange range, Value value) { state KeyRange withPrefix = KeyRangeRef(mapPrefix.toString() + range.begin.toString(), mapPrefix.toString() + range.end.toString()); - Standalone old = - wait(tr->getRange(lastLessOrEqual(withPrefix.end), firstGreaterThan(withPrefix.end), 1, true)); + RangeResult old = wait(tr->getRange(lastLessOrEqual(withPrefix.end), firstGreaterThan(withPrefix.end), 1, true)); Value oldValue; bool hasResult = old.size() > 0 && old[0].key.startsWith(mapPrefix); @@ -182,7 +174,7 @@ static Future krmSetRangeCoalescing_(Transaction* tr, state KeyRange maxWithPrefix = KeyRangeRef(mapPrefix.toString() + maxRange.begin.toString(), mapPrefix.toString() + maxRange.end.toString()); - state vector>> keys; + state vector> keys; keys.push_back(tr->getRange(lastLessThan(withPrefix.begin), firstGreaterOrEqual(withPrefix.begin), 1, true)); keys.push_back(tr->getRange(lastLessOrEqual(withPrefix.end), firstGreaterThan(withPrefix.end) + 1, 2, true)); wait(waitForAll(keys)); diff --git a/fdbclient/KeyRangeMap.h b/fdbclient/KeyRangeMap.h index 38a340c77b..7016dcfc4d 100644 --- a/fdbclient/KeyRangeMap.h +++ b/fdbclient/KeyRangeMap.h @@ -126,16 +126,16 @@ private: // krm*(): KeyRangeMap-like abstraction stored in the database, accessed through Transactions class Transaction; class ReadYourWritesTransaction; -Future> krmGetRanges(Transaction* const& tr, - Key const& mapPrefix, - KeyRange const& keys, - int const& limit = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT, - int const& limitBytes = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT_BYTES); -Future> krmGetRanges(Reference const& tr, - Key const& mapPrefix, - KeyRange const& keys, - int const& limit = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT, - int const& limitBytes = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT_BYTES); +Future krmGetRanges(Transaction* const& tr, + Key const& mapPrefix, + KeyRange const& keys, + int const& limit = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT, + int const& limitBytes = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT_BYTES); +Future krmGetRanges(Reference const& tr, + Key const& mapPrefix, + KeyRange const& keys, + int const& limit = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT, + int const& limitBytes = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT_BYTES); void krmSetPreviouslyEmptyRange(Transaction* tr, const KeyRef& mapPrefix, const KeyRangeRef& keys, @@ -162,7 +162,7 @@ Future krmSetRangeCoalescing(Reference const& t KeyRange const& range, KeyRange const& maxRange, Value const& value); -Standalone krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Standalone kv); +RangeResult krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, RangeResult kv); template std::vector> KeyRangeMap::getAffectedRangesAfterInsertion( diff --git a/fdbclient/ManagementAPI.actor.cpp b/fdbclient/ManagementAPI.actor.cpp index 05e1ec95e2..90d670e801 100644 --- a/fdbclient/ManagementAPI.actor.cpp +++ b/fdbclient/ManagementAPI.actor.cpp @@ -357,7 +357,7 @@ ACTOR Future getDatabaseConfiguration(Database cx) { loop { try { tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone res = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult res = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(res.size() < CLIENT_KNOBS->TOO_MANY); DatabaseConfiguration config; config.fromKeyValues((VectorRef)res); @@ -407,7 +407,7 @@ ACTOR Future changeConfig(Database cx, std::map> fConfig = tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY); + state Future fConfig = tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY); state Future> fWorkers = getWorkers(&tr); wait(success(fConfig) || tooLong); @@ -458,19 +458,19 @@ ACTOR Future changeConfig(Database cx, std::map> fServerList = - (newConfig.regions.size()) ? tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY) - : Future>(); + state Future fServerList = (newConfig.regions.size()) + ? tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY) + : Future(); if (newConfig.usableRegions == 2) { if (oldReplicationUsesDcId) { - state Future> fLocalityList = + state Future fLocalityList = tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY); wait(success(fLocalityList) || tooLong); if (!fLocalityList.isReady()) { return ConfigurationResult::DATABASE_UNAVAILABLE; } - Standalone localityList = fLocalityList.get(); + RangeResult localityList = fLocalityList.get(); ASSERT(!localityList.more && localityList.size() < CLIENT_KNOBS->TOO_MANY); std::set localityDcIds; @@ -513,7 +513,7 @@ ACTOR Future changeConfig(Database cx, std::map serverList = fServerList.get(); + RangeResult serverList = fServerList.get(); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); std::set newDcIds; @@ -988,8 +988,8 @@ Future changeConfig(Database const& cx, std::string const& } ACTOR Future> getWorkers(Transaction* tr) { - state Future> processClasses = tr->getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY); - state Future> processData = tr->getRange(workerListKeys, CLIENT_KNOBS->TOO_MANY); + state Future processClasses = tr->getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY); + state Future processData = tr->getRange(workerListKeys, CLIENT_KNOBS->TOO_MANY); wait(success(processClasses) && success(processData)); ASSERT(!processClasses.get().more && processClasses.get().size() < CLIENT_KNOBS->TOO_MANY); @@ -1679,9 +1679,9 @@ ACTOR Future setClass(Database cx, AddressExclusion server, ProcessClass p } ACTOR Future> getExcludedServers(Transaction* tr) { - state Standalone r = wait(tr->getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult r = wait(tr->getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!r.more && r.size() < CLIENT_KNOBS->TOO_MANY); - state Standalone r2 = wait(tr->getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult r2 = wait(tr->getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!r2.more && r2.size() < CLIENT_KNOBS->TOO_MANY); vector exclusions; @@ -1867,7 +1867,7 @@ ACTOR Future checkForExcludingServersTxActor(ReadYourWritesTransaction* tr // recovery // Check that there aren't any storage servers with addresses violating the exclusions - Standalone serverList = wait(tr->getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult serverList = wait(tr->getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); state bool ok = true; @@ -1948,7 +1948,7 @@ ACTOR Future waitForFullReplication(Database cx) { tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone confResults = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult confResults = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!confResults.more && confResults.size() < CLIENT_KNOBS->TOO_MANY); state DatabaseConfiguration config; config.fromKeyValues((VectorRef)confResults); @@ -2203,8 +2203,7 @@ ACTOR Future changeCachedRange(Database cx, KeyRangeRef range, bool add) { tr.clear(sysRangeClear); tr.clear(privateRange); tr.addReadConflictRange(privateRange); - Standalone previous = - wait(tr.getRange(KeyRangeRef(storageCachePrefix, sysRange.begin), 1, true)); + RangeResult previous = wait(tr.getRange(KeyRangeRef(storageCachePrefix, sysRange.begin), 1, true)); bool prevIsCached = false; if (!previous.empty()) { std::vector prevVal; @@ -2220,8 +2219,7 @@ ACTOR Future changeCachedRange(Database cx, KeyRangeRef range, bool add) { tr.set(sysRange.begin, trueValue); tr.set(privateRange.begin, serverKeysTrue); } - Standalone after = - wait(tr.getRange(KeyRangeRef(sysRange.end, storageCacheKeys.end), 1, false)); + RangeResult after = wait(tr.getRange(KeyRangeRef(sysRange.end, storageCacheKeys.end), 1, false)); bool afterIsCached = false; if (!after.empty()) { std::vector afterVal; diff --git a/fdbclient/MultiVersionTransaction.actor.cpp b/fdbclient/MultiVersionTransaction.actor.cpp index 177ce68673..18f7bc71e8 100644 --- a/fdbclient/MultiVersionTransaction.actor.cpp +++ b/fdbclient/MultiVersionTransaction.actor.cpp @@ -89,19 +89,19 @@ ThreadFuture DLTransaction::getKey(const KeySelectorRef& key, bool snapshot }); } -ThreadFuture> DLTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot, - bool reverse) { +ThreadFuture DLTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot, + bool reverse) { return getRange(begin, end, GetRangeLimits(limit), snapshot, reverse); } -ThreadFuture> DLTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +ThreadFuture DLTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot, + bool reverse) { FdbCApi::FDBFuture* f = api->transactionGetRange(tr, begin.getKey().begin(), begin.getKey().size(), @@ -117,7 +117,7 @@ ThreadFuture> DLTransaction::getRange(const KeySelect 0, snapshot, reverse); - return toThreadFuture>(api, f, [](FdbCApi::FDBFuture* f, FdbCApi* api) { + return toThreadFuture(api, f, [](FdbCApi::FDBFuture* f, FdbCApi* api) { const FdbCApi::FDBKeyValue* kvs; int count; FdbCApi::fdb_bool_t more; @@ -125,23 +125,19 @@ ThreadFuture> DLTransaction::getRange(const KeySelect ASSERT(!error); // The memory for this is stored in the FDBFuture and is released when the future gets destroyed - return Standalone(RangeResultRef(VectorRef((KeyValueRef*)kvs, count), more), - Arena()); + return RangeResult(RangeResultRef(VectorRef((KeyValueRef*)kvs, count), more), Arena()); }); } -ThreadFuture> DLTransaction::getRange(const KeyRangeRef& keys, - int limit, - bool snapshot, - bool reverse) { +ThreadFuture DLTransaction::getRange(const KeyRangeRef& keys, int limit, bool snapshot, bool reverse) { return getRange( firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), GetRangeLimits(limit), snapshot, reverse); } -ThreadFuture> DLTransaction::getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +ThreadFuture DLTransaction::getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot, + bool reverse) { return getRange(firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limits, snapshot, reverse); } @@ -685,45 +681,45 @@ ThreadFuture MultiVersionTransaction::getKey(const KeySelectorRef& key, boo return abortableFuture(f, tr.onChange); } -ThreadFuture> MultiVersionTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot, - bool reverse) { +ThreadFuture MultiVersionTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot, + bool reverse) { auto tr = getTransaction(); auto f = tr.transaction ? tr.transaction->getRange(begin, end, limit, snapshot, reverse) - : ThreadFuture>(Never()); + : ThreadFuture(Never()); return abortableFuture(f, tr.onChange); } -ThreadFuture> MultiVersionTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +ThreadFuture MultiVersionTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot, + bool reverse) { auto tr = getTransaction(); auto f = tr.transaction ? tr.transaction->getRange(begin, end, limits, snapshot, reverse) - : ThreadFuture>(Never()); + : ThreadFuture(Never()); return abortableFuture(f, tr.onChange); } -ThreadFuture> MultiVersionTransaction::getRange(const KeyRangeRef& keys, - int limit, - bool snapshot, - bool reverse) { +ThreadFuture MultiVersionTransaction::getRange(const KeyRangeRef& keys, + int limit, + bool snapshot, + bool reverse) { auto tr = getTransaction(); - auto f = tr.transaction ? tr.transaction->getRange(keys, limit, snapshot, reverse) - : ThreadFuture>(Never()); + auto f = + tr.transaction ? tr.transaction->getRange(keys, limit, snapshot, reverse) : ThreadFuture(Never()); return abortableFuture(f, tr.onChange); } -ThreadFuture> MultiVersionTransaction::getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +ThreadFuture MultiVersionTransaction::getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot, + bool reverse) { auto tr = getTransaction(); - auto f = tr.transaction ? tr.transaction->getRange(keys, limits, snapshot, reverse) - : ThreadFuture>(Never()); + auto f = + tr.transaction ? tr.transaction->getRange(keys, limits, snapshot, reverse) : ThreadFuture(Never()); return abortableFuture(f, tr.onChange); } diff --git a/fdbclient/MultiVersionTransaction.h b/fdbclient/MultiVersionTransaction.h index 70de66c064..a98e16b440 100644 --- a/fdbclient/MultiVersionTransaction.h +++ b/fdbclient/MultiVersionTransaction.h @@ -200,24 +200,24 @@ public: ThreadFuture> get(const KeyRef& key, bool snapshot = false) override; ThreadFuture getKey(const KeySelectorRef& key, bool snapshot = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeyRangeRef& keys, - int limit, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override; + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeyRangeRef& keys, + int limit, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override; ThreadFuture>> getAddressesForKey(const KeyRef& key) override; ThreadFuture> getVersionstamp() override; ThreadFuture getEstimatedRangeSizeBytes(const KeyRangeRef& keys) override; @@ -339,24 +339,24 @@ public: ThreadFuture> get(const KeyRef& key, bool snapshot = false) override; ThreadFuture getKey(const KeySelectorRef& key, bool snapshot = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeyRangeRef& keys, - int limit, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override; + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeyRangeRef& keys, + int limit, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override; ThreadFuture>> getAddressesForKey(const KeyRef& key) override; ThreadFuture> getVersionstamp() override; diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index b9cf4abae5..a9bc969a13 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -391,7 +391,7 @@ ACTOR static Future delExcessClntTxnEntriesActor(Transaction* tr, int64_t ? (txInfoSize - clientTxInfoSizeLimit) : CLIENT_KNOBS->TRANSACTION_SIZE_LIMIT; GetRangeLimits limit(GetRangeLimits::ROW_LIMIT_UNLIMITED, getRangeByteLimit); - Standalone txEntries = + RangeResult txEntries = wait(tr->getRange(KeyRangeRef(clientLatencyName, strinc(clientLatencyName)), limit)); state int64_t numBytesToDel = 0; KeyRef endKey; @@ -601,7 +601,7 @@ ACTOR Future updateCachedRanges(DatabaseContext* self, std::map range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!range.more); std::vector>> cacheInterfaces; cacheInterfaces.reserve(cacheServers->size()); @@ -678,8 +678,7 @@ ACTOR Future monitorCacheList(DatabaseContext* self) { // the cyclic reference to self. wait(refreshTransaction(self, &tr)); try { - Standalone cacheList = - wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult cacheList = wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!cacheList.more); bool hasChanges = false; std::map allCacheServers; @@ -762,16 +761,16 @@ void DatabaseContext::registerSpecialKeySpaceModule(SpecialKeySpace::MODULE modu specialKeySpaceModules.push_back(std::move(impl)); } -ACTOR Future> getWorkerInterfaces(Reference clusterFile); +ACTOR Future getWorkerInterfaces(Reference clusterFile); ACTOR Future> getJSON(Database db); struct WorkerInterfacesSpecialKeyImpl : SpecialKeyRangeReadImpl { - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override { + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override { if (ryw->getDatabase().getPtr() && ryw->getDatabase()->getConnectionFile()) { Key prefix = Key(getKeyRange().begin); return map(getWorkerInterfaces(ryw->getDatabase()->getConnectionFile()), - [prefix = prefix, kr = KeyRange(kr)](const Standalone& in) { - Standalone result; + [prefix = prefix, kr = KeyRange(kr)](const RangeResult& in) { + RangeResult result; for (const auto& [k_, v] : in) { auto k = k_.withPrefix(prefix); if (kr.contains(k)) @@ -782,7 +781,7 @@ struct WorkerInterfacesSpecialKeyImpl : SpecialKeyRangeReadImpl { return result; }); } else { - return Standalone(); + return RangeResult(); } } @@ -790,10 +789,10 @@ struct WorkerInterfacesSpecialKeyImpl : SpecialKeyRangeReadImpl { }; struct SingleSpecialKeyImpl : SpecialKeyRangeReadImpl { - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override { + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override { ASSERT(kr.contains(k)); return map(f(ryw), [k = k](Optional v) { - Standalone result; + RangeResult result; if (v.present()) { result.push_back_deep(result.arena(), KeyValueRef(k, v.get())); } @@ -812,11 +811,11 @@ private: class HealthMetricsRangeImpl : public SpecialKeyRangeAsyncImpl { public: explicit HealthMetricsRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; -static Standalone healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRangeRef kr) { - Standalone result; +static RangeResult healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRangeRef kr) { + RangeResult result; if (CLIENT_BUGGIFY) return result; if (kr.contains(LiteralStringRef("\xff\xff/metrics/health/aggregate")) && metrics.worstStorageDurabilityLag != 0) { @@ -886,8 +885,7 @@ static Standalone healthMetricsToKVPairs(const HealthMetrics& me return result; } -ACTOR static Future> healthMetricsGetRangeActor(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) { +ACTOR static Future healthMetricsGetRangeActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { HealthMetrics metrics = wait(ryw->getDatabase()->getHealthMetrics( /*detailed ("per process")*/ kr.intersects(KeyRangeRef(LiteralStringRef("\xff\xff/metrics/health/storage/"), LiteralStringRef("\xff\xff/metrics/health/storage0"))) || @@ -898,8 +896,7 @@ ACTOR static Future> healthMetricsGetRangeActor(ReadY HealthMetricsRangeImpl::HealthMetricsRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {} -Future> HealthMetricsRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future HealthMetricsRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return healthMetricsGetRangeActor(ryw, kr); } @@ -1980,14 +1977,14 @@ AddressExclusion AddressExclusion::parse(StringRef const& key) { } } -Future> getRange(Database const& cx, - Future const& fVersion, - KeySelector const& begin, - KeySelector const& end, - GetRangeLimits const& limits, - bool const& reverse, - TransactionInfo const& info, - TagSet const& tags); +Future getRange(Database const& cx, + Future const& fVersion, + KeySelector const& begin, + KeySelector const& end, + GetRangeLimits const& limits, + bool const& reverse, + TransactionInfo const& info, + TagSet const& tags); ACTOR Future> getValue(Future version, Key key, @@ -2713,14 +2710,14 @@ void transformRangeLimits(GetRangeLimits limits, bool reverse, GetKeyValuesReque } } -ACTOR Future> getExactRange(Database cx, - Version version, - KeyRange keys, - GetRangeLimits limits, - bool reverse, - TransactionInfo info, - TagSet tags) { - state Standalone output; +ACTOR Future getExactRange(Database cx, + Version version, + KeyRange keys, + GetRangeLimits limits, + bool reverse, + TransactionInfo info, + TagSet tags) { + state RangeResult output; state Span span("NAPI:getExactRange"_loc, info.spanID); // printf("getExactRange( '%s', '%s' )\n", keys.begin.toString().c_str(), keys.end.toString().c_str()); @@ -2892,14 +2889,14 @@ Future resolveKey(Database const& cx, return getKey(cx, key, version, info, tags); } -ACTOR Future> getRangeFallback(Database cx, - Version version, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse, - TransactionInfo info, - TagSet tags) { +ACTOR Future getRangeFallback(Database cx, + Version version, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse, + TransactionInfo info, + TagSet tags) { if (version == latestVersion) { state Transaction transaction(cx); transaction.setOption(FDBTransactionOptions::CAUSAL_READ_RISKY); @@ -2915,15 +2912,15 @@ ACTOR Future> getRangeFallback(Database cx, state Key b = wait(fb); state Key e = wait(fe); if (b >= e) { - return Standalone(); + return RangeResult(); } // if e is allKeys.end, we have read through the end of the database // if b is allKeys.begin, we have either read through the beginning of the database, // or allKeys.begin exists in the database and will be part of the conflict range anyways - Standalone _r = wait(getExactRange(cx, version, KeyRangeRef(b, e), limits, reverse, info, tags)); - Standalone r = _r; + RangeResult _r = wait(getExactRange(cx, version, KeyRangeRef(b, e), limits, reverse, info, tags)); + RangeResult r = _r; if (b == allKeys.begin && ((reverse && !r.more) || !reverse)) r.readToBegin = true; @@ -2955,7 +2952,7 @@ void getRangeFinished(Database cx, bool snapshot, Promise> conflictRange, bool reverse, - Standalone result) { + RangeResult result) { int64_t bytes = 0; for (const KeyValueRef& kv : result) { bytes += kv.key.size() + kv.value.size(); @@ -3001,21 +2998,21 @@ void getRangeFinished(Database cx, } } -ACTOR Future> getRange(Database cx, - Reference trLogInfo, - Future fVersion, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - Promise> conflictRange, - bool snapshot, - bool reverse, - TransactionInfo info, - TagSet tags) { +ACTOR Future getRange(Database cx, + Reference trLogInfo, + Future fVersion, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + Promise> conflictRange, + bool snapshot, + bool reverse, + TransactionInfo info, + TagSet tags) { state GetRangeLimits originalLimits(limits); state KeySelector originalBegin = begin; state KeySelector originalEnd = end; - state Standalone output; + state RangeResult output; state Span span("NAPI:getRange"_loc, info.spanID); try { @@ -3148,8 +3145,8 @@ ACTOR Future> getRange(Database cx, bool readToBegin = output.readToBegin; bool readThroughEnd = output.readThroughEnd; - output = Standalone( - RangeResultRef(rep.data, modifiedSelectors || limits.isReached() || rep.more), rep.arena); + output = RangeResult(RangeResultRef(rep.data, modifiedSelectors || limits.isReached() || rep.more), + rep.arena); output.readToBegin = readToBegin; output.readThroughEnd = readThroughEnd; @@ -3202,7 +3199,7 @@ ACTOR Future> getRange(Database cx, TEST(true); // !GetKeyValuesReply.more and modifiedSelectors in getRange if (!rep.data.size()) { - Standalone result = wait(getRangeFallback( + RangeResult result = wait(getRangeFallback( cx, version, originalBegin, originalEnd, originalLimits, reverse, info, tags)); getRangeFinished(cx, trLogInfo, @@ -3239,7 +3236,7 @@ ACTOR Future> getRange(Database cx, reverse ? (end - 1).isBackward() : begin.isBackward()); if (e.code() == error_code_wrong_shard_server) { - Standalone result = wait(getRangeFallback( + RangeResult result = wait(getRangeFallback( cx, version, originalBegin, originalEnd, originalLimits, reverse, info, tags)); getRangeFinished(cx, trLogInfo, @@ -3275,14 +3272,14 @@ ACTOR Future> getRange(Database cx, } } -Future> getRange(Database const& cx, - Future const& fVersion, - KeySelector const& begin, - KeySelector const& end, - GetRangeLimits const& limits, - bool const& reverse, - TransactionInfo const& info, - TagSet const& tags) { +Future getRange(Database const& cx, + Future const& fVersion, + KeySelector const& begin, + KeySelector const& end, + GetRangeLimits const& limits, + bool const& reverse, + TransactionInfo const& info, + TagSet const& tags) { return getRange(cx, Reference(), fVersion, @@ -3504,18 +3501,18 @@ ACTOR Future>> getAddressesForKeyActor(Key key // serverInterfaces vector being empty, which will cause us to return an empty addresses list. state Key ksKey = keyServersKey(key); - state Standalone serverTagResult = wait(getRange(cx, - ver, - lastLessOrEqual(serverTagKeys.begin), - firstGreaterThan(serverTagKeys.end), - GetRangeLimits(CLIENT_KNOBS->TOO_MANY), - false, - info, - options.readTags)); + state RangeResult serverTagResult = wait(getRange(cx, + ver, + lastLessOrEqual(serverTagKeys.begin), + firstGreaterThan(serverTagKeys.end), + GetRangeLimits(CLIENT_KNOBS->TOO_MANY), + false, + info, + options.readTags)); ASSERT(!serverTagResult.more && serverTagResult.size() < CLIENT_KNOBS->TOO_MANY); - Future> futureServerUids = getRange( + Future futureServerUids = getRange( cx, ver, lastLessOrEqual(ksKey), firstGreaterThan(ksKey), GetRangeLimits(1), false, info, options.readTags); - Standalone serverUids = wait(futureServerUids); + RangeResult serverUids = wait(futureServerUids); ASSERT(serverUids.size()); // every shard needs to have a team @@ -3580,16 +3577,16 @@ Future Transaction::getKey(const KeySelector& key, bool snapshot) { return getKeyAndConflictRange(cx, key, getReadVersion(), conflictRange, info, options.readTags); } -Future> Transaction::getRange(const KeySelector& begin, - const KeySelector& end, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +Future Transaction::getRange(const KeySelector& begin, + const KeySelector& end, + GetRangeLimits limits, + bool snapshot, + bool reverse) { ++cx->transactionLogicalReads; ++cx->transactionGetRangeRequests; if (limits.isReached()) - return Standalone(); + return RangeResult(); if (!limits.isValid()) return range_limits_invalid(); @@ -3610,7 +3607,7 @@ Future> Transaction::getRange(const KeySelector& begi if (b.offset >= e.offset && b.getKey() >= e.getKey()) { TEST(true); // Native range inverted - return Standalone(); + return RangeResult(); } Promise> conflictRange; @@ -3622,11 +3619,11 @@ Future> Transaction::getRange(const KeySelector& begi cx, trLogInfo, getReadVersion(), b, e, limits, conflictRange, snapshot, reverse, info, options.readTags); } -Future> Transaction::getRange(const KeySelector& begin, - const KeySelector& end, - int limit, - bool snapshot, - bool reverse) { +Future Transaction::getRange(const KeySelector& begin, + const KeySelector& end, + int limit, + bool snapshot, + bool reverse) { return getRange(begin, end, GetRangeLimits(limit), snapshot, reverse); } @@ -3982,7 +3979,7 @@ ACTOR void checkWrites(Database cx, if (m.mutated) { checkedRanges++; if (m.cleared) { - Standalone shouldBeEmpty = wait(tr.getRange(it->range(), 1)); + RangeResult shouldBeEmpty = wait(tr.getRange(it->range(), 1)); if (shouldBeEmpty.size()) { TraceEvent(SevError, "CheckWritesFailed") .detail("Class", "Clear") @@ -5641,7 +5638,7 @@ ACTOR static Future rebootWorkerActor(DatabaseContext* cx, ValueRef add state std::map> address_interface; if (!cx->getConnectionFile()) return 0; - Standalone kvs = wait(getWorkerInterfaces(cx->getConnectionFile())); + RangeResult kvs = wait(getWorkerInterfaces(cx->getConnectionFile())); ASSERT(!kvs.more); // Note: reuse this knob from fdbcli, change it if necessary Reference connectLock(new FlowLock(CLIENT_KNOBS->CLI_CONNECT_PARALLELISM)); diff --git a/fdbclient/NativeAPI.actor.h b/fdbclient/NativeAPI.actor.h index 9f9b0057ca..6ba14764de 100644 --- a/fdbclient/NativeAPI.actor.h +++ b/fdbclient/NativeAPI.actor.h @@ -252,30 +252,30 @@ public: [[nodiscard]] Future watch(Reference watch); [[nodiscard]] Future getKey(const KeySelector& key, bool snapshot = false); // Future< Optional > get( const KeySelectorRef& key ); - [[nodiscard]] Future> getRange(const KeySelector& begin, - const KeySelector& end, - int limit, - bool snapshot = false, - bool reverse = false); - [[nodiscard]] Future> getRange(const KeySelector& begin, - const KeySelector& end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false); - [[nodiscard]] Future> getRange(const KeyRange& keys, - int limit, - bool snapshot = false, - bool reverse = false) { + [[nodiscard]] Future getRange(const KeySelector& begin, + const KeySelector& end, + int limit, + bool snapshot = false, + bool reverse = false); + [[nodiscard]] Future getRange(const KeySelector& begin, + const KeySelector& end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false); + [[nodiscard]] Future getRange(const KeyRange& keys, + int limit, + bool snapshot = false, + bool reverse = false) { return getRange(KeySelector(firstGreaterOrEqual(keys.begin), keys.arena()), KeySelector(firstGreaterOrEqual(keys.end), keys.arena()), limit, snapshot, reverse); } - [[nodiscard]] Future> getRange(const KeyRange& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) { + [[nodiscard]] Future getRange(const KeyRange& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) { return getRange(KeySelector(firstGreaterOrEqual(keys.begin), keys.arena()), KeySelector(firstGreaterOrEqual(keys.end), keys.arena()), limits, diff --git a/fdbclient/RYWIterator.cpp b/fdbclient/RYWIterator.cpp index fd3eec35c7..7b6065088b 100644 --- a/fdbclient/RYWIterator.cpp +++ b/fdbclient/RYWIterator.cpp @@ -347,8 +347,9 @@ void testSnapshotCache() { } /* -ACTOR Standalone getRange( Transaction* tr, KeySelector begin, KeySelector end, SnapshotCache* cache, -WriteMap* writes, GetRangeLimits limits ) { RYWIterator it(cache, writes); RYWIterator itEnd(cache, writes); +ACTOR RangeResult getRange( Transaction* tr, KeySelector begin, KeySelector end, SnapshotCache* cache, +WriteMap* writes, GetRangeLimits limits ) { + RYWIterator it(cache, writes); RYWIterator itEnd(cache, writes); resolveKeySelectorFromCache( begin, it ); resolveKeySelectorFromCache( end, itEnd ); @@ -362,9 +363,8 @@ WriteMap* writes, GetRangeLimits limits ) { RYWIterator it(cache, writes); RYWIt ucEnd.skipUncached(itEnd); state KeySelector read_end = ucEnd==itEnd ? end : -firstGreaterOrEqual(ucEnd.endKey().toStandaloneStringRef()); Standalone snapshot_read = wait( -tr->getRange( begin, read_end, limits, false, false ) ); cache->insert( getKnownKeyRange( snapshot_read, begin, read_end -), snapshot_read ); +firstGreaterOrEqual(ucEnd.endKey().toStandaloneStringRef()); RangeResult snapshot_read = wait(tr->getRange( begin, +read_end, limits, false, false ) ); cache->insert( getKnownKeyRange( snapshot_read, begin, read_end), snapshot_read ); // TODO: Is there a more efficient way to deal with invalidation? it = itEnd = RYWIterator( cache, writes ); diff --git a/fdbclient/ReadYourWrites.actor.cpp b/fdbclient/ReadYourWrites.actor.cpp index a6e047b979..3012fddd29 100644 --- a/fdbclient/ReadYourWrites.actor.cpp +++ b/fdbclient/ReadYourWrites.actor.cpp @@ -71,7 +71,7 @@ public: : begin(begin), end(end), limits(limits) {} KeySelector begin, end; GetRangeLimits limits; - typedef Standalone Result; + using Result = RangeResult; }; // read() Performs a read (get, getKey, getRange, etc), in the context of the given transaction. Snapshot or RYW @@ -126,7 +126,7 @@ public: ACTOR template static Future read(ReadYourWritesTransaction* ryw, GetKeyReq read, Iter* it) { if (read.key.offset > 0) { - Standalone result = + RangeResult result = wait(getRangeValue(ryw, read.key, firstGreaterOrEqual(ryw->getMaxReadKey()), GetRangeLimits(1), it)); if (result.readToBegin) return allKeys.begin; @@ -135,7 +135,7 @@ public: return result[0].key; } else { read.key.offset++; - Standalone result = + RangeResult result = wait(getRangeValueBack(ryw, firstGreaterOrEqual(allKeys.begin), read.key, GetRangeLimits(1), it)); if (result.readThroughEnd) return ryw->getMaxReadKey(); @@ -146,12 +146,12 @@ public: }; template - static Future> read(ReadYourWritesTransaction* ryw, GetRangeReq read, Iter* it) { + static Future read(ReadYourWritesTransaction* ryw, GetRangeReq read, Iter* it) { return getRangeValue(ryw, read.begin, read.end, read.limits, it); }; template - static Future> read(ReadYourWritesTransaction* ryw, GetRangeReq read, Iter* it) { + static Future read(ReadYourWritesTransaction* ryw, GetRangeReq read, Iter* it) { return getRangeValueBack(ryw, read.begin, read.end, read.limits, it); }; @@ -171,9 +171,7 @@ public: } ACTOR template - static Future> readThrough(ReadYourWritesTransaction* ryw, - GetRangeReq read, - bool snapshot) { + static Future readThrough(ReadYourWritesTransaction* ryw, GetRangeReq read, bool snapshot) { if (Reverse && read.end.offset > 1) { // FIXME: Optimistically assume that this will not run into the system keys, and only reissue if the result // actually does. @@ -184,16 +182,15 @@ public: read.end = KeySelector(firstGreaterOrEqual(key), key.arena()); } - Standalone v = wait(ryw->tr.getRange(read.begin, read.end, read.limits, snapshot, Reverse)); + RangeResult v = wait(ryw->tr.getRange(read.begin, read.end, read.limits, snapshot, Reverse)); KeyRef maxKey = ryw->getMaxReadKey(); if (v.size() > 0) { if (!Reverse && v[v.size() - 1].key >= maxKey) { - state Standalone _v = v; + state RangeResult _v = v; int i = _v.size() - 2; for (; i >= 0 && _v[i].key >= maxKey; --i) { } - return Standalone(RangeResultRef(VectorRef(&_v[0], i + 1), false), - _v.arena()); + return RangeResult(RangeResultRef(VectorRef(&_v[0], i + 1), false), _v.arena()); } } @@ -230,7 +227,7 @@ public: static void addConflictRange(ReadYourWritesTransaction* ryw, GetRangeReq read, WriteMap::iterator& it, - Standalone const& result) { + RangeResult const& result) { KeyRef rangeBegin, rangeEnd; bool endInArena = false; @@ -265,7 +262,7 @@ public: static void addConflictRange(ReadYourWritesTransaction* ryw, GetRangeReq read, WriteMap::iterator& it, - Standalone const& result) { + RangeResult const& result) { KeyRef rangeBegin, rangeEnd; bool endInArena = false; @@ -527,14 +524,14 @@ public: // TODO: read to begin, read through end flags for result ACTOR template - static Future> getRangeValue(ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - Iter* pit) { + static Future getRangeValue(ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + Iter* pit) { state Iter& it(*pit); state Iter itEnd(*pit); - state Standalone result; + state RangeResult result; state int64_t additionalRows = 0; state int itemsPastEnd = 0; state int requestCount = 0; @@ -690,8 +687,7 @@ public: //TraceEvent("RYWIssuing", randomID).detail("Begin", read_begin.toString()).detail("End", read_end.toString()).detail("Bytes", requestLimit.bytes).detail("Rows", requestLimit.rows).detail("Limits", limits.bytes).detail("Reached", limits.isReached()).detail("RequestCount", requestCount).detail("SingleClears", singleClears).detail("UcEnd", ucEnd.beginKey()).detail("MinRows", requestLimit.minRows); additionalRows = 0; - Standalone snapshot_read = - wait(ryw->tr.getRange(read_begin, read_end, requestLimit, true, false)); + RangeResult snapshot_read = wait(ryw->tr.getRange(read_begin, read_end, requestLimit, true, false)); KeyRangeRef range = getKnownKeyRange(snapshot_read, read_begin, read_end, ryw->arena); //TraceEvent("RYWCacheInsert", randomID).detail("Range", range).detail("ExpectedSize", snapshot_read.expectedSize()).detail("Rows", snapshot_read.size()).detail("Results", snapshot_read).detail("More", snapshot_read.more).detail("ReadToBegin", snapshot_read.readToBegin).detail("ReadThroughEnd", snapshot_read.readThroughEnd).detail("ReadThrough", snapshot_read.readThrough); @@ -829,14 +825,14 @@ public: } ACTOR template - static Future> getRangeValueBack(ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - Iter* pit) { + static Future getRangeValueBack(ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + Iter* pit) { state Iter& it(*pit); state Iter itEnd(*pit); - state Standalone result; + state RangeResult result; state int64_t additionalRows = 0; state int itemsPastBegin = 0; state int requestCount = 0; @@ -994,8 +990,7 @@ public: //TraceEvent("RYWIssuing", randomID).detail("Begin", read_begin.toString()).detail("End", read_end.toString()).detail("Bytes", requestLimit.bytes).detail("Rows", requestLimit.rows).detail("Limits", limits.bytes).detail("Reached", limits.isReached()).detail("RequestCount", requestCount).detail("SingleClears", singleClears).detail("UcEnd", ucEnd.beginKey()).detail("MinRows", requestLimit.minRows); additionalRows = 0; - Standalone snapshot_read = - wait(ryw->tr.getRange(read_begin, read_end, requestLimit, true, true)); + RangeResult snapshot_read = wait(ryw->tr.getRange(read_begin, read_end, requestLimit, true, true)); KeyRangeRef range = getKnownKeyRangeBack(snapshot_read, read_begin, read_end, ryw->arena); //TraceEvent("RYWCacheInsert", randomID).detail("Range", range).detail("ExpectedSize", snapshot_read.expectedSize()).detail("Rows", snapshot_read.size()).detail("Results", snapshot_read).detail("More", snapshot_read.more).detail("ReadToBegin", snapshot_read.readToBegin).detail("ReadThroughEnd", snapshot_read.readThroughEnd).detail("ReadThrough", snapshot_read.readThrough); @@ -1329,7 +1324,7 @@ ACTOR Future> getJSON(Database db) { return getValueFromJSON(statusObj); } -ACTOR Future> getWorkerInterfaces(Reference clusterFile) { +ACTOR Future getWorkerInterfaces(Reference clusterFile) { state Reference>> clusterInterface(new AsyncVar>); state Future leaderMon = monitorLeader(clusterFile, clusterInterface); @@ -1340,7 +1335,7 @@ ACTOR Future> getWorkerInterfaces(Referenceget().get().getClientWorkers.getReply(GetClientWorkersRequest())) : Never())) { - Standalone result; + RangeResult result; for (auto& it : workers) { result.push_back_deep( result.arena(), @@ -1434,11 +1429,11 @@ Future ReadYourWritesTransaction::getKey(const KeySelector& key, bool snaps return result; } -Future> ReadYourWritesTransaction::getRange(KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +Future ReadYourWritesTransaction::getRange(KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool snapshot, + bool reverse) { if (getDatabase()->apiVersionAtLeast(630)) { if (specialKeys.contains(begin.getKey()) && specialKeys.begin <= end.getKey() && end.getKey() <= specialKeys.end) { @@ -1450,7 +1445,7 @@ Future> ReadYourWritesTransaction::getRange(KeySelect if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionFile()) { return getWorkerInterfaces(tr.getDatabase()->getConnectionFile()); } else { - return Standalone(); + return RangeResult(); } } } @@ -1469,7 +1464,7 @@ Future> ReadYourWritesTransaction::getRange(KeySelect // This optimization prevents nullptr operations from being added to the conflict range if (limits.isReached()) { TEST(true); // RYW range read limit 0 - return Standalone(); + return RangeResult(); } if (!limits.isValid()) @@ -1483,10 +1478,10 @@ Future> ReadYourWritesTransaction::getRange(KeySelect if (begin.offset >= end.offset && begin.getKey() >= end.getKey()) { TEST(true); // RYW range inverted - return Standalone(); + return RangeResult(); } - Future> result = + Future result = reverse ? RYWImpl::readWithConflictRange(this, RYWImpl::GetRangeReq(begin, end, limits), snapshot) : RYWImpl::readWithConflictRange(this, RYWImpl::GetRangeReq(begin, end, limits), snapshot); @@ -1494,11 +1489,11 @@ Future> ReadYourWritesTransaction::getRange(KeySelect return result; } -Future> ReadYourWritesTransaction::getRange(const KeySelector& begin, - const KeySelector& end, - int limit, - bool snapshot, - bool reverse) { +Future ReadYourWritesTransaction::getRange(const KeySelector& begin, + const KeySelector& end, + int limit, + bool snapshot, + bool reverse) { return getRange(begin, end, GetRangeLimits(limit), snapshot, reverse); } @@ -1739,11 +1734,11 @@ void ReadYourWritesTransaction::setToken(uint64_t token) { tr.setToken(token); } -Standalone ReadYourWritesTransaction::getReadConflictRangeIntersecting(KeyRangeRef kr) { +RangeResult ReadYourWritesTransaction::getReadConflictRangeIntersecting(KeyRangeRef kr) { TEST(true); // Special keys read conflict range ASSERT(readConflictRangeKeysRange.contains(kr)); ASSERT(!tr.options.checkWritesEnabled); - Standalone result; + RangeResult result; if (!options.readYourWritesDisabled) { kr = kr.removePrefix(readConflictRangeKeysRange.begin); auto iter = readConflicts.rangeContainingKeyBefore(kr.begin); @@ -1781,10 +1776,10 @@ Standalone ReadYourWritesTransaction::getReadConflictRangeInters return result; } -Standalone ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRangeRef kr) { +RangeResult ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRangeRef kr) { TEST(true); // Special keys write conflict range ASSERT(writeConflictRangeKeysRange.contains(kr)); - Standalone result; + RangeResult result; // Memory owned by result CoalescedKeyRefRangeMap writeConflicts{ LiteralStringRef("0"), specialKeys.end }; diff --git a/fdbclient/ReadYourWrites.h b/fdbclient/ReadYourWrites.h index f8e8e390bd..337e60408d 100644 --- a/fdbclient/ReadYourWrites.h +++ b/fdbclient/ReadYourWrites.h @@ -78,30 +78,27 @@ public: Optional getCachedReadVersion() { return tr.getCachedReadVersion(); } Future> get(const Key& key, bool snapshot = false); Future getKey(const KeySelector& key, bool snapshot = false); - Future> getRange(const KeySelector& begin, - const KeySelector& end, - int limit, - bool snapshot = false, - bool reverse = false); - Future> getRange(KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false); - Future> getRange(const KeyRange& keys, - int limit, - bool snapshot = false, - bool reverse = false) { + Future getRange(const KeySelector& begin, + const KeySelector& end, + int limit, + bool snapshot = false, + bool reverse = false); + Future getRange(KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false); + Future getRange(const KeyRange& keys, int limit, bool snapshot = false, bool reverse = false) { return getRange(KeySelector(firstGreaterOrEqual(keys.begin), keys.arena()), KeySelector(firstGreaterOrEqual(keys.end), keys.arena()), limit, snapshot, reverse); } - Future> getRange(const KeyRange& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) { + Future getRange(const KeyRange& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) { return getRange(KeySelector(firstGreaterOrEqual(keys.begin), keys.arena()), KeySelector(firstGreaterOrEqual(keys.end), keys.arena()), limits, @@ -169,9 +166,9 @@ public: void setToken(uint64_t token); // Read from the special key space readConflictRangeKeysRange - Standalone getReadConflictRangeIntersecting(KeyRangeRef kr); + RangeResult getReadConflictRangeIntersecting(KeyRangeRef kr); // Read from the special key space writeConflictRangeKeysRange - Standalone getWriteConflictRangeIntersecting(KeyRangeRef kr); + RangeResult getWriteConflictRangeIntersecting(KeyRangeRef kr); bool specialKeySpaceRelaxed() const { return options.specialKeySpaceRelaxed; } bool specialKeySpaceChangeConfiguration() const { return options.specialKeySpaceChangeConfiguration; } diff --git a/fdbclient/SpecialKeySpace.actor.cpp b/fdbclient/SpecialKeySpace.actor.cpp index c866354759..9eb8e3aacb 100644 --- a/fdbclient/SpecialKeySpace.actor.cpp +++ b/fdbclient/SpecialKeySpace.actor.cpp @@ -124,9 +124,7 @@ std::set SpecialKeySpace::options = { "excluded/force", "failed/for std::set SpecialKeySpace::tracingOptions = { kTracingTransactionIdKey, kTracingTokenKey }; -Standalone rywGetRange(ReadYourWritesTransaction* ryw, - const KeyRangeRef& kr, - const Standalone& res); +RangeResult rywGetRange(ReadYourWritesTransaction* ryw, const KeyRangeRef& kr, const RangeResult& res); // This function will move the given KeySelector as far as possible to the standard form: // orEqual == false && offset == 1 (Standard form) @@ -137,13 +135,13 @@ Standalone rywGetRange(ReadYourWritesTransaction* ryw, ACTOR Future moveKeySelectorOverRangeActor(const SpecialKeyRangeReadImpl* skrImpl, ReadYourWritesTransaction* ryw, KeySelector* ks, - Optional>* cache) { + Optional* cache) { ASSERT(!ks->orEqual); // should be removed before calling ASSERT(ks->offset != 1); // never being called if KeySelector is already normalized state Key startKey(skrImpl->getKeyRange().begin); state Key endKey(skrImpl->getKeyRange().end); - state Standalone result; + state RangeResult result; if (ks->offset < 1) { // less than the given key @@ -164,10 +162,10 @@ ACTOR Future moveKeySelectorOverRangeActor(const SpecialKeyRangeReadImpl* if (skrImpl->isAsync()) { const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast(skrImpl); - Standalone result_ = wait(ptr->getRange(ryw, KeyRangeRef(startKey, endKey), cache)); + RangeResult result_ = wait(ptr->getRange(ryw, KeyRangeRef(startKey, endKey), cache)); result = result_; } else { - Standalone result_ = wait(skrImpl->getRange(ryw, KeyRangeRef(startKey, endKey))); + RangeResult result_ = wait(skrImpl->getRange(ryw, KeyRangeRef(startKey, endKey))); result = result_; } @@ -216,8 +214,8 @@ ACTOR Future normalizeKeySelectorActor(SpecialKeySpace* sks, KeySelector* ks, KeyRangeRef boundary, int* actualOffset, - Standalone* result, - Optional>* cache) { + RangeResult* result, + Optional* cache) { // If offset < 1, where we need to move left, iter points to the range containing at least one smaller key // (It's a wasting of time to walk through the range whose begin key is same as ks->key) // (rangeContainingKeyBefore itself handles the case where ks->key == Key()) @@ -287,15 +285,15 @@ void SpecialKeySpace::modulesBoundaryInit() { } } -ACTOR Future> SpecialKeySpace::checkRYWValid(SpecialKeySpace* sks, - ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse) { +ACTOR Future SpecialKeySpace::checkRYWValid(SpecialKeySpace* sks, + ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse) { ASSERT(ryw); choose { - when(Standalone result = + when(RangeResult result = wait(SpecialKeySpace::getRangeAggregationActor(sks, ryw, begin, end, limits, reverse))) { return result; } @@ -303,22 +301,22 @@ ACTOR Future> SpecialKeySpace::checkRYWValid(SpecialK } } -ACTOR Future> SpecialKeySpace::getRangeAggregationActor(SpecialKeySpace* sks, - ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse) { +ACTOR Future SpecialKeySpace::getRangeAggregationActor(SpecialKeySpace* sks, + ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse) { // This function handles ranges which cover more than one keyrange and aggregates all results // KeySelector, GetRangeLimits and reverse are all handled here - state Standalone result; - state Standalone pairs; + state RangeResult result; + state RangeResult pairs; state RangeMap::iterator iter; state int actualBeginOffset; state int actualEndOffset; state KeyRangeRef moduleBoundary; // used to cache result from potential first read - state Optional> cache; + state Optional cache; if (ryw->specialKeySpaceRelaxed()) { moduleBoundary = sks->range; @@ -367,10 +365,10 @@ ACTOR Future> SpecialKeySpace::getRangeAggregationAct KeyRef keyEnd = kr.contains(end.getKey()) ? end.getKey() : kr.end; if (iter->value()->isAsync() && cache.present()) { const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast(iter->value()); - Standalone pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache)); + RangeResult pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache)); pairs = pairs_; } else { - Standalone pairs_ = wait(iter->value()->getRange(ryw, KeyRangeRef(keyStart, keyEnd))); + RangeResult pairs_ = wait(iter->value()->getRange(ryw, KeyRangeRef(keyStart, keyEnd))); pairs = pairs_; } result.arena().dependsOn(pairs.arena()); @@ -398,10 +396,10 @@ ACTOR Future> SpecialKeySpace::getRangeAggregationAct KeyRef keyEnd = kr.contains(end.getKey()) ? end.getKey() : kr.end; if (iter->value()->isAsync() && cache.present()) { const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast(iter->value()); - Standalone pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache)); + RangeResult pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache)); pairs = pairs_; } else { - Standalone pairs_ = wait(iter->value()->getRange(ryw, KeyRangeRef(keyStart, keyEnd))); + RangeResult pairs_ = wait(iter->value()->getRange(ryw, KeyRangeRef(keyStart, keyEnd))); pairs = pairs_; } result.arena().dependsOn(pairs.arena()); @@ -424,17 +422,17 @@ ACTOR Future> SpecialKeySpace::getRangeAggregationAct return result; } -Future> SpecialKeySpace::getRange(ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse) { +Future SpecialKeySpace::getRange(ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse) { // validate limits here if (!limits.isValid()) return range_limits_invalid(); if (limits.isReached()) { TEST(true); // read limit 0 - return Standalone(); + return RangeResult(); } // make sure orEqual == false begin.removeOrEqual(begin.arena()); @@ -442,7 +440,7 @@ Future> SpecialKeySpace::getRange(ReadYourWritesTrans if (begin.offset >= end.offset && begin.getKey() >= end.getKey()) { TEST(true); // range inverted - return Standalone(); + return RangeResult(); } return checkRYWValid(this, ryw, begin, end, limits, reverse); @@ -452,11 +450,11 @@ ACTOR Future> SpecialKeySpace::getActor(SpecialKeySpace* sks, ReadYourWritesTransaction* ryw, KeyRef key) { // use getRange to workaround this - Standalone result = wait(sks->getRange(ryw, - KeySelector(firstGreaterOrEqual(key)), - KeySelector(firstGreaterOrEqual(keyAfter(key))), - GetRangeLimits(CLIENT_KNOBS->TOO_MANY), - false)); + RangeResult result = wait(sks->getRange(ryw, + KeySelector(firstGreaterOrEqual(key)), + KeySelector(firstGreaterOrEqual(keyAfter(key))), + GetRangeLimits(CLIENT_KNOBS->TOO_MANY), + false)); ASSERT(result.size() <= 1); if (result.size()) { return Optional(result[0].value); @@ -603,7 +601,7 @@ Future SpecialKeySpace::commit(ReadYourWritesTransaction* ryw) { SKSCTestImpl::SKSCTestImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> SKSCTestImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future SKSCTestImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { ASSERT(range.contains(kr)); auto resultFuture = ryw->getRange(kr, CLIENT_KNOBS->TOO_MANY); // all keys are written to RYW, since GRV is set, the read should happen locally @@ -621,27 +619,25 @@ Future> SKSCTestImpl::commit(ReadYourWritesTransaction* ry ReadConflictRangeImpl::ReadConflictRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} -ACTOR static Future> getReadConflictRangeImpl(ReadYourWritesTransaction* ryw, KeyRange kr) { +ACTOR static Future getReadConflictRangeImpl(ReadYourWritesTransaction* ryw, KeyRange kr) { wait(ryw->pendingReads()); return ryw->getReadConflictRangeIntersecting(kr); } -Future> ReadConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ReadConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return getReadConflictRangeImpl(ryw, kr); } WriteConflictRangeImpl::WriteConflictRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} -Future> WriteConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future WriteConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return ryw->getWriteConflictRangeIntersecting(kr); } ConflictingKeysImpl::ConflictingKeysImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} -Future> ConflictingKeysImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { - Standalone result; +Future ConflictingKeysImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult result; if (ryw->getTransactionInfo().conflictingKeys) { auto krMapPtr = ryw->getTransactionInfo().conflictingKeys.get(); auto beginIter = krMapPtr->rangeContaining(kr.begin); @@ -657,13 +653,13 @@ Future> ConflictingKeysImpl::getRange(ReadYourWritesT return result; } -ACTOR Future> ddMetricsGetRangeActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { +ACTOR Future ddMetricsGetRangeActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { loop { try { auto keys = kr.removePrefix(ddStatsRange.begin); Standalone> resultWithoutPrefix = wait( waitDataDistributionMetricsList(ryw->getDatabase(), keys, CLIENT_KNOBS->STORAGE_METRICS_SHARD_LIMIT)); - Standalone result; + RangeResult result; for (const auto& ddMetricsRef : resultWithoutPrefix) { // each begin key is the previous end key, thus we only encode the begin key in the result KeyRef beginKey = ddMetricsRef.beginKey.withPrefix(ddStatsRange.begin, result.arena()); @@ -691,7 +687,7 @@ ACTOR Future> ddMetricsGetRangeActor(ReadYourWritesTr DDStatsRangeImpl::DDStatsRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {} -Future> DDStatsRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future DDStatsRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return ddMetricsGetRangeActor(ryw, kr); } @@ -704,9 +700,8 @@ Key SpecialKeySpace::getManagementApiCommandOptionSpecialKey(const std::string& ManagementCommandsOptionsImpl::ManagementCommandsOptionsImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> ManagementCommandsOptionsImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { - Standalone result; +Future ManagementCommandsOptionsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult result; // Since we only have limit number of options, a brute force loop here is enough for (const auto& option : SpecialKeySpace::getManagementApiOptionsSet()) { auto key = getKeyRange().begin.withSuffix(option); @@ -748,14 +743,12 @@ Future> ManagementCommandsOptionsImpl::commit(ReadYourWrit return Optional(); } -Standalone rywGetRange(ReadYourWritesTransaction* ryw, - const KeyRangeRef& kr, - const Standalone& res) { +RangeResult rywGetRange(ReadYourWritesTransaction* ryw, const KeyRangeRef& kr, const RangeResult& res) { // "res" is the read result regardless of your writes, if ryw disabled, return immediately if (ryw->readYourWritesDisabled()) return res; // If ryw enabled, we update it with writes from the transaction - Standalone result; + RangeResult result; RangeMap>, KeyRangeRef>::Ranges ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(kr); RangeMap>, KeyRangeRef>::iterator iter = ranges.begin(); @@ -800,13 +793,13 @@ Standalone rywGetRange(ReadYourWritesTransaction* ryw, } // read from those readwrite modules in which special keys have one-to-one mapping with real persisted keys -ACTOR Future> rwModuleWithMappingGetRangeActor(ReadYourWritesTransaction* ryw, - const SpecialKeyRangeRWImpl* impl, - KeyRangeRef kr) { - Standalone resultWithoutPrefix = +ACTOR Future rwModuleWithMappingGetRangeActor(ReadYourWritesTransaction* ryw, + const SpecialKeyRangeRWImpl* impl, + KeyRangeRef kr) { + RangeResult resultWithoutPrefix = wait(ryw->getTransaction().getRange(ryw->getDatabase()->specialKeySpace->decode(kr), CLIENT_KNOBS->TOO_MANY)); ASSERT(!resultWithoutPrefix.more && resultWithoutPrefix.size() < CLIENT_KNOBS->TOO_MANY); - Standalone result; + RangeResult result; for (const KeyValueRef& kv : resultWithoutPrefix) result.push_back_deep(result.arena(), KeyValueRef(impl->encode(kv.key), kv.value)); return rywGetRange(ryw, kr, result); @@ -814,8 +807,7 @@ ACTOR Future> rwModuleWithMappingGetRangeActor(ReadYo ExcludeServersRangeImpl::ExcludeServersRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> ExcludeServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ExcludeServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return rwModuleWithMappingGetRangeActor(ryw, this, kr); } @@ -1054,8 +1046,7 @@ Future> ExcludeServersRangeImpl::commit(ReadYourWritesTran FailedServersRangeImpl::FailedServersRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> FailedServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future FailedServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return rwModuleWithMappingGetRangeActor(ryw, this, kr); } @@ -1078,10 +1069,8 @@ Future> FailedServersRangeImpl::commit(ReadYourWritesTrans return excludeCommitActor(ryw, true); } -ACTOR Future> ExclusionInProgressActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { - state Standalone result; +ACTOR Future ExclusionInProgressActor(ReadYourWritesTransaction* ryw, KeyRef prefix, KeyRangeRef kr) { + state RangeResult result; state Transaction& tr = ryw->getTransaction(); tr.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); // necessary? @@ -1092,7 +1081,7 @@ ACTOR Future> ExclusionInProgressActor(ReadYourWrites state std::set inProgressExclusion; // Just getting a consistent read version proves that a set of tlogs satisfying the exclusions has completed // recovery Check that there aren't any storage servers with addresses violating the exclusions - state Standalone serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); for (auto& s : serverList) { @@ -1137,21 +1126,18 @@ ACTOR Future> ExclusionInProgressActor(ReadYourWrites ExclusionInProgressRangeImpl::ExclusionInProgressRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {} -Future> ExclusionInProgressRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ExclusionInProgressRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return ExclusionInProgressActor(ryw, getKeyRange().begin, kr); } -ACTOR Future> getProcessClassActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { +ACTOR Future getProcessClassActor(ReadYourWritesTransaction* ryw, KeyRef prefix, KeyRangeRef kr) { vector _workers = wait(getWorkers(&ryw->getTransaction())); auto workers = _workers; // strip const // Note : the sort by string is anti intuition, ex. 1.1.1.1:11 < 1.1.1.1:5 std::sort(workers.begin(), workers.end(), [](const ProcessData& lhs, const ProcessData& rhs) { return formatIpPort(lhs.address.ip, lhs.address.port) < formatIpPort(rhs.address.ip, rhs.address.port); }); - Standalone result; + RangeResult result; for (auto& w : workers) { // exclude :tls in keys even the network addresss is TLS KeyRef k(prefix.withSuffix(formatIpPort(w.address.ip, w.address.port), result.arena())); @@ -1205,8 +1191,7 @@ ACTOR Future> processClassCommitActor(ReadYourWritesTransa ProcessClassRangeImpl::ProcessClassRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> ProcessClassRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ProcessClassRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return getProcessClassActor(ryw, getKeyRange().begin, kr); } @@ -1259,16 +1244,14 @@ void ProcessClassRangeImpl::clear(ReadYourWritesTransaction* ryw, const KeyRef& ryw, "setclass", "Clear range operation is meaningless thus forbidden for setclass"); } -ACTOR Future> getProcessClassSourceActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { +ACTOR Future getProcessClassSourceActor(ReadYourWritesTransaction* ryw, KeyRef prefix, KeyRangeRef kr) { vector _workers = wait(getWorkers(&ryw->getTransaction())); auto workers = _workers; // strip const // Note : the sort by string is anti intuition, ex. 1.1.1.1:11 < 1.1.1.1:5 std::sort(workers.begin(), workers.end(), [](const ProcessData& lhs, const ProcessData& rhs) { return formatIpPort(lhs.address.ip, lhs.address.port) < formatIpPort(rhs.address.ip, rhs.address.port); }); - Standalone result; + RangeResult result; for (auto& w : workers) { // exclude :tls in keys even the network addresss is TLS Key k(prefix.withSuffix(formatIpPort(w.address.ip, w.address.port))); @@ -1284,15 +1267,14 @@ ACTOR Future> getProcessClassSourceActor(ReadYourWrit ProcessClassSourceRangeImpl::ProcessClassSourceRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} -Future> ProcessClassSourceRangeImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ProcessClassSourceRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return getProcessClassSourceActor(ryw, getKeyRange().begin, kr); } -ACTOR Future> getLockedKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { +ACTOR Future getLockedKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE); Optional val = wait(ryw->getTransaction().get(databaseLockedKey)); - Standalone result; + RangeResult result; if (val.present()) { result.push_back_deep(result.arena(), KeyValueRef(kr.begin, val.get())); } @@ -1301,13 +1283,13 @@ ACTOR Future> getLockedKeyActor(ReadYourWritesTransac LockDatabaseImpl::LockDatabaseImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> LockDatabaseImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future LockDatabaseImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { // single key range, the queried range should always be the same as the underlying range ASSERT(kr == getKeyRange()); auto lockEntry = ryw->getSpecialKeySpaceWriteMap()[SpecialKeySpace::getManagementApiCommandPrefix("lock")]; if (!ryw->readYourWritesDisabled() && lockEntry.first) { // ryw enabled and we have written to the special key - Standalone result; + RangeResult result; if (lockEntry.second.present()) { result.push_back_deep(result.arena(), KeyValueRef(kr.begin, lockEntry.second.get())); } @@ -1358,12 +1340,12 @@ Future> LockDatabaseImpl::commit(ReadYourWritesTransaction } } -ACTOR Future> getConsistencyCheckKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { +ACTOR Future getConsistencyCheckKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE); ryw->getTransaction().setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); Optional val = wait(ryw->getTransaction().get(fdbShouldConsistencyCheckBeSuspended)); bool ccSuspendSetting = val.present() ? BinaryReader::fromStringRef(val.get(), Unversioned()) : false; - Standalone result; + RangeResult result; if (ccSuspendSetting) { result.push_back_deep(result.arena(), KeyValueRef(kr.begin, ValueRef())); } @@ -1372,14 +1354,13 @@ ACTOR Future> getConsistencyCheckKeyActor(ReadYourWri ConsistencyCheckImpl::ConsistencyCheckImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> ConsistencyCheckImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future ConsistencyCheckImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { // single key range, the queried range should always be the same as the underlying range ASSERT(kr == getKeyRange()); auto entry = ryw->getSpecialKeySpaceWriteMap()[SpecialKeySpace::getManagementApiCommandPrefix("consistencycheck")]; if (!ryw->readYourWritesDisabled() && entry.first) { // ryw enabled and we have written to the special key - Standalone result; + RangeResult result; if (entry.second.present()) { result.push_back_deep(result.arena(), KeyValueRef(kr.begin, entry.second.get())); } @@ -1405,8 +1386,8 @@ GlobalConfigImpl::GlobalConfigImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) { // framework within the range specified. The special-key-space getrange // function should only be used for informational purposes. All values are // returned as strings regardless of their true type. -Future> GlobalConfigImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { - Standalone result; +Future GlobalConfigImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult result; auto& globalConfig = GlobalConfig::globalConfig(); KeyRangeRef modified = @@ -1453,7 +1434,7 @@ ACTOR Future> globalConfigCommitActor(GlobalConfigImpl* gl // History should only contain three most recent updates. If it currently // has three items, remove the oldest to make room for a new item. - Standalone history = wait(tr.getRange(globalConfigHistoryKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult history = wait(tr.getRange(globalConfigHistoryKeys, CLIENT_KNOBS->TOO_MANY)); constexpr int kGlobalConfigMaxHistorySize = 3; if (history.size() > kGlobalConfigMaxHistorySize - 1) { for (int i = 0; i < history.size() - (kGlobalConfigMaxHistorySize - 1); ++i) { @@ -1525,8 +1506,8 @@ void GlobalConfigImpl::clear(ReadYourWritesTransaction* ryw, const KeyRef& key) TracingOptionsImpl::TracingOptionsImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> TracingOptionsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { - Standalone result; +Future TracingOptionsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult result; for (const auto& option : SpecialKeySpace::getTracingOptions()) { auto key = getKeyRange().begin.withSuffix(option); if (!kr.contains(key)) { @@ -1584,8 +1565,8 @@ void TracingOptionsImpl::clear(ReadYourWritesTransaction* ryw, const KeyRef& key CoordinatorsImpl::CoordinatorsImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> CoordinatorsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { - Standalone result; +Future CoordinatorsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult result; KeyRef prefix(getKeyRange().begin); // the constructor of ClusterConnectionFile already checks whether the file is valid auto cs = ClusterConnectionFile(ryw->getDatabase()->getConnectionFile()->getFilename()).getConnectionString(); @@ -1730,9 +1711,8 @@ void CoordinatorsImpl::clear(ReadYourWritesTransaction* ryw, const KeyRef& key) CoordinatorsAutoImpl::CoordinatorsAutoImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} -ACTOR static Future> CoordinatorsAutoImplActor(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) { - state Standalone res; +ACTOR static Future CoordinatorsAutoImplActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { + state RangeResult res; state std::string autoCoordinatorsKey; state Transaction& tr = ryw->getTransaction(); @@ -1768,18 +1748,16 @@ ACTOR static Future> CoordinatorsAutoImplActor(ReadYo return res; } -Future> CoordinatorsAutoImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future CoordinatorsAutoImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { // single key range, the queried range should always be the same as the underlying range ASSERT(kr == getKeyRange()); return CoordinatorsAutoImplActor(ryw, kr); } -ACTOR static Future> getMinCommitVersionActor(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) { +ACTOR static Future getMinCommitVersionActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) { ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE); Optional val = wait(ryw->getTransaction().get(minRequiredCommitVersionKey)); - Standalone result; + RangeResult result; if (val.present()) { Version minRequiredCommitVersion = BinaryReader::fromStringRef(val.get(), Unversioned()); ValueRef version(result.arena(), boost::lexical_cast(minRequiredCommitVersion)); @@ -1790,13 +1768,13 @@ ACTOR static Future> getMinCommitVersionActor(ReadYou AdvanceVersionImpl::AdvanceVersionImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -Future> AdvanceVersionImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future AdvanceVersionImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { // single key range, the queried range should always be the same as the underlying range ASSERT(kr == getKeyRange()); auto entry = ryw->getSpecialKeySpaceWriteMap()[SpecialKeySpace::getManagementApiCommandPrefix("advanceversion")]; if (!ryw->readYourWritesDisabled() && entry.first) { // ryw enabled and we have written to the special key - Standalone result; + RangeResult result; if (entry.second.present()) { result.push_back_deep(result.arena(), KeyValueRef(kr.begin, entry.second.get())); } @@ -1845,10 +1823,10 @@ Future> AdvanceVersionImpl::commit(ReadYourWritesTransacti ClientProfilingImpl::ClientProfilingImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} -ACTOR static Future> ClientProfilingGetRangeActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { - state Standalone result; +ACTOR static Future ClientProfilingGetRangeActor(ReadYourWritesTransaction* ryw, + KeyRef prefix, + KeyRangeRef kr) { + state RangeResult result; // client_txn_sample_rate state Key sampleRateKey = LiteralStringRef("client_txn_sample_rate").withPrefix(prefix); if (kr.contains(sampleRateKey)) { @@ -1891,7 +1869,7 @@ ACTOR static Future> ClientProfilingGetRangeActor(Rea } // TODO : add limitation on set operation -Future> ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return ClientProfilingGetRangeActor(ryw, getKeyRange().begin, kr); } @@ -2032,10 +2010,10 @@ void parse(std::vector::iterator it, std::vector::iterator } } -ACTOR static Future> actorLineageGetRangeActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { - state Standalone result; +ACTOR static Future actorLineageGetRangeActor(ReadYourWritesTransaction* ryw, + KeyRef prefix, + KeyRangeRef kr) { + state RangeResult result; // Set default values for all fields. The default will be used if the field // is missing in the key. @@ -2146,7 +2124,7 @@ ACTOR static Future> actorLineageGetRangeActor(ReadYo return result; } -Future> ActorLineageImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future ActorLineageImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return actorLineageGetRangeActor(ryw, getKeyRange().begin, kr); } @@ -2159,8 +2137,8 @@ std::string_view to_string_view(StringRef sr) { ActorProfilerConf::ActorProfilerConf(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr), config(ProfilerConfig::instance().getConfig()) {} -Future> ActorProfilerConf::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { - Standalone res; +Future ActorProfilerConf::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { + RangeResult res; std::string_view begin(to_string_view(kr.begin.removePrefix(range.begin))), end(to_string_view(kr.end.removePrefix(range.begin))); for (auto& p : config) { @@ -2221,10 +2199,10 @@ MaintenanceImpl::MaintenanceImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} // we will calculate the remaining time(truncated to integer, the same as fdbcli) and return back as the value // If the zoneId is the special one `ignoreSSFailuresZoneString`, // value will be 0 (same as fdbcli) -ACTOR static Future> MaintenanceGetRangeActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { - state Standalone result; +ACTOR static Future MaintenanceGetRangeActor(ReadYourWritesTransaction* ryw, + KeyRef prefix, + KeyRangeRef kr) { + state RangeResult result; // zoneId ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE); Optional val = wait(ryw->getTransaction().get(healthyZoneKey)); @@ -2246,7 +2224,7 @@ ACTOR static Future> MaintenanceGetRangeActor(ReadYou return rywGetRange(ryw, kr, result); } -Future> MaintenanceImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { +Future MaintenanceImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return MaintenanceGetRangeActor(ryw, getKeyRange().begin, kr); } @@ -2315,10 +2293,10 @@ Future> MaintenanceImpl::commit(ReadYourWritesTransaction* DataDistributionImpl::DataDistributionImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {} // Read the system keys dataDistributionModeKey and rebalanceDDIgnoreKey -ACTOR static Future> DataDistributionGetRangeActor(ReadYourWritesTransaction* ryw, - KeyRef prefix, - KeyRangeRef kr) { - state Standalone result; +ACTOR static Future DataDistributionGetRangeActor(ReadYourWritesTransaction* ryw, + KeyRef prefix, + KeyRangeRef kr) { + state RangeResult result; // dataDistributionModeKey state Key modeKey = LiteralStringRef("mode").withPrefix(prefix); if (kr.contains(modeKey)) { @@ -2346,8 +2324,7 @@ ACTOR static Future> DataDistributionGetRangeActor(Re return rywGetRange(ryw, kr, result); } -Future> DataDistributionImpl::getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr) const { +Future DataDistributionImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const { return DataDistributionGetRangeActor(ryw, getKeyRange().begin, kr); } diff --git a/fdbclient/SpecialKeySpace.actor.h b/fdbclient/SpecialKeySpace.actor.h index ca6676a54b..9bf6bb7109 100644 --- a/fdbclient/SpecialKeySpace.actor.h +++ b/fdbclient/SpecialKeySpace.actor.h @@ -36,7 +36,7 @@ class SpecialKeyRangeReadImpl { public: // Each derived class only needs to implement this simple version of getRange - virtual Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const = 0; + virtual Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const = 0; explicit SpecialKeyRangeReadImpl(KeyRangeRef kr) : range(kr) {} KeyRangeRef getKeyRange() const { return range; } @@ -100,28 +100,26 @@ class SpecialKeyRangeAsyncImpl : public SpecialKeyRangeReadImpl { public: explicit SpecialKeyRangeAsyncImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {} - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override = 0; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override = 0; // calling with a cache object to have consistent results if we need to call rpc - Future> getRange(ReadYourWritesTransaction* ryw, - KeyRangeRef kr, - Optional>* cache) const { + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr, Optional* cache) const { return getRangeAsyncActor(this, ryw, kr, cache); } bool isAsync() const override { return true; } - ACTOR static Future> getRangeAsyncActor(const SpecialKeyRangeReadImpl* skrAyncImpl, - ReadYourWritesTransaction* ryw, - KeyRangeRef kr, - Optional>* cache) { + ACTOR static Future getRangeAsyncActor(const SpecialKeyRangeReadImpl* skrAyncImpl, + ReadYourWritesTransaction* ryw, + KeyRangeRef kr, + Optional* cache) { ASSERT(skrAyncImpl->getKeyRange().contains(kr)); ASSERT(cache != nullptr); if (!cache->present()) { // For simplicity, every time we need to cache, we read the whole range // Although sometimes the range can be narrowed, // there is not a general way to do it in complicated scenarios - Standalone result_ = wait(skrAyncImpl->getRange(ryw, skrAyncImpl->getKeyRange())); + RangeResult result_ = wait(skrAyncImpl->getRange(ryw, skrAyncImpl->getKeyRange())); *cache = result_; } const auto& allResults = cache->get(); @@ -131,11 +129,11 @@ public: while (end > 0 && allResults[end - 1].key >= kr.end) --end; if (start < end) { - Standalone result = RangeResultRef(allResults.slice(start, end), false); + RangeResult result = RangeResultRef(allResults.slice(start, end), false); result.arena().dependsOn(allResults.arena()); return result; } else - return Standalone(); + return RangeResult(); } }; @@ -168,11 +166,11 @@ public: Future> get(ReadYourWritesTransaction* ryw, const Key& key); - Future> getRange(ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse = false); + Future getRange(ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse = false); void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value); @@ -214,18 +212,18 @@ public: private: ACTOR static Future> getActor(SpecialKeySpace* sks, ReadYourWritesTransaction* ryw, KeyRef key); - ACTOR static Future> checkRYWValid(SpecialKeySpace* sks, - ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse); - ACTOR static Future> getRangeAggregationActor(SpecialKeySpace* sks, - ReadYourWritesTransaction* ryw, - KeySelector begin, - KeySelector end, - GetRangeLimits limits, - bool reverse); + ACTOR static Future checkRYWValid(SpecialKeySpace* sks, + ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse); + ACTOR static Future getRangeAggregationActor(SpecialKeySpace* sks, + ReadYourWritesTransaction* ryw, + KeySelector begin, + KeySelector end, + GetRangeLimits limits, + bool reverse); KeyRangeMap readImpls; KeyRangeMap modules; @@ -247,7 +245,7 @@ private: class SKSCTestImpl : public SpecialKeyRangeRWImpl { public: explicit SKSCTestImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; @@ -260,31 +258,31 @@ public: class ConflictingKeysImpl : public SpecialKeyRangeReadImpl { public: explicit ConflictingKeysImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class ReadConflictRangeImpl : public SpecialKeyRangeReadImpl { public: explicit ReadConflictRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class WriteConflictRangeImpl : public SpecialKeyRangeReadImpl { public: explicit WriteConflictRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class DDStatsRangeImpl : public SpecialKeyRangeAsyncImpl { public: explicit DDStatsRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class ManagementCommandsOptionsImpl : public SpecialKeyRangeRWImpl { public: explicit ManagementCommandsOptionsImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override; @@ -294,7 +292,7 @@ public: class ExcludeServersRangeImpl : public SpecialKeyRangeRWImpl { public: explicit ExcludeServersRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; Key decode(const KeyRef& key) const override; Key encode(const KeyRef& key) const override; @@ -304,7 +302,7 @@ public: class FailedServersRangeImpl : public SpecialKeyRangeRWImpl { public: explicit FailedServersRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; Key decode(const KeyRef& key) const override; Key encode(const KeyRef& key) const override; @@ -314,13 +312,13 @@ public: class ExclusionInProgressRangeImpl : public SpecialKeyRangeAsyncImpl { public: explicit ExclusionInProgressRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class ProcessClassRangeImpl : public SpecialKeyRangeRWImpl { public: explicit ProcessClassRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override; @@ -329,27 +327,27 @@ public: class ProcessClassSourceRangeImpl : public SpecialKeyRangeReadImpl { public: explicit ProcessClassSourceRangeImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class LockDatabaseImpl : public SpecialKeyRangeRWImpl { public: explicit LockDatabaseImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; class ConsistencyCheckImpl : public SpecialKeyRangeRWImpl { public: explicit ConsistencyCheckImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; class GlobalConfigImpl : public SpecialKeyRangeRWImpl { public: explicit GlobalConfigImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; Future> commit(ReadYourWritesTransaction* ryw) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; @@ -359,7 +357,7 @@ public: class TracingOptionsImpl : public SpecialKeyRangeRWImpl { public: explicit TracingOptionsImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; Future> commit(ReadYourWritesTransaction* ryw) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; @@ -369,7 +367,7 @@ public: class CoordinatorsImpl : public SpecialKeyRangeRWImpl { public: explicit CoordinatorsImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override; @@ -378,20 +376,20 @@ public: class CoordinatorsAutoImpl : public SpecialKeyRangeReadImpl { public: explicit CoordinatorsAutoImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class AdvanceVersionImpl : public SpecialKeyRangeRWImpl { public: explicit AdvanceVersionImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; class ClientProfilingImpl : public SpecialKeyRangeRWImpl { public: explicit ClientProfilingImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override; @@ -400,7 +398,7 @@ public: class ActorLineageImpl : public SpecialKeyRangeReadImpl { public: explicit ActorLineageImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; }; class ActorProfilerConf : public SpecialKeyRangeRWImpl { @@ -409,7 +407,7 @@ class ActorProfilerConf : public SpecialKeyRangeRWImpl { public: explicit ActorProfilerConf(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override; void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override; void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override; @@ -419,14 +417,14 @@ public: class MaintenanceImpl : public SpecialKeyRangeRWImpl { public: explicit MaintenanceImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; class DataDistributionImpl : public SpecialKeyRangeRWImpl { public: explicit DataDistributionImpl(KeyRangeRef kr); - Future> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; + Future getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override; Future> commit(ReadYourWritesTransaction* ryw) override; }; diff --git a/fdbclient/SystemData.cpp b/fdbclient/SystemData.cpp index 42fec5f9f2..314df8930b 100644 --- a/fdbclient/SystemData.cpp +++ b/fdbclient/SystemData.cpp @@ -48,9 +48,7 @@ const Key keyServersKey(const KeyRef& k) { const KeyRef keyServersKey(const KeyRef& k, Arena& arena) { return k.withPrefix(keyServersPrefix, arena); } -const Value keyServersValue(Standalone result, - const std::vector& src, - const std::vector& dest) { +const Value keyServersValue(RangeResult result, const std::vector& src, const std::vector& dest) { if (!CLIENT_KNOBS->TAG_ENCODE_KEY_SERVERS) { BinaryWriter wr(IncludeVersion(ProtocolVersion::withKeyServerValue())); wr << src << dest; @@ -95,7 +93,7 @@ const Value keyServersValue(const std::vector& srcTag, const std::vector result, +void decodeKeyServersValue(RangeResult result, const ValueRef& value, std::vector& src, std::vector& dest, diff --git a/fdbclient/SystemData.h b/fdbclient/SystemData.h index 952e8fcf00..e7a54e632c 100644 --- a/fdbclient/SystemData.h +++ b/fdbclient/SystemData.h @@ -52,12 +52,12 @@ extern const KeyRangeRef keyServersKeys, keyServersKeyServersKeys; extern const KeyRef keyServersPrefix, keyServersEnd, keyServersKeyServersKey; const Key keyServersKey(const KeyRef& k); const KeyRef keyServersKey(const KeyRef& k, Arena& arena); -const Value keyServersValue(Standalone result, +const Value keyServersValue(RangeResult result, const std::vector& src, const std::vector& dest = std::vector()); const Value keyServersValue(const std::vector& srcTag, const std::vector& destTag = std::vector()); // `result` must be the full result of getting serverTagKeys -void decodeKeyServersValue(Standalone result, +void decodeKeyServersValue(RangeResult result, const ValueRef& value, std::vector& src, std::vector& dest, diff --git a/fdbclient/TagThrottle.actor.cpp b/fdbclient/TagThrottle.actor.cpp index c278db116d..76adbb5431 100644 --- a/fdbclient/TagThrottle.actor.cpp +++ b/fdbclient/TagThrottle.actor.cpp @@ -179,7 +179,7 @@ ACTOR Future> getThrottledTags(Database db, int lim if (!containsRecommend) { wait(store(reportAuto, getValidAutoEnabled(&tr, db))); } - Standalone throttles = wait(tr.getRange( + RangeResult throttles = wait(tr.getRange( reportAuto ? tagThrottleKeys : KeyRangeRef(tagThrottleKeysPrefix, tagThrottleAutoKeysPrefix), limit)); std::vector results; for (auto throttle : throttles) { @@ -202,7 +202,7 @@ ACTOR Future> getRecommendedTags(Database db, int l return std::vector(); } - Standalone throttles = + RangeResult throttles = wait(tr.getRange(KeyRangeRef(tagThrottleAutoKeysPrefix, tagThrottleKeys.end), limit)); std::vector results; for (auto throttle : throttles) { @@ -339,7 +339,7 @@ ACTOR Future unthrottleMatchingThrottles(Database db, loop { try { - state Standalone tags = wait(tr.getRange(begin, end, 1000)); + state RangeResult tags = wait(tr.getRange(begin, end, 1000)); state uint64_t unthrottledTags = 0; uint64_t manualUnthrottledTags = 0; for (auto tag : tags) { diff --git a/fdbclient/TaskBucket.actor.cpp b/fdbclient/TaskBucket.actor.cpp index 6f0f63a7f0..4e17a1c9f7 100644 --- a/fdbclient/TaskBucket.actor.cpp +++ b/fdbclient/TaskBucket.actor.cpp @@ -243,8 +243,7 @@ public: state Reference task(new Task()); task->key = taskUID; - state Standalone values = - wait(tr->getRange(taskAvailableSpace.range(), CLIENT_KNOBS->TOO_MANY)); + state RangeResult values = wait(tr->getRange(taskAvailableSpace.range(), CLIENT_KNOBS->TOO_MANY)); Version version = wait(tr->getReadVersion()); task->timeoutVersion = version + (uint64_t)(taskBucket->timeout * @@ -602,19 +601,19 @@ public: taskBucket->setOptions(tr); // Check all available priorities for keys - state std::vector>> resultFutures; + state std::vector> resultFutures; for (int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri) resultFutures.push_back(tr->getRange(taskBucket->getAvailableSpace(pri).range(), 1)); // If any priority levels have any keys then the taskbucket is not empty so return false state int i; for (i = 0; i < resultFutures.size(); ++i) { - Standalone results = wait(resultFutures[i]); + RangeResult results = wait(resultFutures[i]); if (results.size() > 0) return false; } - Standalone values = wait(tr->getRange(taskBucket->timeouts.range(), 1)); + RangeResult values = wait(tr->getRange(taskBucket->timeouts.range(), 1)); if (values.size() > 0) return false; @@ -625,14 +624,14 @@ public: taskBucket->setOptions(tr); // Check all available priorities for emptiness - state std::vector>> resultFutures; + state std::vector> resultFutures; for (int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri) resultFutures.push_back(tr->getRange(taskBucket->getAvailableSpace(pri).range(), 1)); // If any priority levels have any keys then return true as the level is 'busy' state int i; for (i = 0; i < resultFutures.size(); ++i) { - Standalone results = wait(resultFutures[i]); + RangeResult results = wait(resultFutures[i]); if (results.size() > 0) return true; } @@ -650,7 +649,7 @@ public: t.append(task->timeoutVersion); t.append(task->key); - Standalone values = wait(tr->getRange(taskBucket->timeouts.range(t), 1)); + RangeResult values = wait(tr->getRange(taskBucket->timeouts.range(t), 1)); if (values.size() > 0) return false; @@ -742,7 +741,7 @@ public: state KeyRange range( KeyRangeRef(taskBucket->timeouts.get(0).range().begin, taskBucket->timeouts.get(end).range().end)); - Standalone values = wait(tr->getRange(range, CLIENT_KNOBS->TASKBUCKET_MAX_TASK_KEYS)); + RangeResult values = wait(tr->getRange(range, CLIENT_KNOBS->TASKBUCKET_MAX_TASK_KEYS)); // Keys will be tuples of (taskUID, param) -> paramValue // Unfortunately we need to know the priority parameter for a taskUID before we can know which available-tasks @@ -793,7 +792,7 @@ public: ACTOR static Future debugPrintRange(Reference tr, Subspace subspace, Key msg) { tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr->setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone values = wait(tr->getRange(subspace.range(), CLIENT_KNOBS->TOO_MANY)); + RangeResult values = wait(tr->getRange(subspace.range(), CLIENT_KNOBS->TOO_MANY)); TraceEvent("TaskBucketDebugPrintRange") .detail("Key", subspace.key()) .detail("Count", values.size()) @@ -851,7 +850,7 @@ public: } else { TEST(true); // Extended a task without updating parameters // Otherwise, read and transplant the params from the old to new timeout spaces - Standalone params = wait(tr->getRange(oldTimeoutSpace.range(), CLIENT_KNOBS->TOO_MANY)); + RangeResult params = wait(tr->getRange(oldTimeoutSpace.range(), CLIENT_KNOBS->TOO_MANY)); for (auto& kv : params) { Tuple paramKey = oldTimeoutSpace.unpack(kv.key); tr->set(newTimeoutSpace.pack(paramKey), kv.value); @@ -1114,7 +1113,7 @@ public: ACTOR static Future isSet(Reference tr, Reference taskFuture) { taskFuture->futureBucket->setOptions(tr); - Standalone values = wait(tr->getRange(taskFuture->blocks.range(), 1)); + RangeResult values = wait(tr->getRange(taskFuture->blocks.range(), 1)); if (values.size() > 0) return false; @@ -1177,7 +1176,7 @@ public: Reference taskFuture) { taskFuture->futureBucket->setOptions(tr); - Standalone values = wait(tr->getRange(taskFuture->callbacks.range(), CLIENT_KNOBS->TOO_MANY)); + RangeResult values = wait(tr->getRange(taskFuture->callbacks.range(), CLIENT_KNOBS->TOO_MANY)); tr->clear(taskFuture->callbacks.range()); std::vector> actions; diff --git a/fdbclient/ThreadSafeTransaction.cpp b/fdbclient/ThreadSafeTransaction.cpp index b8f2bc6a0a..aa0c6bca07 100644 --- a/fdbclient/ThreadSafeTransaction.cpp +++ b/fdbclient/ThreadSafeTransaction.cpp @@ -217,31 +217,31 @@ ThreadFuture>> ThreadSafeTransaction::getRangeSplit }); } -ThreadFuture> ThreadSafeTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot, - bool reverse) { +ThreadFuture ThreadSafeTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot, + bool reverse) { KeySelector b = begin; KeySelector e = end; ReadYourWritesTransaction* tr = this->tr; - return onMainThread([tr, b, e, limit, snapshot, reverse]() -> Future> { + return onMainThread([tr, b, e, limit, snapshot, reverse]() -> Future { tr->checkDeferredError(); return tr->getRange(b, e, limit, snapshot, reverse); }); } -ThreadFuture> ThreadSafeTransaction::getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot, - bool reverse) { +ThreadFuture ThreadSafeTransaction::getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot, + bool reverse) { KeySelector b = begin; KeySelector e = end; ReadYourWritesTransaction* tr = this->tr; - return onMainThread([tr, b, e, limits, snapshot, reverse]() -> Future> { + return onMainThread([tr, b, e, limits, snapshot, reverse]() -> Future { tr->checkDeferredError(); return tr->getRange(b, e, limits, snapshot, reverse); }); diff --git a/fdbclient/ThreadSafeTransaction.h b/fdbclient/ThreadSafeTransaction.h index d8502f7613..1fde6b06a3 100644 --- a/fdbclient/ThreadSafeTransaction.h +++ b/fdbclient/ThreadSafeTransaction.h @@ -79,26 +79,26 @@ public: ThreadFuture> get(const KeyRef& key, bool snapshot = false) override; ThreadFuture getKey(const KeySelectorRef& key, bool snapshot = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - int limit, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeySelectorRef& begin, - const KeySelectorRef& end, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override; - ThreadFuture> getRange(const KeyRangeRef& keys, - int limit, - bool snapshot = false, - bool reverse = false) override { + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + int limit, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeySelectorRef& begin, + const KeySelectorRef& end, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override; + ThreadFuture getRange(const KeyRangeRef& keys, + int limit, + bool snapshot = false, + bool reverse = false) override { return getRange(firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limit, snapshot, reverse); } - ThreadFuture> getRange(const KeyRangeRef& keys, - GetRangeLimits limits, - bool snapshot = false, - bool reverse = false) override { + ThreadFuture getRange(const KeyRangeRef& keys, + GetRangeLimits limits, + bool snapshot = false, + bool reverse = false) override { return getRange(firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limits, snapshot, reverse); } ThreadFuture>> getAddressesForKey(const KeyRef& key) override; diff --git a/fdbserver/ApplyMetadataMutation.cpp b/fdbserver/ApplyMetadataMutation.cpp index 20d873d590..125344d721 100644 --- a/fdbserver/ApplyMetadataMutation.cpp +++ b/fdbserver/ApplyMetadataMutation.cpp @@ -84,7 +84,7 @@ void applyMetadataMutations(SpanID const& spanContext, vector src, dest; // txnStateStore is always an in-memory KVS, and must always be recovered before // applyMetadataMutations is called, so a wait here should never be needed. - Future> fResult = txnStateStore->readRange(serverTagKeys); + Future fResult = txnStateStore->readRange(serverTagKeys); decodeKeyServersValue(fResult.get(), m.param2, src, dest); ASSERT(storageCache); diff --git a/fdbserver/BackupProgress.actor.cpp b/fdbserver/BackupProgress.actor.cpp index 0352ff6e31..28af84eaac 100644 --- a/fdbserver/BackupProgress.actor.cpp +++ b/fdbserver/BackupProgress.actor.cpp @@ -153,7 +153,7 @@ ACTOR Future getBackupProgress(Database cx, UID dbgid, Reference> fValue = tr.get(backupStartedKey); - state Standalone results = wait(tr.getRange(backupProgressKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult results = wait(tr.getRange(backupProgressKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!results.more && results.size() < CLIENT_KNOBS->TOO_MANY); Optional value = wait(fValue); diff --git a/fdbserver/ClusterController.actor.cpp b/fdbserver/ClusterController.actor.cpp index d0735301df..685e384289 100644 --- a/fdbserver/ClusterController.actor.cpp +++ b/fdbserver/ClusterController.actor.cpp @@ -2595,7 +2595,7 @@ public: std::map>, WorkerInfo> id_worker; std::map>, ProcessClass> id_class; // contains the mapping from process id to process class from the database - Standalone lastProcessClasses; + RangeResult lastProcessClasses; bool gotProcessClasses; bool gotFullyRecoveredConfig; Optional> masterProcessId; @@ -3642,7 +3642,7 @@ ACTOR Future monitorProcessClasses(ClusterControllerData* self) { if (val.present()) break; - Standalone processClasses = wait(trVer.getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult processClasses = wait(trVer.getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!processClasses.more && processClasses.size() < CLIENT_KNOBS->TOO_MANY); trVer.clear(processClassKeys); @@ -3667,7 +3667,7 @@ ACTOR Future monitorProcessClasses(ClusterControllerData* self) { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); - Standalone processClasses = wait(tr.getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult processClasses = wait(tr.getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!processClasses.more && processClasses.size() < CLIENT_KNOBS->TOO_MANY); if (processClasses != self->lastProcessClasses || !self->gotProcessClasses) { @@ -3773,7 +3773,7 @@ ACTOR Future monitorGlobalConfig(ClusterControllerData::DBInfo* db) { // Since the history keys end with versionstamps, they // should be sorted correctly (versionstamps are stored in // big-endian order). - Standalone globalConfigHistory = + RangeResult globalConfigHistory = wait(tr.getRange(globalConfigHistoryKeys, CLIENT_KNOBS->TOO_MANY)); // If the global configuration version key has been set, // the history should contain at least one item. diff --git a/fdbserver/CommitProxyServer.actor.cpp b/fdbserver/CommitProxyServer.actor.cpp index 428a384279..208744e3a0 100644 --- a/fdbserver/CommitProxyServer.actor.cpp +++ b/fdbserver/CommitProxyServer.actor.cpp @@ -1515,8 +1515,7 @@ ACTOR static Future rejoinServer(CommitProxyInterface proxy, ProxyCommitDa GetStorageServerRejoinInfoReply rep; rep.version = commitData->version; rep.tag = decodeServerTagValue(commitData->txnStateStore->readValue(serverTagKeyFor(req.id)).get().get()); - Standalone history = - commitData->txnStateStore->readRange(serverTagHistoryRangeFor(req.id)).get(); + RangeResult history = commitData->txnStateStore->readRange(serverTagHistoryRangeFor(req.id)).get(); for (int i = history.size() - 1; i >= 0; i--) { rep.history.push_back( std::make_pair(decodeServerTagHistoryKey(history[i].key), decodeServerTagValue(history[i].value))); @@ -1940,18 +1939,18 @@ ACTOR Future commitProxyServerCore(CommitProxyInterface proxy, if (txnSequences.size() == maxSequence) { state KeyRange txnKeys = allKeys; - Standalone UIDtoTagMap = commitData.txnStateStore->readRange(serverTagKeys).get(); + RangeResult UIDtoTagMap = commitData.txnStateStore->readRange(serverTagKeys).get(); state std::map tag_uid; for (const KeyValueRef& kv : UIDtoTagMap) { tag_uid[decodeServerTagValue(kv.value)] = decodeServerTagKey(kv.key); } loop { wait(yield()); - Standalone data = commitData.txnStateStore - ->readRange(txnKeys, - SERVER_KNOBS->BUGGIFIED_ROW_LIMIT, - SERVER_KNOBS->APPLY_MUTATION_BYTES) - .get(); + RangeResult data = commitData.txnStateStore + ->readRange(txnKeys, + SERVER_KNOBS->BUGGIFIED_ROW_LIMIT, + SERVER_KNOBS->APPLY_MUTATION_BYTES) + .get(); if (!data.size()) break; ((KeyRangeRef&)txnKeys) = KeyRangeRef(keyAfter(data.back().key, txnKeys.arena()), txnKeys.end); diff --git a/fdbserver/Coordination.actor.cpp b/fdbserver/Coordination.actor.cpp index 6e9be53ddb..92de5a5b3c 100644 --- a/fdbserver/Coordination.actor.cpp +++ b/fdbserver/Coordination.actor.cpp @@ -480,7 +480,7 @@ struct LeaderRegisterCollection { if (!self->pStore->exists()) return Void(); OnDemandStore& store = *self->pStore; - Standalone forwardingInfo = wait(store->readRange(fwdKeys)); + RangeResult forwardingInfo = wait(store->readRange(fwdKeys)); for (int i = 0; i < forwardingInfo.size(); i++) { LeaderInfo forwardInfo; forwardInfo.forward = true; diff --git a/fdbserver/DataDistribution.actor.cpp b/fdbserver/DataDistribution.actor.cpp index 8548fb9fc6..d1762fc7cb 100644 --- a/fdbserver/DataDistribution.actor.cpp +++ b/fdbserver/DataDistribution.actor.cpp @@ -435,7 +435,7 @@ ACTOR Future> getInitialDataDistribution(Data } state Future> workers = getWorkers(&tr); - state Future> serverList = tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY); + state Future serverList = tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY); wait(success(workers) && success(serverList)); ASSERT(!serverList.get().more && serverList.get().size() < CLIENT_KNOBS->TOO_MANY); @@ -469,13 +469,13 @@ ACTOR Future> getInitialDataDistribution(Data try { tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); wait(checkMoveKeysLockReadOnly(&tr, moveKeysLock, ddEnabledState)); - state Standalone UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); - Standalone keyServers = wait(krmGetRanges(&tr, - keyServersPrefix, - KeyRangeRef(beginKey, allKeys.end), - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); + RangeResult keyServers = wait(krmGetRanges(&tr, + keyServersPrefix, + KeyRangeRef(beginKey, allKeys.end), + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); succeeded = true; vector src, dest, last; @@ -3657,16 +3657,14 @@ ACTOR Future trackExcludedServers(DDTeamCollection* self) { loop { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - state Future> fresultsExclude = - tr.getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY); - state Future> fresultsFailed = - tr.getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY); + state Future fresultsExclude = tr.getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY); + state Future fresultsFailed = tr.getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY); wait(success(fresultsExclude) && success(fresultsFailed)); - Standalone excludedResults = fresultsExclude.get(); + RangeResult excludedResults = fresultsExclude.get(); ASSERT(!excludedResults.more && excludedResults.size() < CLIENT_KNOBS->TOO_MANY); - Standalone failedResults = fresultsFailed.get(); + RangeResult failedResults = fresultsFailed.get(); ASSERT(!failedResults.more && failedResults.size() < CLIENT_KNOBS->TOO_MANY); std::set excluded; @@ -3720,7 +3718,7 @@ ACTOR Future trackExcludedServers(DDTeamCollection* self) { ACTOR Future>> getServerListAndProcessClasses(Transaction* tr) { state Future> workers = getWorkers(tr); - state Future> serverList = tr->getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY); + state Future serverList = tr->getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY); wait(success(workers) && success(serverList)); ASSERT(!serverList.get().more && serverList.get().size() < CLIENT_KNOBS->TOO_MANY); @@ -4873,13 +4871,13 @@ ACTOR Future debugCheckCoalescing(Database cx) { state Transaction tr(cx); loop { try { - state Standalone serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); state int i; for (i = 0; i < serverList.size(); i++) { state UID id = decodeServerListValue(serverList[i].value).id(); - Standalone ranges = wait(krmGetRanges(&tr, serverKeysPrefixFor(id), allKeys)); + RangeResult ranges = wait(krmGetRanges(&tr, serverKeysPrefixFor(id), allKeys)); ASSERT(ranges.end()[-1].key == allKeys.end); for (int j = 0; j < ranges.size() - 2; j++) @@ -5011,8 +5009,7 @@ ACTOR Future dataDistribution(Reference self, tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); - Standalone replicaKeys = - wait(tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult replicaKeys = wait(tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY)); for (auto& kv : replicaKeys) { auto dcId = decodeDatacenterReplicasKey(kv.key); @@ -5570,7 +5567,7 @@ ACTOR Future cacheServerWatcher(Database* db) { loop { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); try { - Standalone range = wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult range = wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!range.more); std::set caches; for (auto& kv : range) { diff --git a/fdbserver/DataDistributionQueue.actor.cpp b/fdbserver/DataDistributionQueue.actor.cpp index e151ddddc5..f7b0d465c7 100644 --- a/fdbserver/DataDistributionQueue.actor.cpp +++ b/fdbserver/DataDistributionQueue.actor.cpp @@ -595,12 +595,11 @@ struct DDQueueData { servers.clear(); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); try { - state Standalone UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); - Standalone keyServersEntries = - wait(tr.getRange(lastLessOrEqual(keyServersKey(input.keys.begin)), - firstGreaterOrEqual(keyServersKey(input.keys.end)), - SERVER_KNOBS->DD_QUEUE_MAX_KEY_SERVERS)); + RangeResult keyServersEntries = wait(tr.getRange(lastLessOrEqual(keyServersKey(input.keys.begin)), + firstGreaterOrEqual(keyServersKey(input.keys.end)), + SERVER_KNOBS->DD_QUEUE_MAX_KEY_SERVERS)); if (keyServersEntries.size() < SERVER_KNOBS->DD_QUEUE_MAX_KEY_SERVERS) { for (int shard = 0; shard < keyServersEntries.size(); shard++) { @@ -629,7 +628,7 @@ struct DDQueueData { // When a shard is inflight and DD crashes, some destination servers may have already got the data. // The new DD will treat the destination servers as source servers. So the size can be large. else { - Standalone serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); for (auto s = serverList.begin(); s != serverList.end(); ++s) diff --git a/fdbserver/IKeyValueStore.h b/fdbserver/IKeyValueStore.h index 262a345329..c5b03a53f4 100644 --- a/fdbserver/IKeyValueStore.h +++ b/fdbserver/IKeyValueStore.h @@ -56,9 +56,7 @@ public: // If rowLimit>=0, reads first rows sorted ascending, otherwise reads last rows sorted descending // The total size of the returned value (less the last entry) will be less than byteLimit - virtual Future> readRange(KeyRangeRef keys, - int rowLimit = 1 << 30, - int byteLimit = 1 << 30) = 0; + virtual Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) = 0; // To debug MEMORY_RADIXTREE type ONLY // Returns (1) how many key & value pairs have been inserted (2) how many nodes have been created (3) how many diff --git a/fdbserver/KeyValueStoreCompressTestData.actor.cpp b/fdbserver/KeyValueStoreCompressTestData.actor.cpp index 1e83f22be4..c83114e967 100644 --- a/fdbserver/KeyValueStoreCompressTestData.actor.cpp +++ b/fdbserver/KeyValueStoreCompressTestData.actor.cpp @@ -72,9 +72,7 @@ struct KeyValueStoreCompressTestData final : IKeyValueStore { // If rowLimit>=0, reads first rows sorted ascending, otherwise reads last rows sorted descending // The total size of the returned value (less the last entry) will be less than byteLimit - Future> readRange(KeyRangeRef keys, - int rowLimit = 1 << 30, - int byteLimit = 1 << 30) override { + Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) override { return doReadRange(store, keys, rowLimit, byteLimit); } @@ -99,12 +97,9 @@ private: return v; } } - ACTOR Future> doReadRange(IKeyValueStore* store, - KeyRangeRef keys, - int rowLimit, - int byteLimit) { - Standalone _vs = wait(store->readRange(keys, rowLimit, byteLimit)); - Standalone vs = _vs; // Get rid of implicit const& from wait statement + ACTOR Future doReadRange(IKeyValueStore* store, KeyRangeRef keys, int rowLimit, int byteLimit) { + RangeResult _vs = wait(store->readRange(keys, rowLimit, byteLimit)); + RangeResult vs = _vs; // Get rid of implicit const& from wait statement Arena& a = vs.arena(); for (int i = 0; i < vs.size(); i++) vs[i].value = ValueRef(a, (ValueRef const&)unpack(vs[i].value)); diff --git a/fdbserver/KeyValueStoreMemory.actor.cpp b/fdbserver/KeyValueStoreMemory.actor.cpp index d3432c27dd..bbe314c667 100644 --- a/fdbserver/KeyValueStoreMemory.actor.cpp +++ b/fdbserver/KeyValueStoreMemory.actor.cpp @@ -228,15 +228,13 @@ public: // If rowLimit>=0, reads first rows sorted ascending, otherwise reads last rows sorted descending // The total size of the returned value (less the last entry) will be less than byteLimit - Future> readRange(KeyRangeRef keys, - int rowLimit = 1 << 30, - int byteLimit = 1 << 30) override { + Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) override { if (recovering.isError()) throw recovering.getError(); if (!recovering.isReady()) return waitAndReadRange(this, keys, rowLimit, byteLimit); - Standalone result; + RangeResult result; if (rowLimit == 0) { return result; } @@ -835,10 +833,10 @@ private: wait(self->recovering); return self->readValuePrefix(key, maxLength).get(); } - ACTOR static Future> waitAndReadRange(KeyValueStoreMemory* self, - KeyRange keys, - int rowLimit, - int byteLimit) { + ACTOR static Future waitAndReadRange(KeyValueStoreMemory* self, + KeyRange keys, + int rowLimit, + int byteLimit) { wait(self->recovering); return self->readRange(keys, rowLimit, byteLimit).get(); } diff --git a/fdbserver/KeyValueStoreRocksDB.actor.cpp b/fdbserver/KeyValueStoreRocksDB.actor.cpp index fb8cbfe6f3..625d5ce6c6 100644 --- a/fdbserver/KeyValueStoreRocksDB.actor.cpp +++ b/fdbserver/KeyValueStoreRocksDB.actor.cpp @@ -290,13 +290,13 @@ struct RocksDBKeyValueStore : IKeyValueStore { struct ReadRangeAction : TypedAction, FastAllocated { KeyRange keys; int rowLimit, byteLimit; - ThreadReturnPromise> result; + ThreadReturnPromise result; ReadRangeAction(KeyRange keys, int rowLimit, int byteLimit) : keys(keys), rowLimit(rowLimit), byteLimit(byteLimit) {} double getTimeEstimate() const override { return SERVER_KNOBS->READ_RANGE_TIME_ESTIMATE; } }; void action(ReadRangeAction& a) { - Standalone result; + RangeResult result; if (a.rowLimit == 0 || a.byteLimit == 0) { a.result.send(result); } @@ -446,7 +446,7 @@ struct RocksDBKeyValueStore : IKeyValueStore { return res; } - Future> readRange(KeyRangeRef keys, int rowLimit, int byteLimit) override { + Future readRange(KeyRangeRef keys, int rowLimit, int byteLimit) override { auto a = new Reader::ReadRangeAction(keys, rowLimit, byteLimit); auto res = a->result.getFuture(); readThreads->post(a); diff --git a/fdbserver/KeyValueStoreSQLite.actor.cpp b/fdbserver/KeyValueStoreSQLite.actor.cpp index be98515cf3..6e3043f3f3 100644 --- a/fdbserver/KeyValueStoreSQLite.actor.cpp +++ b/fdbserver/KeyValueStoreSQLite.actor.cpp @@ -1145,8 +1145,8 @@ struct RawCursor { } return Optional(); } - Standalone getRange(KeyRangeRef keys, int rowLimit, int byteLimit) { - Standalone result; + RangeResult getRange(KeyRangeRef keys, int rowLimit, int byteLimit) { + RangeResult result; int accumulatedBytes = 0; ASSERT(byteLimit > 0); if (rowLimit == 0) { @@ -1579,9 +1579,7 @@ public: Future> readValue(KeyRef key, Optional debugID) override; Future> readValuePrefix(KeyRef key, int maxLength, Optional debugID) override; - Future> readRange(KeyRangeRef keys, - int rowLimit = 1 << 30, - int byteLimit = 1 << 30) override; + Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) override; KeyValueStoreSQLite(std::string const& filename, UID logID, @@ -1697,7 +1695,7 @@ private: struct ReadRangeAction : TypedAction, FastAllocated { KeyRange keys; int rowLimit, byteLimit; - ThreadReturnPromise> result; + ThreadReturnPromise result; ReadRangeAction(KeyRange keys, int rowLimit, int byteLimit) : keys(keys), rowLimit(rowLimit), byteLimit(byteLimit) {} double getTimeEstimate() const override { return SERVER_KNOBS->READ_RANGE_TIME_ESTIMATE; } @@ -2207,7 +2205,7 @@ Future> KeyValueStoreSQLite::readValuePrefix(KeyRef key, int max readThreads->post(p); return f; } -Future> KeyValueStoreSQLite::readRange(KeyRangeRef keys, int rowLimit, int byteLimit) { +Future KeyValueStoreSQLite::readRange(KeyRangeRef keys, int rowLimit, int byteLimit) { ++readsRequested; auto p = new Reader::ReadRangeAction(keys, rowLimit, byteLimit); auto f = p->result.getFuture(); diff --git a/fdbserver/MetricLogger.actor.cpp b/fdbserver/MetricLogger.actor.cpp index 6e14527d25..65a4a3ae5f 100644 --- a/fdbserver/MetricLogger.actor.cpp +++ b/fdbserver/MetricLogger.actor.cpp @@ -182,7 +182,7 @@ public: // levelKey is the prefix for the entire level, no timestamp at the end ACTOR static Future>> getLastBlock_impl(ReadYourWritesTransaction* tr, Standalone levelKey) { - Standalone results = wait(tr->getRange(normalKeys.withPrefix(levelKey), 1, true, true)); + RangeResult results = wait(tr->getRange(normalKeys.withPrefix(levelKey), 1, true, true)); if (results.size() == 1) return results[0].value; return Optional>(); diff --git a/fdbserver/MoveKeys.actor.cpp b/fdbserver/MoveKeys.actor.cpp index 0702b8d097..1f2e3a9780 100644 --- a/fdbserver/MoveKeys.actor.cpp +++ b/fdbserver/MoveKeys.actor.cpp @@ -234,11 +234,11 @@ ACTOR Future> addReadWriteDestinations(KeyRangeRef shard, return result; } -ACTOR Future>> additionalSources(Standalone shards, +ACTOR Future>> additionalSources(RangeResult shards, Transaction* tr, int desiredHealthy, int maxServers) { - state Standalone UIDtoTagMap = wait(tr->getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr->getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); vector>> serverListEntries; std::set fetching; @@ -380,11 +380,11 @@ ACTOR static Future startMoveKeys(Database occ, // Get all existing shards overlapping keys (exclude any that have been processed in a previous // iteration of the outer loop) state KeyRange currentKeys = KeyRangeRef(begin, keys.end); - state Standalone old = wait(krmGetRanges(&tr, - keyServersPrefix, - currentKeys, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); + state RangeResult old = wait(krmGetRanges(&tr, + keyServersPrefix, + currentKeys, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); // Determine the last processed key (which will be the beginning for the next iteration) state Key endKey = old.end()[-1].key; @@ -399,8 +399,7 @@ ACTOR static Future startMoveKeys(Database occ, // printf("'%s': '%s'\n", old[i].key.toString().c_str(), old[i].value.toString().c_str()); // Check that enough servers for each shard are in the correct state - state Standalone UIDtoTagMap = - wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); vector> addAsSource = wait(additionalSources( old, &tr, servers.size(), SERVER_KNOBS->MAX_ADDED_SOURCES_MULTIPLIER * servers.size())); @@ -630,15 +629,13 @@ ACTOR static Future finishMoveKeys(Database occ, wait(checkMoveKeysLock(&tr, lock, ddEnabledState)); state KeyRange currentKeys = KeyRangeRef(begin, keys.end); - state Standalone UIDtoTagMap = - wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); - state Standalone keyServers = - wait(krmGetRanges(&tr, - keyServersPrefix, - currentKeys, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); + state RangeResult keyServers = wait(krmGetRanges(&tr, + keyServersPrefix, + currentKeys, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); // Determine the last processed key (which will be the beginning for the next iteration) endKey = keyServers.end()[-1].key; @@ -869,8 +866,7 @@ ACTOR Future> addStorageServer(Database cx, StorageServe state int maxSkipTags = 1; loop { try { - state Future> fTagLocalities = - tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY); + state Future fTagLocalities = tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY); state Future> fv = tr.get(serverListKeyFor(server.id())); state Future> fExclProc = tr.get( @@ -901,9 +897,8 @@ ACTOR Future> addStorageServer(Database cx, StorageServe ? tr.get(StringRef(encodeFailedServersKey(AddressExclusion(server.secondaryAddress().get().ip)))) : Future>(Optional()); - state Future> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY, true); - state Future> fHistoryTags = - tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY, true); + state Future fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY, true); + state Future fHistoryTags = tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY, true); wait(success(fTagLocalities) && success(fv) && success(fTags) && success(fHistoryTags) && success(fExclProc) && success(fExclIP) && success(fFailProc) && success(fFailIP) && @@ -991,7 +986,7 @@ ACTOR Future> addStorageServer(Database cx, StorageServe } // A SS can be removed only if all data (shards) on the SS have been moved away from the SS. ACTOR Future canRemoveStorageServer(Transaction* tr, UID serverID) { - Standalone keys = wait(krmGetRanges(tr, serverKeysPrefixFor(serverID), allKeys, 2)); + RangeResult keys = wait(krmGetRanges(tr, serverKeysPrefixFor(serverID), allKeys, 2)); ASSERT(keys.size() >= 2); @@ -1034,13 +1029,10 @@ ACTOR Future removeStorageServer(Database cx, } else { state Future> fListKey = tr.get(serverListKeyFor(serverID)); - state Future> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY); - state Future> fHistoryTags = - tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY); - state Future> fTagLocalities = - tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY); - state Future> fTLogDatacenters = - tr.getRange(tLogDatacentersKeys, CLIENT_KNOBS->TOO_MANY); + state Future fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY); + state Future fHistoryTags = tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY); + state Future fTagLocalities = tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY); + state Future fTLogDatacenters = tr.getRange(tLogDatacentersKeys, CLIENT_KNOBS->TOO_MANY); wait(success(fListKey) && success(fTags) && success(fHistoryTags) && success(fTagLocalities) && success(fTLogDatacenters)); @@ -1122,14 +1114,13 @@ ACTOR Future removeKeysFromFailedServer(Database cx, // Get all values of keyServers and remove serverID from every occurrence // Very inefficient going over every entry in keyServers // No shortcut because keyServers and serverKeys are not guaranteed same shard boundaries - state Standalone UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + state RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); - state Standalone keyServers = - wait(krmGetRanges(&tr, - keyServersPrefix, - KeyRangeRef(begin, allKeys.end), - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, - SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); + state RangeResult keyServers = wait(krmGetRanges(&tr, + keyServersPrefix, + KeyRangeRef(begin, allKeys.end), + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT, + SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT_BYTES)); state KeyRange currentKeys = KeyRangeRef(begin, keyServers.end()[-1].key); for (int i = 0; i < keyServers.size() - 1; ++i) { auto it = keyServers[i]; @@ -1248,7 +1239,7 @@ void seedShardServers(Arena& arena, CommitTransactionRef& tr, vectorTAG_ENCODE_KEY_SERVERS ? keyServersValue(serverTags) - : keyServersValue(Standalone(), serverSrcUID); + : keyServersValue(RangeResult(), serverSrcUID); // We have to set this range in two blocks, because the master tracking of "keyServersLocations" depends on a change // to a specific // key (keyServersKeyServersKey) diff --git a/fdbserver/OldTLogServer_4_6.actor.cpp b/fdbserver/OldTLogServer_4_6.actor.cpp index 64b71950de..3c5ae2ee1f 100644 --- a/fdbserver/OldTLogServer_4_6.actor.cpp +++ b/fdbserver/OldTLogServer_4_6.actor.cpp @@ -1063,7 +1063,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen peekMessagesFromMemory(logData, req, messages2, endVersion); - Standalone kvs = wait(self->persistentData->readRange( + RangeResult kvs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessagesKey(logData->logId, oldTag, req.begin), persistTagMessagesKey(logData->logId, oldTag, logData->persistentDataDurableVersion + 1)), SERVER_KNOBS->DESIRED_TOTAL_BYTES, @@ -1391,8 +1391,8 @@ ACTOR Future restorePersistentState(TLogData* self, LocalityData locality) IKeyValueStore* storage = self->persistentData; state Future> fFormat = storage->readValue(persistFormat.key); - state Future> fVers = storage->readRange(persistCurrentVersionKeys); - state Future> fRecoverCounts = storage->readRange(persistRecoveryCountKeys); + state Future fVers = storage->readRange(persistCurrentVersionKeys); + state Future fRecoverCounts = storage->readRange(persistRecoveryCountKeys); // FIXME: metadata in queue? @@ -1407,8 +1407,7 @@ ACTOR Future restorePersistentState(TLogData* self, LocalityData locality) } if (!fFormat.get().present()) { - Standalone v = - wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); + RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); if (!v.size()) { TEST(true); // The DB is completely empty, so it was never initialized. Delete it. throw worker_removed(); @@ -1469,8 +1468,7 @@ ACTOR Future restorePersistentState(TLogData* self, LocalityData locality) loop { if (logData->removed.isReady()) break; - Standalone data = - wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); + RangeResult data = wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); if (!data.size()) break; ((KeyRangeRef&)tagKeys) = KeyRangeRef(keyAfter(data.back().key, tagKeys.arena()), tagKeys.end); diff --git a/fdbserver/OldTLogServer_6_0.actor.cpp b/fdbserver/OldTLogServer_6_0.actor.cpp index f90ef99ad8..a442a3df6a 100644 --- a/fdbserver/OldTLogServer_6_0.actor.cpp +++ b/fdbserver/OldTLogServer_6_0.actor.cpp @@ -1357,7 +1357,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen peekMessagesFromMemory(logData, req, messages2, endVersion); } - Standalone kvs = wait(self->persistentData->readRange( + RangeResult kvs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessagesKey(logData->logId, req.tag, req.begin), persistTagMessagesKey(logData->logId, req.tag, logData->persistentDataDurableVersion + 1)), SERVER_KNOBS->DESIRED_TOTAL_BYTES, @@ -2232,12 +2232,12 @@ ACTOR Future restorePersistentState(TLogData* self, state IKeyValueStore* storage = self->persistentData; wait(storage->init()); state Future> fFormat = storage->readValue(persistFormat.key); - state Future> fVers = storage->readRange(persistCurrentVersionKeys); - state Future> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); - state Future> fLocality = storage->readRange(persistLocalityKeys); - state Future> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); - state Future> fTxsTags = storage->readRange(persistTxsTagsKeys); - state Future> fRecoverCounts = storage->readRange(persistRecoveryCountKeys); + state Future fVers = storage->readRange(persistCurrentVersionKeys); + state Future fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); + state Future fLocality = storage->readRange(persistLocalityKeys); + state Future fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); + state Future fTxsTags = storage->readRange(persistTxsTagsKeys); + state Future fRecoverCounts = storage->readRange(persistRecoveryCountKeys); // FIXME: metadata in queue? @@ -2258,8 +2258,7 @@ ACTOR Future restorePersistentState(TLogData* self, } if (!fFormat.get().present()) { - Standalone v = - wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); + RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); if (!v.size()) { TEST(true); // The DB is completely empty, so it was never initialized. Delete it. throw worker_removed(); @@ -2374,8 +2373,7 @@ ACTOR Future restorePersistentState(TLogData* self, loop { if (logData->removed.isReady()) break; - Standalone data = - wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); + RangeResult data = wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); if (!data.size()) break; ((KeyRangeRef&)tagKeys) = KeyRangeRef(keyAfter(data.back().key, tagKeys.arena()), tagKeys.end); diff --git a/fdbserver/OldTLogServer_6_2.actor.cpp b/fdbserver/OldTLogServer_6_2.actor.cpp index 18a25454b0..a305b27f3a 100644 --- a/fdbserver/OldTLogServer_6_2.actor.cpp +++ b/fdbserver/OldTLogServer_6_2.actor.cpp @@ -828,7 +828,7 @@ ACTOR Future updatePoppedLocation(TLogData* self, Reference logDa // us to remove data that still is pointed to by SpilledData in the btree. if (data->persistentPopped <= logData->persistentDataVersion) { // Recover the next needed location in the Disk Queue from the index. - Standalone kvrefs = wait(self->persistentData->readRange( + RangeResult kvrefs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessageRefsKey(logData->logId, data->tag, data->persistentPopped), persistTagMessageRefsKey(logData->logId, data->tag, logData->persistentDataVersion + 1)), 1)); @@ -1682,7 +1682,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen } if (req.tag.locality == tagLocalityTxs || req.tag == txsTag) { - Standalone kvs = wait(self->persistentData->readRange( + RangeResult kvs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessagesKey(logData->logId, req.tag, req.begin), persistTagMessagesKey(logData->logId, req.tag, logData->persistentDataDurableVersion + 1)), SERVER_KNOBS->DESIRED_TOTAL_BYTES, @@ -1702,7 +1702,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen } } else { // FIXME: Limit to approximately DESIRED_TOTATL_BYTES somehow. - Standalone kvrefs = wait(self->persistentData->readRange( + RangeResult kvrefs = wait(self->persistentData->readRange( KeyRangeRef( persistTagMessageRefsKey(logData->logId, req.tag, req.begin), persistTagMessageRefsKey(logData->logId, req.tag, logData->persistentDataDurableVersion + 1)), @@ -2683,13 +2683,13 @@ ACTOR Future restorePersistentState(TLogData* self, wait(storage->init()); state Future> fFormat = storage->readValue(persistFormat.key); state Future> fRecoveryLocation = storage->readValue(persistRecoveryLocationKey); - state Future> fVers = storage->readRange(persistCurrentVersionKeys); - state Future> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); - state Future> fLocality = storage->readRange(persistLocalityKeys); - state Future> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); - state Future> fTxsTags = storage->readRange(persistTxsTagsKeys); - state Future> fRecoverCounts = storage->readRange(persistRecoveryCountKeys); - state Future> fProtocolVersions = storage->readRange(persistProtocolVersionKeys); + state Future fVers = storage->readRange(persistCurrentVersionKeys); + state Future fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); + state Future fLocality = storage->readRange(persistLocalityKeys); + state Future fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); + state Future fTxsTags = storage->readRange(persistTxsTagsKeys); + state Future fRecoverCounts = storage->readRange(persistRecoveryCountKeys); + state Future fProtocolVersions = storage->readRange(persistProtocolVersionKeys); // FIXME: metadata in queue? @@ -2711,8 +2711,7 @@ ACTOR Future restorePersistentState(TLogData* self, } if (!fFormat.get().present()) { - Standalone v = - wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); + RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); if (!v.size()) { TEST(true); // The DB is completely empty, so it was never initialized. Delete it. throw worker_removed(); @@ -2821,8 +2820,7 @@ ACTOR Future restorePersistentState(TLogData* self, loop { if (logData->removed.isReady()) break; - Standalone data = - wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); + RangeResult data = wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); if (!data.size()) break; ((KeyRangeRef&)tagKeys) = KeyRangeRef(keyAfter(data.back().key, tagKeys.arena()), tagKeys.end); diff --git a/fdbserver/QuietDatabase.actor.cpp b/fdbserver/QuietDatabase.actor.cpp index 3470dfc821..98f14d545e 100644 --- a/fdbserver/QuietDatabase.actor.cpp +++ b/fdbserver/QuietDatabase.actor.cpp @@ -229,7 +229,7 @@ ACTOR Future> getStorageServers(Database cx, bool } tr.setOption(FDBTransactionOptions::LOCK_AWARE); try { - Standalone serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult serverList = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY); vector servers; diff --git a/fdbserver/Ratekeeper.actor.cpp b/fdbserver/Ratekeeper.actor.cpp index 92de6b093b..71d3056489 100644 --- a/fdbserver/Ratekeeper.actor.cpp +++ b/fdbserver/Ratekeeper.actor.cpp @@ -784,8 +784,7 @@ ACTOR Future monitorThrottlingChanges(RatekeeperData* self) { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); - state Future> throttledTagKeys = - tr.getRange(tagThrottleKeys, CLIENT_KNOBS->TOO_MANY); + state Future throttledTagKeys = tr.getRange(tagThrottleKeys, CLIENT_KNOBS->TOO_MANY); state Future> autoThrottlingEnabled = tr.get(tagThrottleAutoEnabledKey); if (!committed) { @@ -1388,7 +1387,7 @@ ACTOR Future configurationMonitor(RatekeeperData* self) { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); - Standalone results = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult results = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!results.more && results.size() < CLIENT_KNOBS->TOO_MANY); self->configuration.fromKeyValues((VectorRef)results); diff --git a/fdbserver/RestoreController.actor.cpp b/fdbserver/RestoreController.actor.cpp index 5010afbada..4341fbf1cf 100644 --- a/fdbserver/RestoreController.actor.cpp +++ b/fdbserver/RestoreController.actor.cpp @@ -722,8 +722,7 @@ ACTOR static Future> collectRestoreRequests(Database Optional numRequests = wait(tr.get(restoreRequestTriggerKey)); ASSERT(numRequests.present()); - Standalone restoreRequestValues = - wait(tr.getRange(restoreRequestKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult restoreRequestValues = wait(tr.getRange(restoreRequestKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!restoreRequestValues.more); if (restoreRequestValues.size()) { for (auto& it : restoreRequestValues) { diff --git a/fdbserver/RestoreWorker.actor.cpp b/fdbserver/RestoreWorker.actor.cpp index 3f7fa1f46d..193f2631da 100644 --- a/fdbserver/RestoreWorker.actor.cpp +++ b/fdbserver/RestoreWorker.actor.cpp @@ -153,7 +153,7 @@ ACTOR Future collectRestoreWorkerInterface(Reference se tr.reset(); tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone agentValues = wait(tr.getRange(restoreWorkersKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult agentValues = wait(tr.getRange(restoreWorkersKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!agentValues.more); // If agentValues.size() < min_num_workers, we should wait for coming workers to register their // workerInterface before we read them once for all diff --git a/fdbserver/Status.actor.cpp b/fdbserver/Status.actor.cpp index 91daae600c..8579fcd2df 100644 --- a/fdbserver/Status.actor.cpp +++ b/fdbserver/Status.actor.cpp @@ -1410,10 +1410,9 @@ ACTOR static Future logRangeWarningFetcher(Database cx, tr.setOption(FDBTransactionOptions::LOCK_AWARE); tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - state Future> existingDestUidValues = + state Future existingDestUidValues = tr.getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY); - state Future> existingLogRanges = - tr.getRange(logRangesRange, CLIENT_KNOBS->TOO_MANY); + state Future existingLogRanges = tr.getRange(logRangesRange, CLIENT_KNOBS->TOO_MANY); wait((success(existingDestUidValues) && success(existingLogRanges)) || timeoutFuture); std::set loggingRanges; @@ -1494,8 +1493,7 @@ loadConfiguration(Database cx, JsonBuilderArray* messages, std::set tr.setOption(FDBTransactionOptions::CAUSAL_READ_RISKY); try { choose { - when(Standalone res = - wait(tr.getRange(configKeys, SERVER_KNOBS->CONFIGURATION_ROWS_TO_FETCH))) { + when(RangeResult res = wait(tr.getRange(configKeys, SERVER_KNOBS->CONFIGURATION_ROWS_TO_FETCH))) { DatabaseConfiguration configuration; if (res.size() == SERVER_KNOBS->CONFIGURATION_ROWS_TO_FETCH) { status_incomplete_reasons->insert("Too many configuration parameters set."); @@ -2522,11 +2520,10 @@ ACTOR Future layerStatusFetcher(Database cx, tr.setOption(FDBTransactionOptions::TIMEOUT, StringRef((uint8_t*)&timeout_ms, sizeof(int64_t))); std::string jsonPrefix = layerStatusMetaPrefixRange.begin.toString() + "json/"; - Standalone jsonLayers = - wait(tr.getRange(KeyRangeRef(jsonPrefix, strinc(jsonPrefix)), 1000)); + RangeResult jsonLayers = wait(tr.getRange(KeyRangeRef(jsonPrefix, strinc(jsonPrefix)), 1000)); // TODO: Also fetch other linked subtrees of meta keys - state std::vector>> docFutures; + state std::vector> docFutures; state int i; for (i = 0; i < jsonLayers.size(); ++i) docFutures.push_back( @@ -2536,7 +2533,7 @@ ACTOR Future layerStatusFetcher(Database cx, JSONDoc::expires_reference_version = (uint64_t)tr.getReadVersion().get(); for (i = 0; i < docFutures.size(); ++i) { - state Standalone docs = wait(docFutures[i]); + state RangeResult docs = wait(docFutures[i]); state int j; for (j = 0; j < docs.size(); ++j) { state json_spirit::mValue doc; @@ -2629,8 +2626,7 @@ ACTOR Future> getActivePrimaryDC(Database cx, int* fullyReplicat } tr.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); - state Future> fReplicaKeys = - tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY); + state Future fReplicaKeys = tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY); state Future> fPrimaryDatacenterKey = tr.get(primaryDatacenterKey); wait(timeoutError(success(fPrimaryDatacenterKey) && success(fReplicaKeys), 5)); diff --git a/fdbserver/StorageCache.actor.cpp b/fdbserver/StorageCache.actor.cpp index b084f52896..d758e32bf3 100644 --- a/fdbserver/StorageCache.actor.cpp +++ b/fdbserver/StorageCache.actor.cpp @@ -1174,13 +1174,13 @@ void coalesceCacheRanges(StorageCacheData* data, KeyRangeRef keys) { } } -ACTOR Future> tryFetchRange(Database cx, - Version version, - KeyRangeRef keys, - GetRangeLimits limits, - bool* isTooOld) { +ACTOR Future tryFetchRange(Database cx, + Version version, + KeyRangeRef keys, + GetRangeLimits limits, + bool* isTooOld) { state Transaction tr(cx); - state Standalone output; + state RangeResult output; state KeySelectorRef begin = firstGreaterOrEqual(keys.begin); state KeySelectorRef end = firstGreaterOrEqual(keys.end); @@ -1194,7 +1194,7 @@ ACTOR Future> tryFetchRange(Database cx, try { loop { - Standalone rep = wait(tr.getRange(begin, end, limits, true)); + RangeResult rep = wait(tr.getRange(begin, end, limits, true)); limits.decrement(rep); if (limits.isReached() || !rep.more) { @@ -1317,7 +1317,7 @@ ACTOR Future fetchKeys(StorageCacheData* data, AddingCacheRange* cacheRang try { TEST(true); // Fetching keys for transferred cacheRange - state Standalone this_block = + state RangeResult this_block = wait(tryFetchRange(data->cx, fetchVersion, keys, @@ -1367,7 +1367,7 @@ ACTOR Future fetchKeys(StorageCacheData* data, AddingCacheRange* cacheRang throw please_reboot(); } - this_block = Standalone(); + this_block = RangeResult(); if (BUGGIFY) wait(delay(1)); @@ -2099,7 +2099,7 @@ ACTOR Future storageCacheStartUpWarmup(StorageCacheData* self) { tr.setOption(FDBTransactionOptions::READ_LOCK_AWARE); tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); try { - Standalone range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!range.more); readVersion = tr.getReadVersion().get(); bool currCached = false; diff --git a/fdbserver/TLogServer.actor.cpp b/fdbserver/TLogServer.actor.cpp index 1561b2f81f..a7d2b031d0 100644 --- a/fdbserver/TLogServer.actor.cpp +++ b/fdbserver/TLogServer.actor.cpp @@ -867,7 +867,7 @@ ACTOR Future updatePoppedLocation(TLogData* self, Reference logDa // us to remove data that still is pointed to by SpilledData in the btree. if (data->persistentPopped <= logData->persistentDataVersion) { // Recover the next needed location in the Disk Queue from the index. - Standalone kvrefs = wait(self->persistentData->readRange( + RangeResult kvrefs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessageRefsKey(logData->logId, data->tag, data->persistentPopped), persistTagMessageRefsKey(logData->logId, data->tag, logData->persistentDataVersion + 1)), 1)); @@ -1741,7 +1741,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen } if (logData->shouldSpillByValue(req.tag)) { - Standalone kvs = wait(self->persistentData->readRange( + RangeResult kvs = wait(self->persistentData->readRange( KeyRangeRef(persistTagMessagesKey(logData->logId, req.tag, req.begin), persistTagMessagesKey(logData->logId, req.tag, logData->persistentDataDurableVersion + 1)), SERVER_KNOBS->DESIRED_TOTAL_BYTES, @@ -1761,7 +1761,7 @@ ACTOR Future tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen } } else { // FIXME: Limit to approximately DESIRED_TOTATL_BYTES somehow. - Standalone kvrefs = wait(self->persistentData->readRange( + RangeResult kvrefs = wait(self->persistentData->readRange( KeyRangeRef( persistTagMessageRefsKey(logData->logId, req.tag, req.begin), persistTagMessageRefsKey(logData->logId, req.tag, logData->persistentDataDurableVersion + 1)), @@ -2741,14 +2741,14 @@ ACTOR Future restorePersistentState(TLogData* self, wait(storage->init()); state Future> fFormat = storage->readValue(persistFormat.key); state Future> fRecoveryLocation = storage->readValue(persistRecoveryLocationKey); - state Future> fVers = storage->readRange(persistCurrentVersionKeys); - state Future> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); - state Future> fLocality = storage->readRange(persistLocalityKeys); - state Future> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); - state Future> fTxsTags = storage->readRange(persistTxsTagsKeys); - state Future> fRecoverCounts = storage->readRange(persistRecoveryCountKeys); - state Future> fProtocolVersions = storage->readRange(persistProtocolVersionKeys); - state Future> fTLogSpillTypes = storage->readRange(persistTLogSpillTypeKeys); + state Future fVers = storage->readRange(persistCurrentVersionKeys); + state Future fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys); + state Future fLocality = storage->readRange(persistLocalityKeys); + state Future fLogRouterTags = storage->readRange(persistLogRouterTagsKeys); + state Future fTxsTags = storage->readRange(persistTxsTagsKeys); + state Future fRecoverCounts = storage->readRange(persistRecoveryCountKeys); + state Future fProtocolVersions = storage->readRange(persistProtocolVersionKeys); + state Future fTLogSpillTypes = storage->readRange(persistTLogSpillTypeKeys); // FIXME: metadata in queue? @@ -2776,8 +2776,7 @@ ACTOR Future restorePersistentState(TLogData* self, } if (!fFormat.get().present()) { - Standalone v = - wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); + RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1)); if (!v.size()) { TEST(true); // The DB is completely empty, so it was never initialized. Delete it. throw worker_removed(); @@ -2894,8 +2893,7 @@ ACTOR Future restorePersistentState(TLogData* self, loop { if (logData->removed.isReady()) break; - Standalone data = - wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); + RangeResult data = wait(self->persistentData->readRange(tagKeys, BUGGIFY ? 3 : 1 << 30, 1 << 20)); if (!data.size()) break; ((KeyRangeRef&)tagKeys) = KeyRangeRef(keyAfter(data.back().key, tagKeys.arena()), tagKeys.end); diff --git a/fdbserver/VersionedBTree.actor.cpp b/fdbserver/VersionedBTree.actor.cpp index d1c9ad77f0..57bb26dea7 100644 --- a/fdbserver/VersionedBTree.actor.cpp +++ b/fdbserver/VersionedBTree.actor.cpp @@ -6026,17 +6026,15 @@ public: m_tree->set(keyValue); } - Future> readRange(KeyRangeRef keys, - int rowLimit = 1 << 30, - int byteLimit = 1 << 30) override { + Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) override { debug_printf("READRANGE %s\n", printable(keys).c_str()); return catchError(readRange_impl(this, keys, rowLimit, byteLimit)); } - ACTOR static Future> readRange_impl(KeyValueStoreRedwoodUnversioned* self, - KeyRange keys, - int rowLimit, - int byteLimit) { + ACTOR static Future readRange_impl(KeyValueStoreRedwoodUnversioned* self, + KeyRange keys, + int rowLimit, + int byteLimit) { state VersionedBTree::BTreeCursor cur; wait(self->m_tree->initBTreeCursor(&cur, self->m_tree->getLastCommittedVersion())); @@ -6045,7 +6043,7 @@ public: state FlowLock::Releaser releaser(*readLock); ++g_redwoodMetrics.opGetRange; - state Standalone result; + state RangeResult result; state int accumulatedBytes = 0; ASSERT(byteLimit > 0); @@ -8687,7 +8685,7 @@ ACTOR Future randomRangeScans(IKeyValueStore* kvs, KeyRangeRef range = source.getKeyRangeRef(singlePrefix, suffixSize); int rowLim = (deterministicRandom()->randomInt(0, 2) != 0) ? rowLimit : -rowLimit; - Standalone result = wait(kvs->readRange(range, rowLim)); + RangeResult result = wait(kvs->readRange(range, rowLim)); recordsRead += result.size(); bytesRead += result.size() * recordSize; diff --git a/fdbserver/fdbserver.actor.cpp b/fdbserver/fdbserver.actor.cpp index 3b0fc8b180..ac75e87947 100644 --- a/fdbserver/fdbserver.actor.cpp +++ b/fdbserver/fdbserver.actor.cpp @@ -436,7 +436,7 @@ ACTOR Future dumpDatabase(Database cx, std::string outputFilename, KeyRang fprintf(output, "

Database version: %" PRId64 "

", ver); loop { - Standalone results = wait(tr.getRange(iter, firstGreaterOrEqual(range.end), 1000)); + RangeResult results = wait(tr.getRange(iter, firstGreaterOrEqual(range.end), 1000)); for (int r = 0; r < results.size(); r++) { std::string key = toHTML(results[r].key), value = toHTML(results[r].value); fprintf(output, "

%s := %s

\n", key.c_str(), value.c_str()); diff --git a/fdbserver/masterserver.actor.cpp b/fdbserver/masterserver.actor.cpp index a5f6ed7b75..41c5159832 100644 --- a/fdbserver/masterserver.actor.cpp +++ b/fdbserver/masterserver.actor.cpp @@ -825,7 +825,7 @@ ACTOR Future readTransactionSystemState(Reference self, .detail("LastEpochEnd", self->lastEpochEnd) .detail("RecoveryTransactionVersion", self->recoveryTransactionVersion); - Standalone rawConf = wait(self->txnStateStore->readRange(configKeys)); + RangeResult rawConf = wait(self->txnStateStore->readRange(configKeys)); self->configuration.fromKeyValues(rawConf.castTo>()); self->originalConfiguration = self->configuration; self->hasConfiguration = true; @@ -836,13 +836,13 @@ ACTOR Future readTransactionSystemState(Reference self, .detail("Conf", self->configuration.toString()) .trackLatest("RecoveredConfig"); - Standalone rawLocalities = wait(self->txnStateStore->readRange(tagLocalityListKeys)); + RangeResult rawLocalities = wait(self->txnStateStore->readRange(tagLocalityListKeys)); self->dcId_locality.clear(); for (auto& kv : rawLocalities) { self->dcId_locality[decodeTagLocalityListKey(kv.key)] = decodeTagLocalityListValue(kv.value); } - Standalone rawTags = wait(self->txnStateStore->readRange(serverTagKeys)); + RangeResult rawTags = wait(self->txnStateStore->readRange(serverTagKeys)); self->allTags.clear(); if (self->lastEpochEnd > 0) { self->allTags.push_back(cacheTag); @@ -862,7 +862,7 @@ ACTOR Future readTransactionSystemState(Reference self, } } - Standalone rawHistoryTags = wait(self->txnStateStore->readRange(serverTagHistoryKeys)); + RangeResult rawHistoryTags = wait(self->txnStateStore->readRange(serverTagHistoryKeys)); for (auto& kv : rawHistoryTags) { self->allTags.push_back(decodeServerTagValue(kv.value)); } @@ -888,7 +888,7 @@ ACTOR Future sendInitialCommitToResolvers(Reference self) { state Sequence txnSequence = 0; ASSERT(self->recoveryTransactionVersion); - state Standalone data = + state RangeResult data = self->txnStateStore ->readRange(txnKeys, BUGGIFY ? 3 : SERVER_KNOBS->DESIRED_TOTAL_BYTES, SERVER_KNOBS->DESIRED_TOTAL_BYTES) .get(); @@ -904,7 +904,7 @@ ACTOR Future sendInitialCommitToResolvers(Reference self) { if (!data.size()) break; ((KeyRangeRef&)txnKeys) = KeyRangeRef(keyAfter(data.back().key, txnKeys.arena()), txnKeys.end); - Standalone nextData = + RangeResult nextData = self->txnStateStore ->readRange(txnKeys, BUGGIFY ? 3 : SERVER_KNOBS->DESIRED_TOTAL_BYTES, SERVER_KNOBS->DESIRED_TOTAL_BYTES) .get(); @@ -1483,7 +1483,7 @@ ACTOR Future configurationMonitor(Reference self, Database cx) loop { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - Standalone results = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult results = wait(tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!results.more && results.size() < CLIENT_KNOBS->TOO_MANY); DatabaseConfiguration conf; diff --git a/fdbserver/pubsub.actor.cpp b/fdbserver/pubsub.actor.cpp index 8931d7bd47..3f88c93b47 100644 --- a/fdbserver/pubsub.actor.cpp +++ b/fdbserver/pubsub.actor.cpp @@ -212,7 +212,7 @@ ACTOR Future updateFeedWatchers(Transaction* tr, uint64_t feed) { state bool first = true; loop { // Grab watching inboxes in swaths of 100 - state Standalone watchingInboxes = + state RangeResult watchingInboxes = wait((*tr).getRange(firstGreaterOrEqual(keyForFeedWatcher(feed, first ? 0 : highestInbox + 1)), firstGreaterOrEqual(keyForFeedWatcher(feed, UINT64_MAX)), 100)); // REVIEW: does 100 make sense? @@ -260,7 +260,7 @@ ACTOR Future _postMessage(Database cx, uint64_t feed, Standalone latestMessage = wait( + state RangeResult latestMessage = wait( tr.getRange(firstGreaterOrEqual(keyForMessage(0)), firstGreaterOrEqual(keyForMessage(UINT64_MAX)), 1)); if (!latestMessage.size()) { messageId = UINT64_MAX - 1; @@ -317,7 +317,7 @@ ACTOR Future singlePassInboxCacheUpdate(Database cx, uint64_t inbox, int sw loop { try { // For each stale feed, update cache with latest message id - state Standalone staleFeeds = + state RangeResult staleFeeds = wait(tr.getRange(firstGreaterOrEqual(keyForInboxStaleFeed(inbox, 0)), firstGreaterOrEqual(keyForInboxStaleFeed(inbox, UINT64_MAX)), swath)); // REVIEW: does 100 make sense? @@ -376,10 +376,9 @@ ACTOR Future updateInboxCache(Database cx, uint64_t inbox) { } ACTOR Future getFeedLatestAtOrAfter(Transaction* tr, Feed feed, MessageId position) { - state Standalone lastMessageRange = - wait((*tr).getRange(firstGreaterOrEqual(keyForFeedMessage(feed, position)), - firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)), - 1)); + state RangeResult lastMessageRange = wait((*tr).getRange(firstGreaterOrEqual(keyForFeedMessage(feed, position)), + firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)), + 1)); if (!lastMessageRange.size()) return uint64_t(0); KeyValueRef m = lastMessageRange[0]; @@ -413,10 +412,9 @@ ACTOR Future> _listInboxMessages(Database cx, uint64_t inbo // Fetch all cached entries for all the feeds to which we are subscribed Optional cntValue = wait(tr.get(keyForInboxSubcriptionCount(inbox))); uint64_t subscriptions = valueToUInt64(cntValue.get()); - state Standalone feeds = - wait(tr.getRange(firstGreaterOrEqual(keyForInboxCacheByID(inbox, 0)), - firstGreaterOrEqual(keyForInboxCacheByID(inbox, UINT64_MAX)), - subscriptions)); + state RangeResult feeds = wait(tr.getRange(firstGreaterOrEqual(keyForInboxCacheByID(inbox, 0)), + firstGreaterOrEqual(keyForInboxCacheByID(inbox, UINT64_MAX)), + subscriptions)); if (!feeds.size()) return messages; @@ -444,10 +442,9 @@ ACTOR Future> _listInboxMessages(Database cx, uint64_t inbo // Check the list of dispatching messages to make sure there are no older ones than ours state MessageId earliestMessage = feedLatest.begin()->first; - Standalone dispatching = - wait(tr.getRange(firstGreaterOrEqual(keyForDisptchEntry(earliestMessage)), - firstGreaterOrEqual(keyForDisptchEntry(UINT64_MAX)), - 1)); + RangeResult dispatching = wait(tr.getRange(firstGreaterOrEqual(keyForDisptchEntry(earliestMessage)), + firstGreaterOrEqual(keyForDisptchEntry(UINT64_MAX)), + 1)); // If there are messages "older" than ours, try this again // (with a new transaction and a flush of the "stale" feeds if (dispatching.size()) { @@ -487,10 +484,9 @@ ACTOR Future> _listFeedMessages(Database cx, Feed feed, int TraceEvent("PubSubListFeed").detail("Feed", feed).detail("Count", count).detail("Cursor", cursor); loop { try { - state Standalone messageIds = - wait(tr.getRange(firstGreaterOrEqual(keyForFeedMessage(feed, cursor)), - firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)), - count)); + state RangeResult messageIds = wait(tr.getRange(firstGreaterOrEqual(keyForFeedMessage(feed, cursor)), + firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)), + count)); if (!messageIds.size()) return messages; diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 3fa7f20172..ad33ba8631 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -187,7 +187,7 @@ struct StorageServerDisk { Future> readValuePrefix(KeyRef key, int maxLength, Optional debugID = Optional()) { return storage->readValuePrefix(key, maxLength, debugID); } - Future> readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) { + Future readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) { return storage->readRange(keys, rowLimit, byteLimit); } @@ -202,7 +202,7 @@ private: void writeMutations(const VectorRef& mutations, Version debugVersion, const char* debugContext); ACTOR static Future readFirstKey(IKeyValueStore* storage, KeyRangeRef range) { - Standalone r = wait(storage->readRange(range, 1)); + RangeResult r = wait(storage->readRange(range, 1)); if (r.size()) return r[0].key; else @@ -1439,7 +1439,7 @@ ACTOR Future getShardStateQ(StorageServer* data, GetShardStateRequest req) void merge(Arena& arena, VectorRef& output, VectorRef const& vm_output, - Standalone const& base, + RangeResult const& base, int& vCount, int limit, bool stopAtEndOfBase, @@ -1557,7 +1557,7 @@ ACTOR Future readRange(StorageServer* data, // Read the data on disk up to vCurrent (or the end of the range) readEnd = vCurrent ? std::min(vCurrent.key(), range.end) : range.end; - Standalone atStorageVersion = + RangeResult atStorageVersion = wait(data->storage.readRange(KeyRangeRef(readBegin, readEnd), limit, *pLimitBytes)); ASSERT(atStorageVersion.size() <= limit); @@ -1638,7 +1638,7 @@ ACTOR Future readRange(StorageServer* data, readBegin = vCurrent ? std::max(vCurrent->isClearTo() ? vCurrent->getEndKey() : vCurrent.key(), range.begin) : range.begin; - Standalone atStorageVersion = + RangeResult atStorageVersion = wait(data->storage.readRange(KeyRangeRef(readBegin, readEnd), limit, *pLimitBytes)); ASSERT(atStorageVersion.size() <= -limit); @@ -2392,13 +2392,13 @@ void coalesceShards(StorageServer* data, KeyRangeRef keys) { } } -ACTOR Future> tryGetRange(Database cx, - Version version, - KeyRangeRef keys, - GetRangeLimits limits, - bool* isTooOld) { +ACTOR Future tryGetRange(Database cx, + Version version, + KeyRangeRef keys, + GetRangeLimits limits, + bool* isTooOld) { state Transaction tr(cx); - state Standalone output; + state RangeResult output; state KeySelectorRef begin = firstGreaterOrEqual(keys.begin); state KeySelectorRef end = firstGreaterOrEqual(keys.end); @@ -2412,7 +2412,7 @@ ACTOR Future> tryGetRange(Database cx, try { loop { - Standalone rep = wait(tr.getRange(begin, end, limits, true)); + RangeResult rep = wait(tr.getRange(begin, end, limits, true)); limits.decrement(rep); if (limits.isReached() || !rep.more) { @@ -2624,7 +2624,7 @@ ACTOR Future fetchKeys(StorageServer* data, AddingShard* shard) { try { TEST(true); // Fetching keys for transferred shard - state Standalone this_block = + state RangeResult this_block = wait(tryGetRange(data->cx, fetchVersion, keys, @@ -2701,7 +2701,7 @@ ACTOR Future fetchKeys(StorageServer* data, AddingShard* shard) { } } - this_block = Standalone(); + this_block = RangeResult(); if (BUGGIFY) wait(delay(1)); @@ -3819,7 +3819,7 @@ ACTOR Future applyByteSampleResult(StorageServer* data, state int totalKeys = 0; state int totalBytes = 0; loop { - Standalone bs = wait(storage->readRange( + RangeResult bs = wait(storage->readRange( KeyRangeRef(begin, end), SERVER_KNOBS->STORAGE_LIMIT_BYTES, SERVER_KNOBS->STORAGE_LIMIT_BYTES)); if (results) results->push_back(bs.castTo>()); @@ -3922,8 +3922,8 @@ ACTOR Future restoreDurableState(StorageServer* data, IKeyValueStore* stor state Future> fVersion = storage->readValue(persistVersion); state Future> fLogProtocol = storage->readValue(persistLogProtocol); state Future> fPrimaryLocality = storage->readValue(persistPrimaryLocality); - state Future> fShardAssigned = storage->readRange(persistShardAssignedKeys); - state Future> fShardAvailable = storage->readRange(persistShardAvailableKeys); + state Future fShardAssigned = storage->readRange(persistShardAssignedKeys); + state Future fShardAvailable = storage->readRange(persistShardAvailableKeys); state Promise byteSampleSampleRecovered; state Promise startByteSampleRestore; @@ -3963,7 +3963,7 @@ ACTOR Future restoreDurableState(StorageServer* data, IKeyValueStore* stor debug_checkRestoredVersion(data->thisServerID, version, "StorageServer"); data->setInitialVersion(version); - state Standalone available = fShardAvailable.get(); + state RangeResult available = fShardAvailable.get(); state int availableLoc; for (availableLoc = 0; availableLoc < available.size(); availableLoc++) { KeyRangeRef keys(available[availableLoc].key.removePrefix(persistShardAvailableKeys.begin), @@ -3978,7 +3978,7 @@ ACTOR Future restoreDurableState(StorageServer* data, IKeyValueStore* stor wait(yield()); } - state Standalone assigned = fShardAssigned.get(); + state RangeResult assigned = fShardAssigned.get(); state int assignedLoc; for (assignedLoc = 0; assignedLoc < assigned.size(); assignedLoc++) { KeyRangeRef keys(assigned[assignedLoc].key.removePrefix(persistShardAssignedKeys.begin), diff --git a/fdbserver/workloads/ApiCorrectness.actor.cpp b/fdbserver/workloads/ApiCorrectness.actor.cpp index 26df8c69c1..9aec6679c5 100644 --- a/fdbserver/workloads/ApiCorrectness.actor.cpp +++ b/fdbserver/workloads/ApiCorrectness.actor.cpp @@ -447,10 +447,10 @@ public: state bool reverse = deterministicRandom()->random01() > 0.5 ? false : true; // Get the range from memory - state Standalone storeResults = self->store.getRange(KeyRangeRef(start, end), limit, reverse); + state RangeResult storeResults = self->store.getRange(KeyRangeRef(start, end), limit, reverse); // Get the range from the database - state Standalone dbResults; + state RangeResult dbResults; state Version readVersion; state Reference transaction = self->createTransaction(); @@ -461,7 +461,7 @@ public: readVersion = version; KeyRangeRef range(start, end); - Standalone rangeResults = wait(transaction->getRange(range, limit, reverse)); + RangeResult rangeResults = wait(transaction->getRange(range, limit, reverse)); dbResults = rangeResults; break; } catch (Error& e) { @@ -533,11 +533,10 @@ public: state bool reverse = deterministicRandom()->random01() < 0.5 ? false : true; // Get the range from the memory store - state Standalone storeResults = - self->store.getRange(KeyRangeRef(startKey, endKey), limit, reverse); + state RangeResult storeResults = self->store.getRange(KeyRangeRef(startKey, endKey), limit, reverse); // Get the range from the database - state Standalone dbResults; + state RangeResult dbResults; state Reference transaction = self->createTransaction(); state Version readVersion; @@ -547,8 +546,7 @@ public: Version version = wait(transaction->getReadVersion()); readVersion = version; - Standalone range = - wait(transaction->getRange(startSelector, endSelector, limit, reverse)); + RangeResult range = wait(transaction->getRange(startSelector, endSelector, limit, reverse)); if (endKey == self->store.endKey()) { for (int i = 0; i < range.size(); i++) { diff --git a/fdbserver/workloads/ApiWorkload.actor.cpp b/fdbserver/workloads/ApiWorkload.actor.cpp index 42ecfee400..ad68076836 100644 --- a/fdbserver/workloads/ApiWorkload.actor.cpp +++ b/fdbserver/workloads/ApiWorkload.actor.cpp @@ -167,15 +167,14 @@ ACTOR Future compareDatabaseToMemory(ApiWorkload* self) { loop { // Fetch a subset of the results from each of the database and the memory store and compare them - state Standalone storeResults = - self->store.getRange(KeyRangeRef(startKey, endKey), resultsPerRange, false); + state RangeResult storeResults = self->store.getRange(KeyRangeRef(startKey, endKey), resultsPerRange, false); state Reference transaction = self->createTransaction(); state KeyRangeRef range(startKey, endKey); loop { try { - state Standalone dbResults = wait(transaction->getRange(range, resultsPerRange, false)); + state RangeResult dbResults = wait(transaction->getRange(range, resultsPerRange, false)); // Compare results of database and memory store Version v = wait(transaction->getReadVersion()); diff --git a/fdbserver/workloads/ApiWorkload.h b/fdbserver/workloads/ApiWorkload.h index 96f009c109..48eaab348a 100644 --- a/fdbserver/workloads/ApiWorkload.h +++ b/fdbserver/workloads/ApiWorkload.h @@ -46,13 +46,10 @@ struct TransactionWrapper : public ReferenceCounted { virtual Future> get(KeyRef& key) = 0; // Gets a range of key-value pairs from the database specified by a key range - virtual Future> getRange(KeyRangeRef& keys, int limit, bool reverse) = 0; + virtual Future getRange(KeyRangeRef& keys, int limit, bool reverse) = 0; // Gets a range of key-value pairs from the database specified by a pair of key selectors - virtual Future> getRange(KeySelectorRef& begin, - KeySelectorRef& end, - int limit, - bool reverse) = 0; + virtual Future getRange(KeySelectorRef& begin, KeySelectorRef& end, int limit, bool reverse) = 0; // Gets the key from the database specified by a given key selector virtual Future getKey(KeySelectorRef& key) = 0; @@ -104,15 +101,12 @@ struct FlowTransactionWrapper : public TransactionWrapper { Future> get(KeyRef& key) override { return transaction.get(key); } // Gets a range of key-value pairs from the database specified by a key range - Future> getRange(KeyRangeRef& keys, int limit, bool reverse) override { + Future getRange(KeyRangeRef& keys, int limit, bool reverse) override { return transaction.getRange(keys, limit, false, reverse); } // Gets a range of key-value pairs from the database specified by a pair of key selectors - Future> getRange(KeySelectorRef& begin, - KeySelectorRef& end, - int limit, - bool reverse) override { + Future getRange(KeySelectorRef& begin, KeySelectorRef& end, int limit, bool reverse) override { return transaction.getRange(begin, end, limit, false, reverse); } @@ -167,15 +161,12 @@ struct ThreadTransactionWrapper : public TransactionWrapper { Future> get(KeyRef& key) override { return unsafeThreadFutureToFuture(transaction->get(key)); } // Gets a range of key-value pairs from the database specified by a key range - Future> getRange(KeyRangeRef& keys, int limit, bool reverse) override { + Future getRange(KeyRangeRef& keys, int limit, bool reverse) override { return unsafeThreadFutureToFuture(transaction->getRange(keys, limit, false, reverse)); } // Gets a range of key-value pairs from the database specified by a pair of key selectors - Future> getRange(KeySelectorRef& begin, - KeySelectorRef& end, - int limit, - bool reverse) override { + Future getRange(KeySelectorRef& begin, KeySelectorRef& end, int limit, bool reverse) override { return unsafeThreadFutureToFuture(transaction->getRange(begin, end, limit, false, reverse)); } diff --git a/fdbserver/workloads/AtomicOps.actor.cpp b/fdbserver/workloads/AtomicOps.actor.cpp index 06eb3ad531..551c8c008f 100644 --- a/fdbserver/workloads/AtomicOps.actor.cpp +++ b/fdbserver/workloads/AtomicOps.actor.cpp @@ -148,8 +148,7 @@ struct AtomicOpsWorkload : TestWorkload { loop { try { Key begin(std::string("log")); - Standalone log = - wait(tr1.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult log = wait(tr1.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); if (!log.empty()) { TraceEvent(SevError, "AtomicOpSetup") .detail("LogKeySpace", "Not empty") @@ -230,8 +229,7 @@ struct AtomicOpsWorkload : TestWorkload { state ReadYourWritesTransaction tr(cx); try { Key begin(format("log%08x", g)); - Standalone log = - wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult log = wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); if (log.more) { TraceEvent(SevError, "LogHitTxnLimits").detail("Result", log.toString()); } @@ -257,8 +255,7 @@ struct AtomicOpsWorkload : TestWorkload { state ReadYourWritesTransaction tr(cx); try { Key begin(format("debug%08x", g)); - Standalone debuglog = - wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult debuglog = wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); if (debuglog.more) { TraceEvent(SevError, "DebugLogHitTxnLimits").detail("Result", debuglog.toString()); } @@ -276,8 +273,7 @@ struct AtomicOpsWorkload : TestWorkload { state ReadYourWritesTransaction tr(cx); try { Key begin(format("ops%08x", g)); - Standalone ops = - wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult ops = wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); if (ops.more) { TraceEvent(SevError, "OpsHitTxnLimits").detail("Result", ops.toString()); } @@ -303,8 +299,7 @@ struct AtomicOpsWorkload : TestWorkload { // Get mapping between opsKeys and debugKeys state ReadYourWritesTransaction tr1(cx); state std::map records; // - Standalone debuglog = - wait(tr1.getRange(prefixRange(format("debug%08x", g)), CLIENT_KNOBS->TOO_MANY)); + RangeResult debuglog = wait(tr1.getRange(prefixRange(format("debug%08x", g)), CLIENT_KNOBS->TOO_MANY)); if (debuglog.more) { TraceEvent(SevError, "DebugLogHitTxnLimits").detail("Result", debuglog.toString()); return Void(); @@ -316,7 +311,7 @@ struct AtomicOpsWorkload : TestWorkload { // Get log key's value and assign it to the associated debugKey state ReadYourWritesTransaction tr2(cx); state std::map logVal; // debugKey, log's value - Standalone log = wait(tr2.getRange(prefixRange(format("log%08x", g)), CLIENT_KNOBS->TOO_MANY)); + RangeResult log = wait(tr2.getRange(prefixRange(format("log%08x", g)), CLIENT_KNOBS->TOO_MANY)); if (log.more) { TraceEvent(SevError, "LogHitTxnLimits").detail("Result", log.toString()); return Void(); @@ -330,7 +325,7 @@ struct AtomicOpsWorkload : TestWorkload { // Get opsKeys and validate if it has correct value state ReadYourWritesTransaction tr3(cx); state std::map opsVal; // ops key, ops value - Standalone ops = wait(tr3.getRange(prefixRange(format("ops%08x", g)), CLIENT_KNOBS->TOO_MANY)); + RangeResult ops = wait(tr3.getRange(prefixRange(format("ops%08x", g)), CLIENT_KNOBS->TOO_MANY)); if (ops.more) { TraceEvent(SevError, "OpsHitTxnLimits").detail("Result", ops.toString()); return Void(); @@ -368,14 +363,13 @@ struct AtomicOpsWorkload : TestWorkload { state bool ret = true; for (; g < 100; g++) { state ReadYourWritesTransaction tr(cx); - state Standalone log; + state RangeResult log; loop { try { { // Calculate the accumulated value in the log keyspace for the group g Key begin(format("log%08x", g)); - Standalone log_ = - wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult log_ = wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); log = log_; uint64_t zeroValue = 0; tr.set(LiteralStringRef("xlogResult"), @@ -390,8 +384,7 @@ struct AtomicOpsWorkload : TestWorkload { { // Calculate the accumulated value in the ops keyspace for the group g Key begin(format("ops%08x", g)); - Standalone ops = - wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); + RangeResult ops = wait(tr.getRange(KeyRangeRef(begin, strinc(begin)), CLIENT_KNOBS->TOO_MANY)); uint64_t zeroValue = 0; tr.set(LiteralStringRef("xopsResult"), StringRef((const uint8_t*)&zeroValue, sizeof(zeroValue))); diff --git a/fdbserver/workloads/AtomicSwitchover.actor.cpp b/fdbserver/workloads/AtomicSwitchover.actor.cpp index 874b1ed331..4c227f4cd0 100644 --- a/fdbserver/workloads/AtomicSwitchover.actor.cpp +++ b/fdbserver/workloads/AtomicSwitchover.actor.cpp @@ -92,9 +92,8 @@ struct AtomicSwitchoverWorkload : TestWorkload { state Transaction tr2(dest); try { loop { - state Future> srcFuture = - tr.getRange(KeyRangeRef(begin, range.end), 1000); - state Future> bkpFuture = + state Future srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000); + state Future bkpFuture = tr2.getRange(KeyRangeRef(begin, range.end).withPrefix(backupPrefix), 1000); wait(success(srcFuture) && success(bkpFuture)); diff --git a/fdbserver/workloads/BackgroundSelectors.actor.cpp b/fdbserver/workloads/BackgroundSelectors.actor.cpp index 874dceaa01..4c3fca31c5 100644 --- a/fdbserver/workloads/BackgroundSelectors.actor.cpp +++ b/fdbserver/workloads/BackgroundSelectors.actor.cpp @@ -87,7 +87,7 @@ struct BackgroundSelectorWorkload : TestWorkload { state Key endKey; state int diff; state Transaction tr(cx); - state Standalone rangeResult; + state RangeResult rangeResult; state Standalone startResult; state Standalone endResult; state int startDrift; @@ -148,7 +148,7 @@ struct BackgroundSelectorWorkload : TestWorkload { loop { try { if (diff < 0) { - Standalone rangeResult_ = + RangeResult rangeResult_ = wait(tr.getRange(randomizedSelector(endKey, true, endDrift), randomizedSelector(startKey, true, startDrift + 1), self->resultLimit)); @@ -160,10 +160,9 @@ struct BackgroundSelectorWorkload : TestWorkload { wait(tr.getKey(randomizedSelector(endKey, true, endDrift))); startResult = startResult_; } else { - Standalone rangeResult_ = - wait(tr.getRange(randomizedSelector(startKey, true, startDrift), - randomizedSelector(endKey, true, endDrift + 1), - self->resultLimit)); + RangeResult rangeResult_ = wait(tr.getRange(randomizedSelector(startKey, true, startDrift), + randomizedSelector(endKey, true, endDrift + 1), + self->resultLimit)); rangeResult = rangeResult_; Standalone startResult_ = wait(tr.getKey(randomizedSelector(startKey, true, startDrift))); diff --git a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp index cbbe52f64a..5df80491b4 100644 --- a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp @@ -360,7 +360,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload { state int rowCount = 0; loop { try { - Standalone existingRows = wait(tr.getRange(normalKeys, 1)); + RangeResult existingRows = wait(tr.getRange(normalKeys, 1)); rowCount = existingRows.size(); break; } catch (Error& e) { @@ -696,7 +696,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload { printf("BackupCorrectnessLeftOverLogTasks: %ld\n", (long)taskCount); } - Standalone agentValues = + RangeResult agentValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupAgentKey, strinc(backupAgentKey))), 100)); // Error if the system keyspace for the backup tag is not empty @@ -731,10 +731,10 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload { printf("No left over backup version key\n"); } - Standalone versions = wait(tr->getRange( + RangeResult versions = wait(tr->getRange( KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1)); if (!self->shareLogRange || !versions.size()) { - Standalone logValues = wait( + RangeResult logValues = wait( tr->getRange(KeyRange(KeyRangeRef(backupLogValuesKey, strinc(backupLogValuesKey))), 100)); // Error if the log/mutation keyspace for the backup tag is not empty diff --git a/fdbserver/workloads/BackupCorrectness.actor.cpp b/fdbserver/workloads/BackupCorrectness.actor.cpp index 98c528a2be..abd3609325 100644 --- a/fdbserver/workloads/BackupCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupCorrectness.actor.cpp @@ -187,7 +187,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { for (restoreIndex = 0; restoreIndex < self->skippedRestoreRanges.size(); restoreIndex++) { state KeyRangeRef range = self->skippedRestoreRanges[restoreIndex]; Standalone restoreTag(self->backupTag.toString() + "_" + std::to_string(restoreIndex)); - Standalone res = wait(tr.getRange(range, GetRangeLimits::ROW_LIMIT_UNLIMITED)); + RangeResult res = wait(tr.getRange(range, GetRangeLimits::ROW_LIMIT_UNLIMITED)); if (!res.empty()) { TraceEvent(SevError, "BARW_UnexpectedRangePresent").detail("Range", printable(range)); return false; @@ -400,7 +400,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { state int rowCount = 0; loop { try { - Standalone existingRows = wait(tr.getRange(normalKeys, 1)); + RangeResult existingRows = wait(tr.getRange(normalKeys, 1)); rowCount = existingRows.size(); break; } catch (Error& e) { @@ -756,7 +756,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { printf("BackupCorrectnessLeftOverLogTasks: %ld\n", (long)taskCount); } - Standalone agentValues = + RangeResult agentValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupAgentKey, strinc(backupAgentKey))), 100)); // Error if the system keyspace for the backup tag is not empty @@ -791,10 +791,10 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { printf("No left over backup version key\n"); } - Standalone versions = wait(tr->getRange( + RangeResult versions = wait(tr->getRange( KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1)); if (!self->shareLogRange || !versions.size()) { - Standalone logValues = wait( + RangeResult logValues = wait( tr->getRange(KeyRange(KeyRangeRef(backupLogValuesKey, strinc(backupLogValuesKey))), 100)); // Error if the log/mutation keyspace for the backup tag is not empty diff --git a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp index dadf47c96b..6988908633 100644 --- a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp @@ -148,19 +148,19 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { void getMetrics(vector& m) override {} // Reads a series of key ranges and returns each range. - ACTOR static Future>> readRanges(Database cx, - Standalone> ranges, - StringRef removePrefix) { + ACTOR static Future> readRanges(Database cx, + Standalone> ranges, + StringRef removePrefix) { loop { state Transaction tr(cx); try { - state std::vector>> results; + state std::vector> results; for (auto& range : ranges) { results.push_back(tr.getRange(range.removePrefix(removePrefix), 1000)); } wait(waitForAll(results)); - std::vector> ret; + std::vector ret; for (auto result : results) { ret.push_back(result.get()); } @@ -184,9 +184,8 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { state Transaction tr2(dest); try { loop { - state Future> srcFuture = - tr.getRange(KeyRangeRef(begin, range.end), 1000); - state Future> bkpFuture = + state Future srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000); + state Future bkpFuture = tr2.getRange(KeyRangeRef(begin, range.end).withPrefix(backupPrefix), 1000); wait(success(srcFuture) && success(bkpFuture)); @@ -472,7 +471,7 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { printf("BackupCorrectnessLeftoverLogTasks: %ld\n", (long)taskCount); } - Standalone agentValues = + RangeResult agentValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupAgentKey, strinc(backupAgentKey))), 100)); // Error if the system keyspace for the backup tag is not empty @@ -507,10 +506,10 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { printf("No left over backup version key\n"); } - Standalone versions = wait( + RangeResult versions = wait( tr->getRange(KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1)); if (!shareLogRange || !versions.size()) { - Standalone logValues = + RangeResult logValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupLogValuesKey, strinc(backupLogValuesKey))), 100)); // Error if the log/mutation keyspace for the backup tag is not empty @@ -671,9 +670,9 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { // Make sure no more data is written to the restored range // after the restore completes. - state std::vector> res1 = wait(readRanges(cx, restoreRange, self->backupPrefix)); + state std::vector res1 = wait(readRanges(cx, restoreRange, self->backupPrefix)); wait(delay(5)); - state std::vector> res2 = wait(readRanges(cx, restoreRange, self->backupPrefix)); + state std::vector res2 = wait(readRanges(cx, restoreRange, self->backupPrefix)); ASSERT(res1.size() == res2.size()); for (int i = 0; i < res1.size(); ++i) { auto range1 = res1.at(i); diff --git a/fdbserver/workloads/BackupToDBUpgrade.actor.cpp b/fdbserver/workloads/BackupToDBUpgrade.actor.cpp index 76d596cdbf..a7e3807fce 100644 --- a/fdbserver/workloads/BackupToDBUpgrade.actor.cpp +++ b/fdbserver/workloads/BackupToDBUpgrade.actor.cpp @@ -204,7 +204,7 @@ struct BackupToDBUpgradeWorkload : TestWorkload { printf("BackupCorrectnessLeftoverLogTasks: %ld\n", (long)taskCount); } - Standalone agentValues = + RangeResult agentValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupAgentKey, strinc(backupAgentKey))), 100)); // Error if the system keyspace for the backup tag is not empty @@ -239,10 +239,10 @@ struct BackupToDBUpgradeWorkload : TestWorkload { printf("No left over backup version key\n"); } - Standalone versions = wait( + RangeResult versions = wait( tr->getRange(KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1)); if (!versions.size()) { - Standalone logValues = + RangeResult logValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupLogValuesKey, strinc(backupLogValuesKey))), 100)); // Error if the log/mutation keyspace for the backup tag is not empty @@ -321,9 +321,8 @@ struct BackupToDBUpgradeWorkload : TestWorkload { loop { tr.setOption(FDBTransactionOptions::LOCK_AWARE); tr2.setOption(FDBTransactionOptions::LOCK_AWARE); - state Future> srcFuture = - tr.getRange(KeyRangeRef(begin, range.end), 1000); - state Future> bkpFuture = + state Future srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000); + state Future bkpFuture = tr2.getRange(KeyRangeRef(begin, range.end).withPrefix(backupPrefix), 1000); wait(success(srcFuture) && success(bkpFuture)); diff --git a/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp b/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp index 5c99263f58..616986fc23 100644 --- a/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp +++ b/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp @@ -217,7 +217,7 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload { std::string getTrId(KeyRef key) const { return key.substr(trIdStartIndex, trIdFormatSize).toString(); } - bool checkTxInfoEntriesFormat(const Standalone& txInfoEntries) { + bool checkTxInfoEntriesFormat(const RangeResult& txInfoEntries) { std::string val; std::map> trInfoChunks; for (auto kv : txInfoEntries) { @@ -288,7 +288,7 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload { state Key clientLatencyAtomicCtr = CLIENT_LATENCY_INFO_CTR_PREFIX.withPrefix(fdbClientInfoPrefixRange.begin); state int64_t counter; - state Standalone txInfoEntries; + state RangeResult txInfoEntries; Optional ctrValue = wait(runRYWTransaction(cx, [=](Reference tr) -> Future> { tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); @@ -307,7 +307,7 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - state Standalone kvRange = wait(tr.getRange(begin, end, keysLimit)); + state RangeResult kvRange = wait(tr.getRange(begin, end, keysLimit)); if (kvRange.empty()) break; txInfoEntries.arena().dependsOn(kvRange.arena()); diff --git a/fdbserver/workloads/ConflictRange.actor.cpp b/fdbserver/workloads/ConflictRange.actor.cpp index e9f342a26b..061a93289e 100644 --- a/fdbserver/workloads/ConflictRange.actor.cpp +++ b/fdbserver/workloads/ConflictRange.actor.cpp @@ -82,7 +82,7 @@ struct ConflictRangeWorkload : TestWorkload { state int randomLimit; state bool randomSets = false; state std::set insertedSet; - state Standalone originalResults; + state RangeResult originalResults; state Standalone firstElement; state std::set clearedSet; @@ -154,10 +154,9 @@ struct ConflictRangeWorkload : TestWorkload { offsetB = deterministicRandom()->randomInt(-1 * self->maxOffset, self->maxOffset); randomLimit = deterministicRandom()->randomInt(1, self->maxKeySpace); - Standalone res = - wait(tr1.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), - KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), - randomLimit)); + RangeResult res = wait(tr1.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), + KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), + randomLimit)); if (res.size()) { originalResults = res; break; @@ -219,17 +218,15 @@ struct ConflictRangeWorkload : TestWorkload { if (self->testReadYourWrites) { trRYOW.clear(KeyRangeRef(StringRef(format("%010d", clearedBegin)), StringRef(format("%010d", clearedEnd)))); - Standalone res = - wait(trRYOW.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), - KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), - randomLimit)); + RangeResult res = wait(trRYOW.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), + KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), + randomLimit)); wait(trRYOW.commit()); } else { tr3.clear(StringRef(format("%010d", self->maxKeySpace + 1))); - Standalone res = - wait(tr3.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), - KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), - randomLimit)); + RangeResult res = wait(tr3.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), + KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), + randomLimit)); wait(tr3.commit()); } } catch (Error& e) { @@ -248,10 +245,9 @@ struct ConflictRangeWorkload : TestWorkload { tr1 = Transaction(cx); } - Standalone res = - wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), - KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), - randomLimit)); + RangeResult res = wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), + KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), + randomLimit)); ++self->withConflicts; if (res.size() == originalResults.size()) { @@ -312,7 +308,7 @@ struct ConflictRangeWorkload : TestWorkload { .detail("Original", keyStr2); tr4 = Transaction(cx); - Standalone res = wait(tr4.getRange( + RangeResult res = wait(tr4.getRange( KeyRangeRef(StringRef(format("%010d", 0)), StringRef(format("%010d", self->maxKeySpace))), 200)); std::string allKeyEntries = ""; @@ -325,10 +321,9 @@ struct ConflictRangeWorkload : TestWorkload { throw not_committed(); } else { // If the commit is successful, check that the result matches the first execution. - Standalone res = - wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), - KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), - randomLimit)); + RangeResult res = wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), + KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), + randomLimit)); ++self->withoutConflicts; if (res.size() == originalResults.size()) { diff --git a/fdbserver/workloads/ConsistencyCheck.actor.cpp b/fdbserver/workloads/ConsistencyCheck.actor.cpp index 60ab7a3585..722e1f5e6e 100644 --- a/fdbserver/workloads/ConsistencyCheck.actor.cpp +++ b/fdbserver/workloads/ConsistencyCheck.actor.cpp @@ -210,7 +210,7 @@ struct ConsistencyCheckWorkload : TestWorkload { tr.setOption(FDBTransactionOptions::LOCK_AWARE); loop { try { - Standalone res = wait(tr.getRange(configKeys, 1000)); + RangeResult res = wait(tr.getRange(configKeys, 1000)); if (res.size() == 1000) { TraceEvent("ConsistencyCheck_TooManyConfigOptions"); self->testFailure("Read too many configuration options"); @@ -984,7 +984,7 @@ struct ConsistencyCheckWorkload : TestWorkload { } auto keyValueResponse = keyValueFutures[firstValidStorageServer].get().get(); - Standalone currentLocations = krmDecodeRanges( + RangeResult currentLocations = krmDecodeRanges( keyServersPrefix, KeyRangeRef(beginKey.removePrefix(keyServersPrefix), std::min(shards[i].first.end, endKey).removePrefix(keyServersPrefix)), @@ -1174,7 +1174,7 @@ struct ConsistencyCheckWorkload : TestWorkload { tr.setOption(FDBTransactionOptions::LOCK_AWARE); state int bytesReadInRange = 0; - Standalone UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult UIDtoTagMap = wait(tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY)); ASSERT(!UIDtoTagMap.more && UIDtoTagMap.size() < CLIENT_KNOBS->TOO_MANY); decodeKeyServersValue( UIDtoTagMap, keyLocations[shard].value, sourceStorageServers, destStorageServers, false); diff --git a/fdbserver/workloads/Cycle.actor.cpp b/fdbserver/workloads/Cycle.actor.cpp index 2e5306f303..c80b2348f7 100644 --- a/fdbserver/workloads/Cycle.actor.cpp +++ b/fdbserver/workloads/Cycle.actor.cpp @@ -250,10 +250,9 @@ struct CycleWorkload : TestWorkload { loop { try { state Version v = wait(tr.getReadVersion()); - Standalone data = - wait(tr.getRange(firstGreaterOrEqual(doubleToTestKey(0.0, self->keyPrefix)), - firstGreaterOrEqual(doubleToTestKey(1.0, self->keyPrefix)), - self->nodeCount + 1)); + RangeResult data = wait(tr.getRange(firstGreaterOrEqual(doubleToTestKey(0.0, self->keyPrefix)), + firstGreaterOrEqual(doubleToTestKey(1.0, self->keyPrefix)), + self->nodeCount + 1)); ok = self->cycleCheckData(data, v) && ok; break; } catch (Error& e) { diff --git a/fdbserver/workloads/DataDistributionMetrics.actor.cpp b/fdbserver/workloads/DataDistributionMetrics.actor.cpp index 4db2807fd0..09e2c82301 100644 --- a/fdbserver/workloads/DataDistributionMetrics.actor.cpp +++ b/fdbserver/workloads/DataDistributionMetrics.actor.cpp @@ -88,8 +88,7 @@ struct DataDistributionMetricsWorkload : KVWorkload { // the range. If we didn't read through the end of the range, then the second last key // in the result will be the last key less than endKey. (Condition #2) state KeySelector end = KeySelectorRef(endKey.withPrefix(ddStatsRange.begin, endKey.arena()), false, 2); - Standalone result = - wait(tr->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->SHARD_COUNT_LIMIT))); + RangeResult result = wait(tr->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->SHARD_COUNT_LIMIT))); // Condition #1 and #2 can be broken if multiple rpc calls happened in one getRange if (result.size() > 1) { if (result[0].key > begin.getKey() || result[1].key <= begin.getKey()) { @@ -141,7 +140,7 @@ struct DataDistributionMetricsWorkload : KVWorkload { // wait(quietDatabase(cx, self->dbInfo, "PopulateTPCC")); state Reference tr = makeReference(cx); try { - state Standalone result = wait(tr->getRange(ddStatsRange, CLIENT_KNOBS->SHARD_COUNT_LIMIT)); + state RangeResult result = wait(tr->getRange(ddStatsRange, CLIENT_KNOBS->SHARD_COUNT_LIMIT)); ASSERT(!result.more); self->numShards = result.size(); if (self->numShards < 1) @@ -165,7 +164,7 @@ struct DataDistributionMetricsWorkload : KVWorkload { // fetch data-distribution stats for a smaller range ASSERT(result.size()); state int idx = deterministicRandom()->randomInt(0, result.size()); - Standalone res = wait(tr->getRange( + RangeResult res = wait(tr->getRange( KeyRangeRef(result[idx].key, idx + 1 < result.size() ? result[idx + 1].key : ddStatsRange.end), 100)); ASSERT_WE_THINK(res.size() == 1 && res[0] == result[idx]); // It works good now. However, not sure in any // case of data-distribution, the number changes diff --git a/fdbserver/workloads/DiskDurabilityTest.actor.cpp b/fdbserver/workloads/DiskDurabilityTest.actor.cpp index 563b2f2e8b..262910e290 100644 --- a/fdbserver/workloads/DiskDurabilityTest.actor.cpp +++ b/fdbserver/workloads/DiskDurabilityTest.actor.cpp @@ -89,7 +89,7 @@ struct DiskDurabilityTest : TestWorkload { state Transaction tr(db); loop { try { - state Standalone r = wait(tr.getRange(self->range, GetRangeLimits(1000000))); + state RangeResult r = wait(tr.getRange(self->range, GetRangeLimits(1000000))); verifyPages = r.size(); state int i; for (i = 0; i < r.size(); i++) { diff --git a/fdbserver/workloads/FileSystem.actor.cpp b/fdbserver/workloads/FileSystem.actor.cpp index 4b57a5ad0d..1b8b3d86e7 100644 --- a/fdbserver/workloads/FileSystem.actor.cpp +++ b/fdbserver/workloads/FileSystem.actor.cpp @@ -280,8 +280,7 @@ struct FileSystemWorkload : TestWorkload { if (self->loggingQueries) TraceEvent("UserQuery").detail("UserID", userID).detail("PathBase", base); Key keyEnd(base + "/updated0"); - Standalone val = - wait(tr->getRange(firstGreaterOrEqual(keyEnd) - 10, firstGreaterOrEqual(keyEnd), 10)); + RangeResult val = wait(tr->getRange(firstGreaterOrEqual(keyEnd) - 10, firstGreaterOrEqual(keyEnd), 10)); Key keyBegin(base + "/updated/"); for (int i = val.size() - 1; i >= 0; i--) { if (val[i].key.startsWith(keyBegin) && self->loggingQueries) { @@ -308,7 +307,7 @@ struct FileSystemWorkload : TestWorkload { state int transferSize = 1000; state uint64_t deletedFiles = 0; while (transfered == transferSize) { - Standalone val = wait(tr->getRange(begin, end, transferSize)); + RangeResult val = wait(tr->getRange(begin, end, transferSize)); transfered = val.size(); deletedFiles += transfered; begin = begin + transfered; diff --git a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp index 83f6f32405..9e7176d85f 100644 --- a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp +++ b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp @@ -679,8 +679,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload { } }; - struct TestGetRange0 : public BaseTest> { - typedef BaseTest> base_type; + struct TestGetRange0 : public BaseTest { + typedef BaseTest base_type; KeySelector keysel1, keysel2; int limit; @@ -730,8 +730,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload { } }; - struct TestGetRange1 : public BaseTest> { - typedef BaseTest> base_type; + struct TestGetRange1 : public BaseTest { + typedef BaseTest base_type; KeySelector keysel1, keysel2; GetRangeLimits limits; @@ -776,8 +776,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload { } }; - struct TestGetRange2 : public BaseTest> { - typedef BaseTest> base_type; + struct TestGetRange2 : public BaseTest { + typedef BaseTest base_type; Key key1, key2; int limit; @@ -836,8 +836,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload { } }; - struct TestGetRange3 : public BaseTest> { - typedef BaseTest> base_type; + struct TestGetRange3 : public BaseTest { + typedef BaseTest base_type; Key key1, key2; GetRangeLimits limits; diff --git a/fdbserver/workloads/Increment.actor.cpp b/fdbserver/workloads/Increment.actor.cpp index 757ae752f9..b940e98c4f 100644 --- a/fdbserver/workloads/Increment.actor.cpp +++ b/fdbserver/workloads/Increment.actor.cpp @@ -161,10 +161,9 @@ struct Increment : TestWorkload { loop { try { state Version v = wait(tr.getReadVersion()); - Standalone data = - wait(tr.getRange(firstGreaterOrEqual(intToTestKey(0)), - firstGreaterOrEqual(intToTestKey(self->nodeCount)), - self->nodeCount + 1)); + RangeResult data = wait(tr.getRange(firstGreaterOrEqual(intToTestKey(0)), + firstGreaterOrEqual(intToTestKey(self->nodeCount)), + self->nodeCount + 1)); ok = self->incrementCheckData(data, v, self) && ok; break; } catch (Error& e) { diff --git a/fdbserver/workloads/IndexScan.actor.cpp b/fdbserver/workloads/IndexScan.actor.cpp index 644c9506c5..f384664650 100644 --- a/fdbserver/workloads/IndexScan.actor.cpp +++ b/fdbserver/workloads/IndexScan.actor.cpp @@ -120,7 +120,7 @@ struct IndexScanWorkload : KVWorkload { try { loop { - Standalone r = wait(tr.getRange(begin, end, limits)); + RangeResult r = wait(tr.getRange(begin, end, limits)); chunks++; rowsRead += r.size(); if (!r.size() || !r.more || (now() - startTime) > self->transactionDuration) { diff --git a/fdbserver/workloads/Inventory.actor.cpp b/fdbserver/workloads/Inventory.actor.cpp index 8b28f61fe9..584458ed46 100644 --- a/fdbserver/workloads/Inventory.actor.cpp +++ b/fdbserver/workloads/Inventory.actor.cpp @@ -116,7 +116,7 @@ struct InventoryTestWorkload : TestWorkload { state Transaction tr(cx); loop { try { - Standalone data = wait(tr.getRange( + RangeResult data = wait(tr.getRange( firstGreaterOrEqual(doubleToTestKey(0)), firstGreaterOrEqual(doubleToTestKey(1)), self->nProducts)); std::map actualResults; diff --git a/fdbserver/workloads/KVStoreTest.actor.cpp b/fdbserver/workloads/KVStoreTest.actor.cpp index 6060356711..9c100cfa36 100644 --- a/fdbserver/workloads/KVStoreTest.actor.cpp +++ b/fdbserver/workloads/KVStoreTest.actor.cpp @@ -270,8 +270,7 @@ ACTOR Future testKVStoreMain(KVStoreTestWorkload* workload, KVTest* ptest) state Key k; state double cst = timer(); while (true) { - Standalone kv = - wait(test.store->readRange(KeyRangeRef(k, LiteralStringRef("\xff\xff\xff\xff")), 1000)); + RangeResult kv = wait(test.store->readRange(KeyRangeRef(k, LiteralStringRef("\xff\xff\xff\xff")), 1000)); count += kv.size(); if (kv.size() < 1000) break; diff --git a/fdbserver/workloads/LocalRatekeeper.actor.cpp b/fdbserver/workloads/LocalRatekeeper.actor.cpp index 7eebede7e2..1def492236 100644 --- a/fdbserver/workloads/LocalRatekeeper.actor.cpp +++ b/fdbserver/workloads/LocalRatekeeper.actor.cpp @@ -30,7 +30,7 @@ ACTOR Future getRandomStorage(Database cx) { try { tr.reset(); tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); - Standalone range = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); + RangeResult range = wait(tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)); if (range.size() > 0) { auto idx = deterministicRandom()->randomInt(0, range.size()); return decodeServerListValue(range[idx].value); diff --git a/fdbserver/workloads/LockDatabase.actor.cpp b/fdbserver/workloads/LockDatabase.actor.cpp index 5846c84af5..25379bb171 100644 --- a/fdbserver/workloads/LockDatabase.actor.cpp +++ b/fdbserver/workloads/LockDatabase.actor.cpp @@ -50,12 +50,12 @@ struct LockDatabaseWorkload : TestWorkload { void getMetrics(vector& m) override {} - ACTOR static Future> lockAndSave(Database cx, LockDatabaseWorkload* self, UID lockID) { + ACTOR static Future lockAndSave(Database cx, LockDatabaseWorkload* self, UID lockID) { state Transaction tr(cx); loop { try { wait(lockDatabase(&tr, lockID)); - state Standalone data = wait(tr.getRange(normalKeys, 50000)); + state RangeResult data = wait(tr.getRange(normalKeys, 50000)); ASSERT(!data.more); wait(tr.commit()); return data; @@ -65,10 +65,7 @@ struct LockDatabaseWorkload : TestWorkload { } } - ACTOR static Future unlockAndCheck(Database cx, - LockDatabaseWorkload* self, - UID lockID, - Standalone data) { + ACTOR static Future unlockAndCheck(Database cx, LockDatabaseWorkload* self, UID lockID, RangeResult data) { state Transaction tr(cx); loop { try { @@ -78,7 +75,7 @@ struct LockDatabaseWorkload : TestWorkload { return Void(); wait(unlockDatabase(&tr, lockID)); - state Standalone data2 = wait(tr.getRange(normalKeys, 50000)); + state RangeResult data2 = wait(tr.getRange(normalKeys, 50000)); if (data.size() != data2.size()) { TraceEvent(SevError, "DataChangedWhileLocked") .detail("BeforeSize", data.size()) @@ -122,7 +119,7 @@ struct LockDatabaseWorkload : TestWorkload { ACTOR static Future lockWorker(Database cx, LockDatabaseWorkload* self) { state UID lockID = deterministicRandom()->randomUniqueID(); wait(delay(self->lockAfter)); - state Standalone data = wait(lockAndSave(cx, self, lockID)); + state RangeResult data = wait(lockAndSave(cx, self, lockID)); state Future checker = checkLocked(cx, self); wait(delay(self->unlockAfter - self->lockAfter)); checker.cancel(); diff --git a/fdbserver/workloads/MemoryKeyValueStore.cpp b/fdbserver/workloads/MemoryKeyValueStore.cpp index 6c4a2e9d4f..1c951ec1a6 100644 --- a/fdbserver/workloads/MemoryKeyValueStore.cpp +++ b/fdbserver/workloads/MemoryKeyValueStore.cpp @@ -78,8 +78,8 @@ Key MemoryKeyValueStore::getKey(KeySelectorRef selector) const { } // Gets a range of key-value pairs, returning a maximum of results -Standalone MemoryKeyValueStore::getRange(KeyRangeRef range, int limit, bool reverse) const { - Standalone results; +RangeResult MemoryKeyValueStore::getRange(KeyRangeRef range, int limit, bool reverse) const { + RangeResult results; if (!reverse) { std::map::const_iterator mapItr = store.lower_bound(range.begin); diff --git a/fdbserver/workloads/MemoryKeyValueStore.h b/fdbserver/workloads/MemoryKeyValueStore.h index 2a1d6cb176..bd8318c509 100644 --- a/fdbserver/workloads/MemoryKeyValueStore.h +++ b/fdbserver/workloads/MemoryKeyValueStore.h @@ -38,7 +38,7 @@ public: Key getKey(KeySelectorRef selector) const; // Gets a range of key-value pairs, returning a maximum of results - Standalone getRange(KeyRangeRef range, int limit, bool reverse) const; + RangeResult getRange(KeyRangeRef range, int limit, bool reverse) const; // Stores a key-value pair in the database void set(KeyRef key, ValueRef value); diff --git a/fdbserver/workloads/MemoryLifetime.actor.cpp b/fdbserver/workloads/MemoryLifetime.actor.cpp index f31ee5c728..47a2d7e65a 100644 --- a/fdbserver/workloads/MemoryLifetime.actor.cpp +++ b/fdbserver/workloads/MemoryLifetime.actor.cpp @@ -86,13 +86,13 @@ struct MemoryLifetime : KVWorkload { //TraceEvent("MemoryLifetimeCheck").detail("IsReverse", getRange_isReverse).detail("StartKey", printable(getRange_startKey)).detail("RandomStart", getRange_randomStart).detail("NewValue", getRange_newValue.size()).detail("IsSnapshot", getRange_isSnapshot); if (getRange_randomStart) tr.set(getRange_startKey, getRange_newValue); - state Standalone getRange_res1 = wait(tr.getRange( + state RangeResult getRange_res1 = wait(tr.getRange( getRange_queryRange, GetRangeLimits(4000), getRange_isSnapshot, getRange_isReverse)); tr = ReadYourWritesTransaction(cx); wait(delay(0.01)); if (getRange_randomStart) tr.set(getRange_startKey, getRange_newValue); - Standalone getRange_res2 = wait(tr.getRange( + RangeResult getRange_res2 = wait(tr.getRange( getRange_queryRange, GetRangeLimits(4000), getRange_isSnapshot, getRange_isReverse)); ASSERT(getRange_res1.size() == getRange_res2.size()); for (int i = 0; i < getRange_res1.size(); i++) { diff --git a/fdbserver/workloads/RYWPerformance.actor.cpp b/fdbserver/workloads/RYWPerformance.actor.cpp index 4b14268b61..4435f63320 100644 --- a/fdbserver/workloads/RYWPerformance.actor.cpp +++ b/fdbserver/workloads/RYWPerformance.actor.cpp @@ -118,13 +118,13 @@ struct RYWPerformanceWorkload : TestWorkload { tr->clear(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 1))); } } else if (type == 9) { - std::vector>> gets; + std::vector> gets; for (i = 0; i < self->nodes; i++) { gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes)); } wait(waitForAll(gets)); } else if (type == 10) { - std::vector>> gets; + std::vector> gets; for (i = 0; i < self->nodes; i++) { gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes)); } @@ -133,7 +133,7 @@ struct RYWPerformanceWorkload : TestWorkload { tr->set(self->keyForIndex(i), LiteralStringRef("foo")); } } else if (type == 11) { - std::vector>> gets; + std::vector> gets; for (i = 0; i < self->nodes; i++) { gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes)); } @@ -142,7 +142,7 @@ struct RYWPerformanceWorkload : TestWorkload { tr->set(self->keyForIndex(i), LiteralStringRef("foo")); } } else if (type == 12) { - std::vector>> gets; + std::vector> gets; for (i = 0; i < self->nodes; i++) { gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes)); } @@ -151,7 +151,7 @@ struct RYWPerformanceWorkload : TestWorkload { tr->clear(self->keyForIndex(i)); } } else if (type == 13) { - std::vector>> gets; + std::vector> gets; for (i = 0; i < self->nodes; i++) { gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes)); } diff --git a/fdbserver/workloads/RandomMoveKeys.actor.cpp b/fdbserver/workloads/RandomMoveKeys.actor.cpp index 6a712c7fab..8bdafb35e0 100644 --- a/fdbserver/workloads/RandomMoveKeys.actor.cpp +++ b/fdbserver/workloads/RandomMoveKeys.actor.cpp @@ -51,7 +51,7 @@ struct MoveKeysWorkload : TestWorkload { state Transaction tr(cx); loop { try { - Standalone res = wait(tr.getRange(configKeys, 1000)); + RangeResult res = wait(tr.getRange(configKeys, 1000)); ASSERT(res.size() < 1000); for (int i = 0; i < res.size(); i++) self->configuration.set(res[i].key, res[i].value); diff --git a/fdbserver/workloads/RandomSelector.actor.cpp b/fdbserver/workloads/RandomSelector.actor.cpp index 33742d5fcc..584c63450c 100644 --- a/fdbserver/workloads/RandomSelector.actor.cpp +++ b/fdbserver/workloads/RandomSelector.actor.cpp @@ -442,8 +442,8 @@ struct RandomSelectorWorkload : TestWorkload { //TraceEvent("RYOWgetRange").detail("KeyA", myKeyA).detail("KeyB", myKeyB).detail("OnEqualA",onEqualA).detail("OnEqualB",onEqualB).detail("OffsetA",offsetA).detail("OffsetB",offsetB).detail("RandomLimit",randomLimit).detail("RandomByteLimit", randomByteLimit).detail("Reverse", reverse); - state Standalone getRangeTest1; - Standalone getRangeTest = + state RangeResult getRangeTest1; + RangeResult getRangeTest = wait(trRYOW.getRange(KeySelectorRef(StringRef(clientID + "b/" + myKeyA), onEqualA, offsetA), KeySelectorRef(StringRef(clientID + "b/" + myKeyB), onEqualB, offsetB), randomLimit, @@ -453,7 +453,7 @@ struct RandomSelectorWorkload : TestWorkload { loop { try { - Standalone getRangeTest2 = wait( + RangeResult getRangeTest2 = wait( tr.getRange(KeySelectorRef(StringRef(clientID + "d/" + myKeyA), onEqualA, offsetA), KeySelectorRef(StringRef(clientID + "d/" + myKeyB), onEqualB, offsetB), randomLimit, @@ -524,9 +524,9 @@ struct RandomSelectorWorkload : TestWorkload { loop { try { - state Standalone finalTest1 = wait(finalTransaction.getRange( + state RangeResult finalTest1 = wait(finalTransaction.getRange( KeyRangeRef(StringRef(clientID + "b/"), StringRef(clientID + "c/")), self->maxKeySpace)); - Standalone finalTest2 = wait(finalTransaction.getRange( + RangeResult finalTest2 = wait(finalTransaction.getRange( KeyRangeRef(StringRef(clientID + "d/"), StringRef(clientID + "e/")), self->maxKeySpace)); if (finalTest1.size() != finalTest2.size()) { diff --git a/fdbserver/workloads/ReadWrite.actor.cpp b/fdbserver/workloads/ReadWrite.actor.cpp index 2cf284b381..aab168be41 100644 --- a/fdbserver/workloads/ReadWrite.actor.cpp +++ b/fdbserver/workloads/ReadWrite.actor.cpp @@ -481,14 +481,14 @@ struct ReadWriteWorkload : KVWorkload { return Void(); } - ACTOR static Future logLatency(Future> f, + ACTOR static Future logLatency(Future f, ContinuousSample* latencies, double* totalLatency, int* latencyCount, EventMetricHandle readMetric, bool shouldRecord) { state double readBegin = now(); - Standalone value = wait(f); + RangeResult value = wait(f); double latency = now() - readBegin; readMetric->readLatency = latency * 1e9; @@ -816,12 +816,12 @@ ACTOR Future>> trackInsertionCount(Datab while (currentCountIndex < countsOfInterest.size()) { try { - state Future> countFuture = tr.getRange(keyPrefix, 1000000000); - state Future> bytesFuture = tr.getRange(bytesPrefix, 1000000000); + state Future countFuture = tr.getRange(keyPrefix, 1000000000); + state Future bytesFuture = tr.getRange(bytesPrefix, 1000000000); wait(success(countFuture) && success(bytesFuture)); - Standalone counts = countFuture.get(); - Standalone bytes = bytesFuture.get(); + RangeResult counts = countFuture.get(); + RangeResult bytes = bytesFuture.get(); uint64_t numInserted = 0; for (int i = 0; i < counts.size(); i++) diff --git a/fdbserver/workloads/ReportConflictingKeys.actor.cpp b/fdbserver/workloads/ReportConflictingKeys.actor.cpp index 5b57bb0bcf..a68b34b900 100644 --- a/fdbserver/workloads/ReportConflictingKeys.actor.cpp +++ b/fdbserver/workloads/ReportConflictingKeys.actor.cpp @@ -192,13 +192,12 @@ struct ReportConflictingKeysWorkload : TestWorkload { LiteralStringRef("\xff\xff").withPrefix(conflictingKeysRange.begin)); // The getRange here using the special key prefix "\xff\xff/transaction/conflicting_keys/" happens // locally Thus, the error handling is not needed here - Future> conflictingKeyRangesFuture = - tr2->getRange(ckr, CLIENT_KNOBS->TOO_MANY); + Future conflictingKeyRangesFuture = tr2->getRange(ckr, CLIENT_KNOBS->TOO_MANY); ASSERT(conflictingKeyRangesFuture.isReady()); tr2 = makeReference(cx); - const Standalone conflictingKeyRanges = conflictingKeyRangesFuture.get(); + const RangeResult conflictingKeyRanges = conflictingKeyRangesFuture.get(); ASSERT(conflictingKeyRanges.size() && (conflictingKeyRanges.size() <= readConflictRanges.size() * 2)); ASSERT(conflictingKeyRanges.size() % 2 == 0); diff --git a/fdbserver/workloads/RyowCorrectness.actor.cpp b/fdbserver/workloads/RyowCorrectness.actor.cpp index 5806b0a76a..fc0e0fad59 100644 --- a/fdbserver/workloads/RyowCorrectness.actor.cpp +++ b/fdbserver/workloads/RyowCorrectness.actor.cpp @@ -139,8 +139,8 @@ struct RyowCorrectnessWorkload : ApiWorkload { } // Adds a single KV-pair to the list of results - void pushKVPair(std::vector>& results, Key const& key, Optional const& value) { - Standalone result; + void pushKVPair(std::vector& results, Key const& key, Optional const& value) { + RangeResult result; if (!value.present()) result.push_back_deep(result.arena(), KeyValueRef(key, LiteralStringRef("VALUE_NOT_PRESENT"))); else @@ -150,8 +150,8 @@ struct RyowCorrectnessWorkload : ApiWorkload { } // Applies a sequence of operations to the memory store and returns the results - std::vector> applySequenceToStore(std::vector sequence) { - std::vector> results; + std::vector applySequenceToStore(std::vector sequence) { + std::vector results; Key key; #if TRACE_TRANSACTION @@ -222,12 +222,11 @@ struct RyowCorrectnessWorkload : ApiWorkload { } // Applies a sequence of operations to the database and returns the results - ACTOR Future>> applySequenceToDatabase( - Reference transaction, - std::vector sequence, - RyowCorrectnessWorkload* self) { + ACTOR Future> applySequenceToDatabase(Reference transaction, + std::vector sequence, + RyowCorrectnessWorkload* self) { state bool dontUpdateResults = false; - state std::vector> results; + state std::vector results; loop { try { state int i; @@ -242,11 +241,11 @@ struct RyowCorrectnessWorkload : ApiWorkload { self->pushKVPair(results, op.beginKey, val); } else if (op.type == Operation::GET_RANGE) { KeyRangeRef range(op.beginKey, op.endKey); - Standalone result = wait(transaction->getRange(range, op.limit, op.reverse)); + RangeResult result = wait(transaction->getRange(range, op.limit, op.reverse)); if (!dontUpdateResults) results.push_back((RangeResultRef)result); } else if (op.type == Operation::GET_RANGE_SELECTOR) { - Standalone result = + RangeResult result = wait(transaction->getRange(op.beginSelector, op.endSelector, op.limit, op.reverse)); if (!dontUpdateResults) results.push_back((RangeResultRef)result); @@ -278,8 +277,8 @@ struct RyowCorrectnessWorkload : ApiWorkload { } // Compares a sequence of results from the database and the memory store - bool compareResults(std::vector> dbResults, - std::vector> storeResults, + bool compareResults(std::vector dbResults, + std::vector storeResults, std::vector sequence, Version readVersion) { ASSERT(storeResults.size() == dbResults.size()); @@ -334,9 +333,8 @@ struct RyowCorrectnessWorkload : ApiWorkload { loop { state Reference transaction = self->createTransaction(); state std::vector sequence = self->generateOperationSequence(data); - state std::vector> storeResults = self->applySequenceToStore(sequence); - state std::vector> dbResults = - wait(self->applySequenceToDatabase(transaction, sequence, self)); + state std::vector storeResults = self->applySequenceToStore(sequence); + state std::vector dbResults = wait(self->applySequenceToDatabase(transaction, sequence, self)); Version readVersion = wait(transaction->getReadVersion()); diff --git a/fdbserver/workloads/SelectorCorrectness.actor.cpp b/fdbserver/workloads/SelectorCorrectness.actor.cpp index bdde84e2fb..2faecd35b4 100644 --- a/fdbserver/workloads/SelectorCorrectness.actor.cpp +++ b/fdbserver/workloads/SelectorCorrectness.actor.cpp @@ -176,7 +176,7 @@ struct SelectorCorrectnessWorkload : TestWorkload { 2; if (self->testReadYourWrites) { - Standalone getRangeTest = + RangeResult getRangeTest = wait(trRYOW.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), 2 * (self->maxKeySpace + self->maxOffset), @@ -204,7 +204,7 @@ struct SelectorCorrectnessWorkload : TestWorkload { .detail("DataSize", getRangeTest.size()); } } else { - Standalone getRangeTest = + RangeResult getRangeTest = wait(tr.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA), KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB), 2 * (self->maxKeySpace + self->maxOffset), diff --git a/fdbserver/workloads/Serializability.actor.cpp b/fdbserver/workloads/Serializability.actor.cpp index e92171f40f..32444f2092 100644 --- a/fdbserver/workloads/Serializability.actor.cpp +++ b/fdbserver/workloads/Serializability.actor.cpp @@ -232,7 +232,7 @@ struct SerializabilityWorkload : TestWorkload { std::vector ops, std::vector>>* getFutures, std::vector>* getKeyFutures, - std::vector>>* getRangeFutures, + std::vector>* getRangeFutures, std::vector>* watchFutures, bool checkSnapshotReads) { state int opNum = 0; @@ -306,10 +306,10 @@ struct SerializabilityWorkload : TestWorkload { return Void(); } - ACTOR static Future> getDatabaseContents(Database cx, int nodes) { + ACTOR static Future getDatabaseContents(Database cx, int nodes) { state ReadYourWritesTransaction tr(cx); - Standalone result = wait(tr.getRange(normalKeys, nodes + 1)); + RangeResult result = wait(tr.getRange(normalKeys, nodes + 1)); ASSERT(result.size() <= nodes); return result; } @@ -332,14 +332,14 @@ struct SerializabilityWorkload : TestWorkload { state std::vector tr; state std::vector>>> getFutures; state std::vector>> getKeyFutures; - state std::vector>>> getRangeFutures; + state std::vector>> getRangeFutures; state std::vector>> watchFutures; for (int i = 0; i < 5; i++) { tr.push_back(ReadYourWritesTransaction(cx)); getFutures.push_back(std::vector>>()); getKeyFutures.push_back(std::vector>()); - getRangeFutures.push_back(std::vector>>()); + getRangeFutures.push_back(std::vector>()); watchFutures.push_back(std::vector>()); } @@ -382,7 +382,7 @@ struct SerializabilityWorkload : TestWorkload { wait(tr[2].commit()); // get contents of database - state Standalone result1 = wait(getDatabaseContents(cx, self->nodes)); + state RangeResult result1 = wait(getDatabaseContents(cx, self->nodes)); // reset database to known state wait(resetDatabase(cx, initialData)); @@ -397,7 +397,7 @@ struct SerializabilityWorkload : TestWorkload { wait(tr[4].commit()); // get contents of database - Standalone result2 = wait(getDatabaseContents(cx, self->nodes)); + RangeResult result2 = wait(getDatabaseContents(cx, self->nodes)); if (result1.size() != result2.size()) { TraceEvent(SevError, "SRL_ResultMismatch") diff --git a/fdbserver/workloads/SnapTest.actor.cpp b/fdbserver/workloads/SnapTest.actor.cpp index 5f1d6b1611..050162cabd 100644 --- a/fdbserver/workloads/SnapTest.actor.cpp +++ b/fdbserver/workloads/SnapTest.actor.cpp @@ -263,7 +263,7 @@ public: // workload functions tr.reset(); loop { try { - Standalone kvRange = wait(tr.getRange(begin, end, 1000)); + RangeResult kvRange = wait(tr.getRange(begin, end, 1000)); if (!kvRange.more && kvRange.size() == 0) { TraceEvent("SnapTestNoMoreEntries"); break; diff --git a/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp b/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp index cf7273ffda..e6a6650de3 100644 --- a/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp +++ b/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp @@ -193,7 +193,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { } } - bool compareRangeResult(Standalone& res1, Standalone& res2) { + bool compareRangeResult(RangeResult const& res1, RangeResult const& res2) { if ((res1.more != res2.more) || (res1.readToBegin != res2.readToBegin) || (res1.readThroughEnd != res2.readThroughEnd)) { TraceEvent(SevError, "TestFailure") @@ -338,7 +338,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { tx->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_RELAXED); const KeyRef startKey = LiteralStringRef("\xff\xff/transactio"); const KeyRef endKey = LiteralStringRef("\xff\xff/transaction1"); - Standalone result = + RangeResult result = wait(tx->getRange(KeyRangeRef(startKey, endKey), GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); // The whole transaction module should be empty ASSERT(!result.size()); @@ -386,7 +386,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { const KeyRef key = LiteralStringRef("\xff\xff/cluster_file_path"); KeySelector begin = KeySelectorRef(key, false, 0); KeySelector end = KeySelectorRef(keyAfter(key), false, 2); - Standalone result = wait(tx->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); + RangeResult result = wait(tx->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); ASSERT(result.readToBegin && result.readThroughEnd); tx->reset(); } catch (Error& e) { @@ -397,7 +397,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { const KeyRef key = LiteralStringRef("\xff\xff/transaction/a_to_be_the_first"); KeySelector begin = KeySelectorRef(key, false, 0); KeySelector end = KeySelectorRef(key, false, 2); - Standalone result = wait(tx->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); + RangeResult result = wait(tx->getRange(begin, end, GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); ASSERT(result.readToBegin && !result.readThroughEnd); tx->reset(); } catch (Error& e) { @@ -440,7 +440,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { try { const KeySelector startKeySelector = KeySelectorRef(LiteralStringRef("\xff\xff/test"), true, -200); const KeySelector endKeySelector = KeySelectorRef(LiteralStringRef("test"), true, -10); - Standalone result = + RangeResult result = wait(tx->getRange(startKeySelector, endKeySelector, GetRangeLimits(CLIENT_KNOBS->TOO_MANY))); ASSERT(false); } catch (Error& e) { @@ -451,10 +451,9 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { } // test case when registered range is the same as the underlying module try { - state Standalone result = - wait(tx->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), - LiteralStringRef("\xff\xff/worker_interfaces0")), - CLIENT_KNOBS->TOO_MANY)); + state RangeResult result = wait(tx->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), + LiteralStringRef("\xff\xff/worker_interfaces0")), + CLIENT_KNOBS->TOO_MANY)); // Note: there's possibility we get zero workers if (result.size()) { state KeyValueRef entry = deterministicRandom()->randomChoice(result); @@ -609,7 +608,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { return Void(); } - bool getRangeResultInOrder(const Standalone& result) { + bool getRangeResultInOrder(const RangeResult& result) { for (int i = 0; i < result.size() - 1; ++i) { if (result[i].key >= result[i + 1].key) { TraceEvent(SevError, "TestFailure") @@ -636,7 +635,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { .withSuffix(option), ValueRef()); } - Standalone result = wait(tx->getRange( + RangeResult result = wait(tx->getRange( KeyRangeRef(LiteralStringRef("options/"), LiteralStringRef("options0")) .withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin), CLIENT_KNOBS->TOO_MANY)); @@ -677,7 +676,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { try { tx->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES); // test getRange - state Standalone result = wait(tx->getRange( + state RangeResult result = wait(tx->getRange( KeyRangeRef(LiteralStringRef("process/class_type/"), LiteralStringRef("process/class_type0")) .withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin), CLIENT_KNOBS->TOO_MANY)); @@ -746,7 +745,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { { try { // test getRange - state Standalone class_source_result = wait(tx->getRange( + state RangeResult class_source_result = wait(tx->getRange( KeyRangeRef(LiteralStringRef("process/class_source/"), LiteralStringRef("process/class_source0")) .withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin), CLIENT_KNOBS->TOO_MANY)); @@ -835,7 +834,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { // if database locked, fdb read should get database_locked error try { tx->reset(); - Standalone res = wait(tx->getRange(normalKeys, 1)); + RangeResult res = wait(tx->getRange(normalKeys, 1)); } catch (Error& e) { if (e.code() == error_code_actor_cancelled) throw; @@ -853,7 +852,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { TraceEvent(SevDebug, "DatabaseUnlocked"); tx->reset(); // read should be successful - Standalone res = wait(tx->getRange(normalKeys, 1)); + RangeResult res = wait(tx->getRange(normalKeys, 1)); tx->reset(); break; } catch (Error& e) { @@ -1257,13 +1256,13 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { loop { try { // maintenance - Standalone maintenanceKVs = wait( + RangeResult maintenanceKVs = wait( tx->getRange(SpecialKeySpace::getManamentApiCommandRange("maintenance"), CLIENT_KNOBS->TOO_MANY)); // By default, no maintenance is going on ASSERT(!maintenanceKVs.more && !maintenanceKVs.size()); // datadistribution - Standalone ddKVs = wait(tx->getRange( - SpecialKeySpace::getManamentApiCommandRange("datadistribution"), CLIENT_KNOBS->TOO_MANY)); + RangeResult ddKVs = wait(tx->getRange(SpecialKeySpace::getManamentApiCommandRange("datadistribution"), + CLIENT_KNOBS->TOO_MANY)); // By default, data_distribution/mode := "-1" ASSERT(!ddKVs.more && ddKVs.size() == 1); ASSERT(ddKVs[0].key == LiteralStringRef("mode").withPrefix( diff --git a/fdbserver/workloads/Storefront.actor.cpp b/fdbserver/workloads/Storefront.actor.cpp index e97be1409a..9988385cfd 100644 --- a/fdbserver/workloads/Storefront.actor.cpp +++ b/fdbserver/workloads/Storefront.actor.cpp @@ -185,7 +185,7 @@ struct StorefrontWorkload : TestWorkload { state KeySelectorRef begin = firstGreaterThan(keyRange.begin); state KeySelectorRef end = lastLessThan(keyRange.end); while (fetched == 10000) { - Standalone values = wait(tr.getRange(begin, end, 10000)); + RangeResult values = wait(tr.getRange(begin, end, 10000)); int orderIdx; for (orderIdx = 0; orderIdx < values.size(); orderIdx++) { vector saved; @@ -209,7 +209,7 @@ struct StorefrontWorkload : TestWorkload { cx, self, KeyRangeRef(Key(format("/orders/%x", c)), Key(format("/orders/%x", c + 1))))); Transaction tr(cx); - state Future> values = + state Future values = tr.getRange(KeyRangeRef(self->itemKey(0), self->itemKey(self->itemCount)), self->itemCount + 1); wait(waitForAll(accumulators)); @@ -220,7 +220,7 @@ struct StorefrontWorkload : TestWorkload { totals[i] += subTotals[i]; } - Standalone inventory = wait(values); + RangeResult inventory = wait(values); for (int c = 0; c < inventory.size(); c++) { if (self->valueToInt(inventory[c].value) != totals[c]) { TraceEvent(SevError, "TestFailure") diff --git a/fdbserver/workloads/StreamingRead.actor.cpp b/fdbserver/workloads/StreamingRead.actor.cpp index 61bc3d520e..3696d1d37b 100644 --- a/fdbserver/workloads/StreamingRead.actor.cpp +++ b/fdbserver/workloads/StreamingRead.actor.cpp @@ -119,7 +119,7 @@ struct StreamingReadWorkload : TestWorkload { else if (currentIndex > maxIndex - thisRangeSize) currentIndex = minIndex; - Standalone values = + RangeResult values = wait(tr.getRange(firstGreaterOrEqual(self->keyForIndex(currentIndex)), firstGreaterOrEqual(self->keyForIndex(currentIndex + thisRangeSize)), thisRangeSize)); diff --git a/fdbserver/workloads/SuspendProcesses.actor.cpp b/fdbserver/workloads/SuspendProcesses.actor.cpp index 341651b6c8..69600355eb 100644 --- a/fdbserver/workloads/SuspendProcesses.actor.cpp +++ b/fdbserver/workloads/SuspendProcesses.actor.cpp @@ -31,10 +31,9 @@ struct SuspendProcessesWorkload : TestWorkload { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone kvs = - wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), - LiteralStringRef("\xff\xff/worker_interfaces0")), - CLIENT_KNOBS->TOO_MANY)); + RangeResult kvs = wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), + LiteralStringRef("\xff\xff/worker_interfaces0")), + CLIENT_KNOBS->TOO_MANY)); ASSERT(!kvs.more); std::vector> suspendProcessInterfaces; for (auto it : kvs) { diff --git a/fdbserver/workloads/TPCC.actor.cpp b/fdbserver/workloads/TPCC.actor.cpp index 7c2380007d..d8e40c2266 100644 --- a/fdbserver/workloads/TPCC.actor.cpp +++ b/fdbserver/workloads/TPCC.actor.cpp @@ -347,7 +347,7 @@ struct TPCC : TestWorkload { memcpy(end, s.begin(), s.size()); begin[s.size()] = '/'; end[s.size()] = '0'; - state Standalone range = + state RangeResult range = wait(tr->getRange(KeyRangeRef(StringRef(begin, s.size() + 1), StringRef(end, s.size() + 1)), 1000)); ASSERT(range.size() > 0); @@ -468,7 +468,7 @@ struct TPCC : TestWorkload { order.o_w_id = customer.c_w_id; order.o_d_id = customer.c_d_id; order.o_c_id = customer.c_id; - Standalone range = wait(tr.getRange(order.keyRange(1), 1, false, true)); + RangeResult range = wait(tr.getRange(order.keyRange(1), 1, false, true)); ASSERT(range.size() > 0); { BinaryReader r(range[0].value, IncludeVersion()); @@ -506,7 +506,7 @@ struct TPCC : TestWorkload { for (d_id = 0; d_id < 10; ++d_id) { newOrder.no_w_id = w_id; newOrder.no_d_id = d_id; - Standalone range = wait(tr.getRange(newOrder.keyRange(1), 1)); + RangeResult range = wait(tr.getRange(newOrder.keyRange(1), 1)); if (range.size() > 0) { { BinaryReader r(range[0].value, IncludeVersion()); @@ -588,8 +588,7 @@ struct TPCC : TestWorkload { orderLine.ol_w_id = w_id; orderLine.ol_d_id = d_id; orderLine.ol_o_id = ol_o_id; - state Standalone range = - wait(tr.getRange(orderLine.keyRange(1), CLIENT_KNOBS->TOO_MANY)); + state RangeResult range = wait(tr.getRange(orderLine.keyRange(1), CLIENT_KNOBS->TOO_MANY)); ASSERT(!range.more); ASSERT(range.size() > 0); for (i = 0; i < range.size(); ++i) { diff --git a/fdbserver/workloads/TaskBucketCorrectness.actor.cpp b/fdbserver/workloads/TaskBucketCorrectness.actor.cpp index c591619b7d..2beba003c2 100644 --- a/fdbserver/workloads/TaskBucketCorrectness.actor.cpp +++ b/fdbserver/workloads/TaskBucketCorrectness.actor.cpp @@ -319,7 +319,7 @@ struct TaskBucketCorrectnessWorkload : TestWorkload { data.insert(format("task_%d", i)); } - Standalone values = wait(tr->getRange( + RangeResult values = wait(tr->getRange( KeyRangeRef(LiteralStringRef("Hello_\x00"), LiteralStringRef("Hello_\xff")), CLIENT_KNOBS->TOO_MANY)); if (values.size() != data.size()) { TraceEvent(SevError, "CheckSayHello") diff --git a/fdbserver/workloads/Throttling.actor.cpp b/fdbserver/workloads/Throttling.actor.cpp index d11cd1ea61..e6397da740 100644 --- a/fdbserver/workloads/Throttling.actor.cpp +++ b/fdbserver/workloads/Throttling.actor.cpp @@ -131,7 +131,7 @@ struct ThrottlingWorkload : KVWorkload { state json_spirit::mValue logSchema = readJSONStrictly(JSONSchemas::logHealthSchema.toString()).get_obj(); loop { try { - Standalone result = wait( + RangeResult result = wait( tr.getRange(prefixRange(LiteralStringRef("\xff\xff/metrics/health/")), CLIENT_KNOBS->TOO_MANY)); ASSERT(!result.more); for (const auto& [k, v] : result) { diff --git a/fdbserver/workloads/TriggerRecovery.actor.cpp b/fdbserver/workloads/TriggerRecovery.actor.cpp index e798ec79ca..ab21256c9b 100644 --- a/fdbserver/workloads/TriggerRecovery.actor.cpp +++ b/fdbserver/workloads/TriggerRecovery.actor.cpp @@ -92,10 +92,9 @@ struct TriggerRecoveryLoopWorkload : TestWorkload { try { tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); tr.setOption(FDBTransactionOptions::LOCK_AWARE); - Standalone kvs = - wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), - LiteralStringRef("\xff\xff/worker_interfaces0")), - CLIENT_KNOBS->TOO_MANY)); + RangeResult kvs = wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), + LiteralStringRef("\xff\xff/worker_interfaces0")), + CLIENT_KNOBS->TOO_MANY)); ASSERT(!kvs.more); std::map address_interface; for (auto it : kvs) { diff --git a/fdbserver/workloads/UDPWorkload.actor.cpp b/fdbserver/workloads/UDPWorkload.actor.cpp index 9a3ca3aeaa..d96bbf13d5 100644 --- a/fdbserver/workloads/UDPWorkload.actor.cpp +++ b/fdbserver/workloads/UDPWorkload.actor.cpp @@ -218,8 +218,7 @@ struct UDPWorkload : TestWorkload { state std::vector remotes; loop { try { - Standalone range = - wait(tr.getRange(prefixRange(self->keyPrefix), CLIENT_KNOBS->TOO_MANY)); + RangeResult range = wait(tr.getRange(prefixRange(self->keyPrefix), CLIENT_KNOBS->TOO_MANY)); ASSERT(!range.more); for (auto const& p : range) { auto cID = BinaryReader::fromStringRefclientId)>( diff --git a/fdbserver/workloads/Unreadable.actor.cpp b/fdbserver/workloads/Unreadable.actor.cpp index e804048880..2f322e2350 100644 --- a/fdbserver/workloads/Unreadable.actor.cpp +++ b/fdbserver/workloads/Unreadable.actor.cpp @@ -360,7 +360,7 @@ struct UnreadableWorkload : TestWorkload { if (snapshot) tr.setOption(FDBTransactionOptions::SNAPSHOT_RYW_DISABLE); - ErrorOr> value = + ErrorOr value = wait(errorOr(tr.getRange(range, CLIENT_KNOBS->TOO_MANY, snapshot, reverse))); if (snapshot) @@ -393,15 +393,14 @@ struct UnreadableWorkload : TestWorkload { tr.setOption(FDBTransactionOptions::SNAPSHOT_RYW_DISABLE); //TraceEvent("RYWT_GetRangeBefore").detail("Reverse", reverse).detail("Begin", begin.toString()).detail("End", end.toString()).detail("Limit", limit); - ErrorOr> value = - wait(errorOr(tr.getRange(begin, end, limit, snapshot, reverse))); + ErrorOr value = wait(errorOr(tr.getRange(begin, end, limit, snapshot, reverse))); if (snapshot) tr.setOption(FDBTransactionOptions::SNAPSHOT_RYW_ENABLE); bool isUnreadable = value.isError() && value.getError().code() == error_code_accessed_unreadable; if (!value.isError() || value.getError().code() == error_code_accessed_unreadable) { /* - Standalone result = value.get(); + RangeResult result = value.get(); TraceEvent("RYWT_GetKeySelRangeOk") .detail("Begin", begin.toString()) .detail("End", end.toString()) diff --git a/fdbserver/workloads/VersionStamp.actor.cpp b/fdbserver/workloads/VersionStamp.actor.cpp index 5665ada1c3..6b1bd0d579 100644 --- a/fdbserver/workloads/VersionStamp.actor.cpp +++ b/fdbserver/workloads/VersionStamp.actor.cpp @@ -184,10 +184,10 @@ struct VersionStampWorkload : TestWorkload { tr.setVersion(readVersion); } - state Standalone result; + state RangeResult result; loop { try { - Standalone result_ = wait(tr.getRange( + RangeResult result_ = wait(tr.getRange( KeyRangeRef(self->vsValuePrefix, endOfRange(self->vsValuePrefix)), self->nodeCount + 1)); result = result_; if ((self->apiVersion >= 610 || self->apiVersion == Database::API_VERSION_LATEST) && @@ -249,7 +249,7 @@ struct VersionStampWorkload : TestWorkload { } } - Standalone result__ = wait( + RangeResult result__ = wait( tr.getRange(KeyRangeRef(self->vsKeyPrefix, endOfRange(self->vsKeyPrefix)), self->nodeCount + 1)); result = result__; ASSERT(result.size() <= self->nodeCount); diff --git a/fdbserver/workloads/WriteDuringRead.actor.cpp b/fdbserver/workloads/WriteDuringRead.actor.cpp index af4124c5bf..80a36b1848 100644 --- a/fdbserver/workloads/WriteDuringRead.actor.cpp +++ b/fdbserver/workloads/WriteDuringRead.actor.cpp @@ -245,8 +245,8 @@ struct WriteDuringReadWorkload : TestWorkload { limit, reverse); *memLimit -= memRes.expectedSize(); - Standalone _res = wait(tr->getRange(begin, end, limit, snapshot, reverse)); - Standalone res = _res; + RangeResult _res = wait(tr->getRange(begin, end, limit, snapshot, reverse)); + RangeResult res = _res; *memLimit += memRes.expectedSize(); int systemKeyCount = 0;