Create RangeResult type alias

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-03 13:14:16 -07:00
parent da41534618
commit 5c2d7b6080
107 changed files with 972 additions and 1115 deletions

View File

@ -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<Standalone<RangeResultRef>> 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<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw,
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const override {
Standalone<RangeResultRef> 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<RangeResultRef> 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 &&

View File

@ -366,7 +366,7 @@ ACTOR Future<Void> fdbClient() {
// 3. write 10 values in [k, k+100]
beginIdx = deterministicRandom()->randomInt(0, 1e8 - 100);
startKey = keyPrefix + std::to_string(beginIdx);
Standalone<RangeResultRef> 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"));

View File

@ -1576,7 +1576,7 @@ ACTOR Future<std::string> getLayerStatus(Reference<ReadYourWritesTransaction> tr
state Reference<ReadYourWritesTransaction> tr2(new ReadYourWritesTransaction(dest));
tr2->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr2->setOption(FDBTransactionOptions::LOCK_AWARE);
state Standalone<RangeResultRef> tagNames = wait(tr2->getRange(dba.tagNames.range(), 10000, snapshot));
state RangeResult tagNames = wait(tr2->getRange(dba.tagNames.range(), 10000, snapshot));
state std::vector<Future<Optional<Key>>> backupVersion;
state std::vector<Future<EBackupState>> backupStatus;
state std::vector<Future<int64_t>> tagRangeBytesDR;
@ -1638,7 +1638,7 @@ ACTOR Future<Void> cleanupStatus(Reference<ReadYourWritesTransaction> tr,
std::string name,
std::string id,
int limit = 1) {
state Standalone<RangeResultRef> 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<Void> cleanupStatus(Reference<ReadYourWritesTransaction> tr,
}
if (readMore) {
limit = 10000;
Standalone<RangeResultRef> 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<json_spirit::mObject> getLayerStatus(Database src, std::string root
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
state Standalone<RangeResultRef> kvPairs =
state RangeResult kvPairs =
wait(tr.getRange(KeyRangeRef(rootKey, strinc(rootKey)), GetRangeLimits::ROW_LIMIT_UNLIMITED));
json_spirit::mObject statusDoc;
JSONDoc modifier(statusDoc);

View File

@ -3633,7 +3633,7 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
if (tokencmp(tokens[0], "kill")) {
getTransaction(db, tr, options, intrans);
if (tokens.size() == 1) {
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
if (tokencmp(tokens[0], "suspend")) {
getTransaction(db, tr, options, intrans);
if (tokens.size() == 1) {
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
continue;
}
getTransaction(db, tr, options, intrans);
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
continue;
}
getTransaction(db, tr, options, intrans);
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
continue;
}
getTransaction(db, tr, options, intrans);
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
if (tokencmp(tokens[0], "expensive_data_check")) {
getTransaction(db, tr, options, intrans);
if (tokens.size() == 1) {
Standalone<RangeResultRef> 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<int> cli(CLIOptions opt, LineNoise* plinenoise) {
endKey = strinc(tokens[1]);
}
Standalone<RangeResultRef> 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);

View File

@ -593,10 +593,10 @@ public:
Reference<FutureBucket> futureBucket;
};
typedef std::pair<Standalone<RangeResultRef>, Version> RangeResultWithVersion;
using RangeResultWithVersion = std::pair<RangeResult, Version>;
struct RCGroup {
Standalone<RangeResultRef> items;
RangeResult items;
Version version;
uint64_t groupKey;

View File

@ -401,7 +401,7 @@ ACTOR Future<Void> readCommitted(Database cx,
releaser = FlowLock::Releaser(
*lock, limits.bytes + CLIENT_KNOBS->VALUE_SIZE_LIMIT + CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT);
state Standalone<RangeResultRef> 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<Void> readCommitted(Database cx,
if (lockAware)
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
state Standalone<RangeResultRef> 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<Void> _eraseLogData(Reference<ReadYourWritesTransaction> tr,
return Void();
}
state Standalone<RangeResultRef> 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<Void> _eraseLogData(Reference<ReadYourWritesTransaction> tr,
}
if (!endVersion.present() && backupVersions.size() == 1) {
Standalone<RangeResultRef> 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<Void> cleanupLogMutations(Database cx, Value destUidValue, bool del
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
state Standalone<RangeResultRef> 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<Void> cleanupBackup(Database cx, bool deleteData) {
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
state Standalone<RangeResultRef> destUids = wait(
state RangeResult destUids = wait(
tr->getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY));
for (auto destUid : destUids) {

View File

@ -157,7 +157,7 @@ struct BackupRangeTaskFunc : TaskFuncBase {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
state Standalone<VectorRef<KeyRef>> results;
Standalone<RangeResultRef> values = wait(tr->getRange(
RangeResult values = wait(tr->getRange(
KeyRangeRef(keyAfter(beginKey.withPrefix(keyServersPrefix)), endKey.withPrefix(keyServersPrefix)), limit));
for (auto& s : values) {
@ -314,15 +314,14 @@ struct BackupRangeTaskFunc : TaskFuncBase {
applyMutationsKeyVersionMapRange.begin);
state Key rangeCountKey = task->params[BackupAgentBase::keyConfigLogUid].withPrefix(
applyMutationsKeyVersionCountRange.begin);
state Future<Standalone<RangeResultRef>> backupVersions =
state Future<RangeResult> backupVersions =
krmGetRanges(tr, prefix, KeyRangeRef(rangeBegin, rangeEnd), BUGGIFY ? 2 : 2000, 1e5);
state Future<Optional<Value>> logVersionValue = tr->get(
task->params[BackupAgentBase::keyConfigLogUid].withPrefix(applyMutationsEndRange.begin), true);
state Future<Optional<Value>> rangeCountValue = tr->get(rangeCountKey, true);
state Future<Standalone<RangeResultRef>> prevRange = tr->getRange(
state Future<RangeResult> prevRange = tr->getRange(
firstGreaterOrEqual(prefix), lastLessOrEqual(rangeBegin.withPrefix(prefix)), 1, true, true);
state Future<Standalone<RangeResultRef>> nextRange =
tr->getRange(firstGreaterOrEqual(rangeEnd.withPrefix(prefix)),
state Future<RangeResult> nextRange = tr->getRange(firstGreaterOrEqual(rangeEnd.withPrefix(prefix)),
firstGreaterOrEqual(strinc(prefix)),
1,
true,
@ -725,7 +724,7 @@ struct CopyLogRangeTaskFunc : TaskFuncBase {
state Subspace conf = Subspace(databaseBackupPrefixRange.begin)
.get(BackupAgentBase::keyConfig)
.get(task->params[BackupAgentBase::keyConfigLogUid]);
state std::vector<Standalone<RangeResultRef>> nextMutations;
state std::vector<RangeResult> nextMutations;
state bool isTimeoutOccured = false;
state Optional<KeyRef> lastKey;
state Version lastVersion;
@ -736,9 +735,9 @@ struct CopyLogRangeTaskFunc : TaskFuncBase {
return Optional<Version>();
}
state std::vector<Standalone<RangeResultRef>> mutations = std::move(nextMutations);
state std::vector<RangeResult> mutations = std::move(nextMutations);
state int64_t mutationSize = nextMutationSize;
nextMutations = std::vector<Standalone<RangeResultRef>>();
nextMutations = std::vector<RangeResult>();
nextMutationSize = 0;
if (!endOfStream) {
@ -1470,7 +1469,7 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase {
.get(BackupAgentBase::keyConfig)
.get(task->params[BackupAgentBase::keyConfigLogUid]);
state std::vector<Standalone<RangeResultRef>> nextMutations;
state std::vector<RangeResult> nextMutations;
state int64_t nextMutationSize = 0;
loop {
try {
@ -1478,9 +1477,9 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase {
return Void();
}
state std::vector<Standalone<RangeResultRef>> mutations = std::move(nextMutations);
state std::vector<RangeResult> mutations = std::move(nextMutations);
state int64_t mutationSize = nextMutationSize;
nextMutations = std::vector<Standalone<RangeResultRef>>();
nextMutations = std::vector<RangeResult>();
nextMutationSize = 0;
if (!endOfStream) {
@ -1819,7 +1818,7 @@ struct CopyDiffLogsUpgradeTaskFunc : TaskFuncBase {
}
if (backupRanges.size() == 1) {
Standalone<RangeResultRef> 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<RangeResultRef> 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<Future<Standalone<RangeResultRef>>> backupIntoResults;
state std::vector<Future<RangeResult>> 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<Optional<Value>> fPaused = tr->get(backupAgent->taskBucket->getPauseKey());
state Future<Standalone<RangeResultRef>> fErrorValues =
state Future<RangeResult> fErrorValues =
errorLimit > 0
? tr->getRange(backupAgent->errors.get(BinaryWriter::toValue(logUid, Unversioned())).range(),
errorLimit,
false,
true)
: Future<Standalone<RangeResultRef>>();
: Future<RangeResult>();
state Future<Optional<Value>> 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<RangeResultRef> values = wait(fErrorValues);
RangeResult values = wait(fErrorValues);
// Display the errors, if any
if (values.size() > 0) {

View File

@ -706,6 +706,7 @@ struct RangeResultRef : VectorRef<KeyValueRef> {
" readToBegin:" + std::to_string(readToBegin) + " readThroughEnd:" + std::to_string(readThroughEnd);
}
};
using RangeResult = Standalone<RangeResultRef>;
template <>
struct Traceable<RangeResultRef> : std::true_type {

View File

@ -1025,7 +1025,7 @@ ACTOR static Future<Standalone<VectorRef<KeyRef>>> getBlockOfShards(Reference<Re
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
state Standalone<VectorRef<KeyRef>> results;
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<Void> writeKVs(Database cx, Standalone<VectorRef<KeyValueRef
.detail("Range", KeyRangeRef(k1, k2))
.detail("Begin", begin)
.detail("End", end);
Standalone<RangeResultRef> 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<Void> transformDatabaseContents(Database cx,
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
for (i = 0; i < restoreRanges.size(); ++i) {
Standalone<RangeResultRef> 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<Void> transformDatabaseContents(Database cx,
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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<Void> transformDatabaseContents(Database cx,
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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<bool, bool> backupRestoreValid = insideValidRange(allData[i], restoreRanges, backupRanges);

View File

@ -191,7 +191,7 @@ ACTOR Future<Void> GlobalConfig::refresh(GlobalConfig* self) {
self->erase(KeyRangeRef(""_sr, "\xff"_sr));
Transaction tr(self->cx);
Standalone<RangeResultRef> 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);

View File

@ -42,21 +42,21 @@ public:
// until the ThreadFuture's ThreadSingleAssignmentVar has its memory released or it is destroyed.
virtual ThreadFuture<Optional<Value>> get(const KeyRef& key, bool snapshot = false) = 0;
virtual ThreadFuture<Key> getKey(const KeySelectorRef& key, bool snapshot = false) = 0;
virtual ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
virtual ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot = false,
bool reverse = false) = 0;
virtual ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
virtual ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) = 0;
virtual ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
virtual ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
int limit,
bool snapshot = false,
bool reverse = false) = 0;
virtual ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
virtual ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) = 0;

View File

@ -280,7 +280,7 @@ public:
return map(
tr->getRange(
KeyRangeRef(s.pack(Codec<KeyType>::pack(begin)), endKey), GetRangeLimits(limit), snapshot, reverse),
[s](Standalone<RangeResultRef> const& kvs) -> PairsType {
[s](RangeResult const& kvs) -> PairsType {
PairsType results;
for (int i = 0; i < kvs.size(); ++i) {
KeyType key = Codec<KeyType>::unpack(s.unpack(kvs[i].key));
@ -344,7 +344,7 @@ public:
Key endKey = end.present() ? s.pack(Codec<ValueType>::pack(end.get())) : space.range().end;
return map(
tr->getRange(KeyRangeRef(s.pack(Codec<ValueType>::pack(begin)), endKey), GetRangeLimits(limit), snapshot),
[s](Standalone<RangeResultRef> const& kvs) -> Values {
[s](RangeResult const& kvs) -> Values {
Values results;
for (int i = 0; i < kvs.size(); ++i) {
results.push_back(Codec<ValueType>::unpack(s.unpack(kvs[i].key)));

View File

@ -35,7 +35,7 @@ void KeyRangeActorMap::getRangesAffectedByInsertion(const KeyRangeRef& keys, vec
affectedRanges.push_back(KeyRangeRef(keys.end, e.end()));
}
Standalone<RangeResultRef> krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Standalone<RangeResultRef> 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<RangeResultRef> krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Stan
if (kv.size() && kv.end()[-1].key.startsWith(mapPrefix))
endValue = kv.end()[-1].value;
Standalone<RangeResultRef> result;
RangeResult result;
result.arena().dependsOn(kv.arena());
result.arena().dependsOn(keys.arena());
@ -67,23 +67,18 @@ Standalone<RangeResultRef> krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Stan
}
// Returns keys.begin, all transitional points in keys, and keys.end, and their values
ACTOR Future<Standalone<RangeResultRef>> krmGetRanges(Transaction* tr,
Key mapPrefix,
KeyRange keys,
int limit,
int limitBytes) {
ACTOR Future<RangeResult> 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<RangeResultRef> 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<Standalone<RangeResultRef>> krmGetRanges(Reference<ReadYourWritesTransaction> tr,
ACTOR Future<RangeResult> krmGetRanges(Reference<ReadYourWritesTransaction> tr,
Key mapPrefix,
KeyRange keys,
int limit,
@ -93,8 +88,7 @@ ACTOR Future<Standalone<RangeResultRef>> krmGetRanges(Reference<ReadYourWritesTr
state GetRangeLimits limits(limit, limitBytes);
limits.minRows = 2;
Standalone<RangeResultRef> 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<Void> krmSetRange(Transaction* tr, Key mapPrefix, KeyRange range, Value value) {
state KeyRange withPrefix =
KeyRangeRef(mapPrefix.toString() + range.begin.toString(), mapPrefix.toString() + range.end.toString());
Standalone<RangeResultRef> 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<Void> krmSetRange(Transaction* tr, Key mapPrefix, KeyRange range, V
ACTOR Future<Void> krmSetRange(Reference<ReadYourWritesTransaction> tr, Key mapPrefix, KeyRange range, Value value) {
state KeyRange withPrefix =
KeyRangeRef(mapPrefix.toString() + range.begin.toString(), mapPrefix.toString() + range.end.toString());
Standalone<RangeResultRef> 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<Void> krmSetRangeCoalescing_(Transaction* tr,
state KeyRange maxWithPrefix =
KeyRangeRef(mapPrefix.toString() + maxRange.begin.toString(), mapPrefix.toString() + maxRange.end.toString());
state vector<Future<Standalone<RangeResultRef>>> keys;
state vector<Future<RangeResult>> 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));

View File

@ -126,12 +126,12 @@ private:
// krm*(): KeyRangeMap-like abstraction stored in the database, accessed through Transactions
class Transaction;
class ReadYourWritesTransaction;
Future<Standalone<RangeResultRef>> krmGetRanges(Transaction* const& tr,
Future<RangeResult> 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<Standalone<RangeResultRef>> krmGetRanges(Reference<ReadYourWritesTransaction> const& tr,
Future<RangeResult> krmGetRanges(Reference<ReadYourWritesTransaction> const& tr,
Key const& mapPrefix,
KeyRange const& keys,
int const& limit = CLIENT_KNOBS->KRM_GET_RANGE_LIMIT,
@ -162,7 +162,7 @@ Future<Void> krmSetRangeCoalescing(Reference<ReadYourWritesTransaction> const& t
KeyRange const& range,
KeyRange const& maxRange,
Value const& value);
Standalone<RangeResultRef> krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, Standalone<RangeResultRef> kv);
RangeResult krmDecodeRanges(KeyRef mapPrefix, KeyRange keys, RangeResult kv);
template <class Val, class Metric, class MetricFunc>
std::vector<KeyRangeWith<Val>> KeyRangeMap<Val, Metric, MetricFunc>::getAffectedRangesAfterInsertion(

View File

@ -357,7 +357,7 @@ ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Database cx) {
loop {
try {
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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<KeyValueRef>)res);
@ -407,7 +407,7 @@ ACTOR Future<ConfigurationResult> changeConfig(Database cx, std::map<std::string
tr.setOption(FDBTransactionOptions::USE_PROVISIONAL_PROXIES);
if (!creating && !force) {
state Future<Standalone<RangeResultRef>> fConfig = tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fConfig = tr.getRange(configKeys, CLIENT_KNOBS->TOO_MANY);
state Future<vector<ProcessData>> fWorkers = getWorkers(&tr);
wait(success(fConfig) || tooLong);
@ -458,19 +458,19 @@ ACTOR Future<ConfigurationResult> changeConfig(Database cx, std::map<std::string
}
}
state Future<Standalone<RangeResultRef>> fServerList =
(newConfig.regions.size()) ? tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)
: Future<Standalone<RangeResultRef>>();
state Future<RangeResult> fServerList = (newConfig.regions.size())
? tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY)
: Future<RangeResult>();
if (newConfig.usableRegions == 2) {
if (oldReplicationUsesDcId) {
state Future<Standalone<RangeResultRef>> fLocalityList =
state Future<RangeResult> fLocalityList =
tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY);
wait(success(fLocalityList) || tooLong);
if (!fLocalityList.isReady()) {
return ConfigurationResult::DATABASE_UNAVAILABLE;
}
Standalone<RangeResultRef> localityList = fLocalityList.get();
RangeResult localityList = fLocalityList.get();
ASSERT(!localityList.more && localityList.size() < CLIENT_KNOBS->TOO_MANY);
std::set<Key> localityDcIds;
@ -513,7 +513,7 @@ ACTOR Future<ConfigurationResult> changeConfig(Database cx, std::map<std::string
if (!fServerList.isReady()) {
return ConfigurationResult::DATABASE_UNAVAILABLE;
}
Standalone<RangeResultRef> serverList = fServerList.get();
RangeResult serverList = fServerList.get();
ASSERT(!serverList.more && serverList.size() < CLIENT_KNOBS->TOO_MANY);
std::set<Key> newDcIds;
@ -988,8 +988,8 @@ Future<ConfigurationResult> changeConfig(Database const& cx, std::string const&
}
ACTOR Future<vector<ProcessData>> getWorkers(Transaction* tr) {
state Future<Standalone<RangeResultRef>> processClasses = tr->getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> processData = tr->getRange(workerListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> processClasses = tr->getRange(processClassKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> 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<Void> setClass(Database cx, AddressExclusion server, ProcessClass p
}
ACTOR Future<vector<AddressExclusion>> getExcludedServers(Transaction* tr) {
state Standalone<RangeResultRef> 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<RangeResultRef> 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<AddressExclusion> exclusions;
@ -1867,7 +1867,7 @@ ACTOR Future<bool> checkForExcludingServersTxActor(ReadYourWritesTransaction* tr
// recovery
// Check that there aren't any storage servers with addresses violating the exclusions
Standalone<RangeResultRef> 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<Void> waitForFullReplication(Database cx) {
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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<KeyValueRef>)confResults);
@ -2203,8 +2203,7 @@ ACTOR Future<Void> changeCachedRange(Database cx, KeyRangeRef range, bool add) {
tr.clear(sysRangeClear);
tr.clear(privateRange);
tr.addReadConflictRange(privateRange);
Standalone<RangeResultRef> 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<uint16_t> prevVal;
@ -2220,8 +2219,7 @@ ACTOR Future<Void> changeCachedRange(Database cx, KeyRangeRef range, bool add) {
tr.set(sysRange.begin, trueValue);
tr.set(privateRange.begin, serverKeysTrue);
}
Standalone<RangeResultRef> 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<uint16_t> afterVal;

View File

@ -89,7 +89,7 @@ ThreadFuture<Key> DLTransaction::getKey(const KeySelectorRef& key, bool snapshot
});
}
ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> DLTransaction::getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot,
@ -97,7 +97,7 @@ ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeySelect
return getRange(begin, end, GetRangeLimits(limit), snapshot, reverse);
}
ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> DLTransaction::getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot,
@ -117,7 +117,7 @@ ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeySelect
0,
snapshot,
reverse);
return toThreadFuture<Standalone<RangeResultRef>>(api, f, [](FdbCApi::FDBFuture* f, FdbCApi* api) {
return toThreadFuture<RangeResult>(api, f, [](FdbCApi::FDBFuture* f, FdbCApi* api) {
const FdbCApi::FDBKeyValue* kvs;
int count;
FdbCApi::fdb_bool_t more;
@ -125,20 +125,16 @@ ThreadFuture<Standalone<RangeResultRef>> 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>(RangeResultRef(VectorRef<KeyValueRef>((KeyValueRef*)kvs, count), more),
Arena());
return RangeResult(RangeResultRef(VectorRef<KeyValueRef>((KeyValueRef*)kvs, count), more), Arena());
});
}
ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeyRangeRef& keys,
int limit,
bool snapshot,
bool reverse) {
ThreadFuture<RangeResult> DLTransaction::getRange(const KeyRangeRef& keys, int limit, bool snapshot, bool reverse) {
return getRange(
firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), GetRangeLimits(limit), snapshot, reverse);
}
ThreadFuture<Standalone<RangeResultRef>> DLTransaction::getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> DLTransaction::getRange(const KeyRangeRef& keys,
GetRangeLimits limits,
bool snapshot,
bool reverse) {
@ -685,45 +681,45 @@ ThreadFuture<Key> MultiVersionTransaction::getKey(const KeySelectorRef& key, boo
return abortableFuture(f, tr.onChange);
}
ThreadFuture<Standalone<RangeResultRef>> MultiVersionTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> 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<Standalone<RangeResultRef>>(Never());
: ThreadFuture<RangeResult>(Never());
return abortableFuture(f, tr.onChange);
}
ThreadFuture<Standalone<RangeResultRef>> MultiVersionTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> 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<Standalone<RangeResultRef>>(Never());
: ThreadFuture<RangeResult>(Never());
return abortableFuture(f, tr.onChange);
}
ThreadFuture<Standalone<RangeResultRef>> MultiVersionTransaction::getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> 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<Standalone<RangeResultRef>>(Never());
auto f =
tr.transaction ? tr.transaction->getRange(keys, limit, snapshot, reverse) : ThreadFuture<RangeResult>(Never());
return abortableFuture(f, tr.onChange);
}
ThreadFuture<Standalone<RangeResultRef>> MultiVersionTransaction::getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> 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<Standalone<RangeResultRef>>(Never());
auto f =
tr.transaction ? tr.transaction->getRange(keys, limits, snapshot, reverse) : ThreadFuture<RangeResult>(Never());
return abortableFuture(f, tr.onChange);
}

View File

@ -200,21 +200,21 @@ public:
ThreadFuture<Optional<Value>> get(const KeyRef& key, bool snapshot = false) override;
ThreadFuture<Key> getKey(const KeySelectorRef& key, bool snapshot = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
int limit,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override;
@ -339,21 +339,21 @@ public:
ThreadFuture<Optional<Value>> get(const KeyRef& key, bool snapshot = false) override;
ThreadFuture<Key> getKey(const KeySelectorRef& key, bool snapshot = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
int limit,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override;

View File

@ -391,7 +391,7 @@ ACTOR static Future<Void> delExcessClntTxnEntriesActor(Transaction* tr, int64_t
? (txInfoSize - clientTxInfoSizeLimit)
: CLIENT_KNOBS->TRANSACTION_SIZE_LIMIT;
GetRangeLimits limit(GetRangeLimits::ROW_LIMIT_UNLIMITED, getRangeByteLimit);
Standalone<RangeResultRef> txEntries =
RangeResult txEntries =
wait(tr->getRange(KeyRangeRef(clientLatencyName, strinc(clientLatencyName)), limit));
state int64_t numBytesToDel = 0;
KeyRef endKey;
@ -601,7 +601,7 @@ ACTOR Future<Void> updateCachedRanges(DatabaseContext* self, std::map<UID, Stora
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::READ_LOCK_AWARE);
try {
Standalone<RangeResultRef> range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY));
RangeResult range = wait(tr.getRange(storageCacheKeys, CLIENT_KNOBS->TOO_MANY));
ASSERT(!range.more);
std::vector<Reference<ReferencedInterface<StorageServerInterface>>> cacheInterfaces;
cacheInterfaces.reserve(cacheServers->size());
@ -678,8 +678,7 @@ ACTOR Future<Void> monitorCacheList(DatabaseContext* self) {
// the cyclic reference to self.
wait(refreshTransaction(self, &tr));
try {
Standalone<RangeResultRef> 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<UID, StorageServerInterface> allCacheServers;
@ -762,16 +761,16 @@ void DatabaseContext::registerSpecialKeySpaceModule(SpecialKeySpace::MODULE modu
specialKeySpaceModules.push_back(std::move(impl));
}
ACTOR Future<Standalone<RangeResultRef>> getWorkerInterfaces(Reference<ClusterConnectionFile> clusterFile);
ACTOR Future<RangeResult> getWorkerInterfaces(Reference<ClusterConnectionFile> clusterFile);
ACTOR Future<Optional<Value>> getJSON(Database db);
struct WorkerInterfacesSpecialKeyImpl : SpecialKeyRangeReadImpl {
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override {
Future<RangeResult> 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<RangeResultRef>& in) {
Standalone<RangeResultRef> 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<RangeResultRef>();
return RangeResult();
}
}
@ -790,10 +789,10 @@ struct WorkerInterfacesSpecialKeyImpl : SpecialKeyRangeReadImpl {
};
struct SingleSpecialKeyImpl : SpecialKeyRangeReadImpl {
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override {
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override {
ASSERT(kr.contains(k));
return map(f(ryw), [k = k](Optional<Value> v) {
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
static Standalone<RangeResultRef> healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRangeRef kr) {
Standalone<RangeResultRef> 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<RangeResultRef> healthMetricsToKVPairs(const HealthMetrics& me
return result;
}
ACTOR static Future<Standalone<RangeResultRef>> healthMetricsGetRangeActor(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) {
ACTOR static Future<RangeResult> 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<Standalone<RangeResultRef>> healthMetricsGetRangeActor(ReadY
HealthMetricsRangeImpl::HealthMetricsRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {}
Future<Standalone<RangeResultRef>> HealthMetricsRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> HealthMetricsRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return healthMetricsGetRangeActor(ryw, kr);
}
@ -1980,7 +1977,7 @@ AddressExclusion AddressExclusion::parse(StringRef const& key) {
}
}
Future<Standalone<RangeResultRef>> getRange(Database const& cx,
Future<RangeResult> getRange(Database const& cx,
Future<Version> const& fVersion,
KeySelector const& begin,
KeySelector const& end,
@ -2713,14 +2710,14 @@ void transformRangeLimits(GetRangeLimits limits, bool reverse, GetKeyValuesReque
}
}
ACTOR Future<Standalone<RangeResultRef>> getExactRange(Database cx,
ACTOR Future<RangeResult> getExactRange(Database cx,
Version version,
KeyRange keys,
GetRangeLimits limits,
bool reverse,
TransactionInfo info,
TagSet tags) {
state Standalone<RangeResultRef> output;
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,7 +2889,7 @@ Future<Key> resolveKey(Database const& cx,
return getKey(cx, key, version, info, tags);
}
ACTOR Future<Standalone<RangeResultRef>> getRangeFallback(Database cx,
ACTOR Future<RangeResult> getRangeFallback(Database cx,
Version version,
KeySelector begin,
KeySelector end,
@ -2915,15 +2912,15 @@ ACTOR Future<Standalone<RangeResultRef>> getRangeFallback(Database cx,
state Key b = wait(fb);
state Key e = wait(fe);
if (b >= e) {
return Standalone<RangeResultRef>();
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<RangeResultRef> _r = wait(getExactRange(cx, version, KeyRangeRef(b, e), limits, reverse, info, tags));
Standalone<RangeResultRef> 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<std::pair<Key, Key>> conflictRange,
bool reverse,
Standalone<RangeResultRef> result) {
RangeResult result) {
int64_t bytes = 0;
for (const KeyValueRef& kv : result) {
bytes += kv.key.size() + kv.value.size();
@ -3001,7 +2998,7 @@ void getRangeFinished(Database cx,
}
}
ACTOR Future<Standalone<RangeResultRef>> getRange(Database cx,
ACTOR Future<RangeResult> getRange(Database cx,
Reference<TransactionLogInfo> trLogInfo,
Future<Version> fVersion,
KeySelector begin,
@ -3015,7 +3012,7 @@ ACTOR Future<Standalone<RangeResultRef>> getRange(Database cx,
state GetRangeLimits originalLimits(limits);
state KeySelector originalBegin = begin;
state KeySelector originalEnd = end;
state Standalone<RangeResultRef> output;
state RangeResult output;
state Span span("NAPI:getRange"_loc, info.spanID);
try {
@ -3148,8 +3145,8 @@ ACTOR Future<Standalone<RangeResultRef>> getRange(Database cx,
bool readToBegin = output.readToBegin;
bool readThroughEnd = output.readThroughEnd;
output = Standalone<RangeResultRef>(
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<Standalone<RangeResultRef>> getRange(Database cx,
TEST(true); // !GetKeyValuesReply.more and modifiedSelectors in getRange
if (!rep.data.size()) {
Standalone<RangeResultRef> result = wait(getRangeFallback(
RangeResult result = wait(getRangeFallback(
cx, version, originalBegin, originalEnd, originalLimits, reverse, info, tags));
getRangeFinished(cx,
trLogInfo,
@ -3239,7 +3236,7 @@ ACTOR Future<Standalone<RangeResultRef>> getRange(Database cx,
reverse ? (end - 1).isBackward() : begin.isBackward());
if (e.code() == error_code_wrong_shard_server) {
Standalone<RangeResultRef> result = wait(getRangeFallback(
RangeResult result = wait(getRangeFallback(
cx, version, originalBegin, originalEnd, originalLimits, reverse, info, tags));
getRangeFinished(cx,
trLogInfo,
@ -3275,7 +3272,7 @@ ACTOR Future<Standalone<RangeResultRef>> getRange(Database cx,
}
}
Future<Standalone<RangeResultRef>> getRange(Database const& cx,
Future<RangeResult> getRange(Database const& cx,
Future<Version> const& fVersion,
KeySelector const& begin,
KeySelector const& end,
@ -3504,7 +3501,7 @@ ACTOR Future<Standalone<VectorRef<const char*>>> getAddressesForKeyActor(Key key
// serverInterfaces vector being empty, which will cause us to return an empty addresses list.
state Key ksKey = keyServersKey(key);
state Standalone<RangeResultRef> serverTagResult = wait(getRange(cx,
state RangeResult serverTagResult = wait(getRange(cx,
ver,
lastLessOrEqual(serverTagKeys.begin),
firstGreaterThan(serverTagKeys.end),
@ -3513,9 +3510,9 @@ ACTOR Future<Standalone<VectorRef<const char*>>> getAddressesForKeyActor(Key key
info,
options.readTags));
ASSERT(!serverTagResult.more && serverTagResult.size() < CLIENT_KNOBS->TOO_MANY);
Future<Standalone<RangeResultRef>> futureServerUids = getRange(
Future<RangeResult> futureServerUids = getRange(
cx, ver, lastLessOrEqual(ksKey), firstGreaterThan(ksKey), GetRangeLimits(1), false, info, options.readTags);
Standalone<RangeResultRef> serverUids = wait(futureServerUids);
RangeResult serverUids = wait(futureServerUids);
ASSERT(serverUids.size()); // every shard needs to have a team
@ -3580,7 +3577,7 @@ Future<Key> Transaction::getKey(const KeySelector& key, bool snapshot) {
return getKeyAndConflictRange(cx, key, getReadVersion(), conflictRange, info, options.readTags);
}
Future<Standalone<RangeResultRef>> Transaction::getRange(const KeySelector& begin,
Future<RangeResult> Transaction::getRange(const KeySelector& begin,
const KeySelector& end,
GetRangeLimits limits,
bool snapshot,
@ -3589,7 +3586,7 @@ Future<Standalone<RangeResultRef>> Transaction::getRange(const KeySelector& begi
++cx->transactionGetRangeRequests;
if (limits.isReached())
return Standalone<RangeResultRef>();
return RangeResult();
if (!limits.isValid())
return range_limits_invalid();
@ -3610,7 +3607,7 @@ Future<Standalone<RangeResultRef>> Transaction::getRange(const KeySelector& begi
if (b.offset >= e.offset && b.getKey() >= e.getKey()) {
TEST(true); // Native range inverted
return Standalone<RangeResultRef>();
return RangeResult();
}
Promise<std::pair<Key, Key>> conflictRange;
@ -3622,7 +3619,7 @@ Future<Standalone<RangeResultRef>> Transaction::getRange(const KeySelector& begi
cx, trLogInfo, getReadVersion(), b, e, limits, conflictRange, snapshot, reverse, info, options.readTags);
}
Future<Standalone<RangeResultRef>> Transaction::getRange(const KeySelector& begin,
Future<RangeResult> Transaction::getRange(const KeySelector& begin,
const KeySelector& end,
int limit,
bool snapshot,
@ -3982,7 +3979,7 @@ ACTOR void checkWrites(Database cx,
if (m.mutated) {
checkedRanges++;
if (m.cleared) {
Standalone<RangeResultRef> 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<int64_t> rebootWorkerActor(DatabaseContext* cx, ValueRef add
state std::map<Key, std::pair<Value, ClientLeaderRegInterface>> address_interface;
if (!cx->getConnectionFile())
return 0;
Standalone<RangeResultRef> 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<FlowLock> connectLock(new FlowLock(CLIENT_KNOBS->CLI_CONNECT_PARALLELISM));

View File

@ -252,17 +252,17 @@ public:
[[nodiscard]] Future<Void> watch(Reference<Watch> watch);
[[nodiscard]] Future<Key> getKey(const KeySelector& key, bool snapshot = false);
// Future< Optional<KeyValue> > get( const KeySelectorRef& key );
[[nodiscard]] Future<Standalone<RangeResultRef>> getRange(const KeySelector& begin,
[[nodiscard]] Future<RangeResult> getRange(const KeySelector& begin,
const KeySelector& end,
int limit,
bool snapshot = false,
bool reverse = false);
[[nodiscard]] Future<Standalone<RangeResultRef>> getRange(const KeySelector& begin,
[[nodiscard]] Future<RangeResult> getRange(const KeySelector& begin,
const KeySelector& end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false);
[[nodiscard]] Future<Standalone<RangeResultRef>> getRange(const KeyRange& keys,
[[nodiscard]] Future<RangeResult> getRange(const KeyRange& keys,
int limit,
bool snapshot = false,
bool reverse = false) {
@ -272,7 +272,7 @@ public:
snapshot,
reverse);
}
[[nodiscard]] Future<Standalone<RangeResultRef>> getRange(const KeyRange& keys,
[[nodiscard]] Future<RangeResult> getRange(const KeyRange& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) {

View File

@ -347,8 +347,9 @@ void testSnapshotCache() {
}
/*
ACTOR Standalone<RangeResultRef> 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<RangeResultRef> 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 );

View File

@ -71,7 +71,7 @@ public:
: begin(begin), end(end), limits(limits) {}
KeySelector begin, end;
GetRangeLimits limits;
typedef Standalone<RangeResultRef> 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 <class Iter>
static Future<Key> read(ReadYourWritesTransaction* ryw, GetKeyReq read, Iter* it) {
if (read.key.offset > 0) {
Standalone<RangeResultRef> 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<RangeResultRef> 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 <class Iter>
static Future<Standalone<RangeResultRef>> read(ReadYourWritesTransaction* ryw, GetRangeReq<false> read, Iter* it) {
static Future<RangeResult> read(ReadYourWritesTransaction* ryw, GetRangeReq<false> read, Iter* it) {
return getRangeValue(ryw, read.begin, read.end, read.limits, it);
};
template <class Iter>
static Future<Standalone<RangeResultRef>> read(ReadYourWritesTransaction* ryw, GetRangeReq<true> read, Iter* it) {
static Future<RangeResult> read(ReadYourWritesTransaction* ryw, GetRangeReq<true> read, Iter* it) {
return getRangeValueBack(ryw, read.begin, read.end, read.limits, it);
};
@ -171,9 +171,7 @@ public:
}
ACTOR template <bool Reverse>
static Future<Standalone<RangeResultRef>> readThrough(ReadYourWritesTransaction* ryw,
GetRangeReq<Reverse> read,
bool snapshot) {
static Future<RangeResult> readThrough(ReadYourWritesTransaction* ryw, GetRangeReq<Reverse> 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<RangeResultRef> 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<RangeResultRef> _v = v;
state RangeResult _v = v;
int i = _v.size() - 2;
for (; i >= 0 && _v[i].key >= maxKey; --i) {
}
return Standalone<RangeResultRef>(RangeResultRef(VectorRef<KeyValueRef>(&_v[0], i + 1), false),
_v.arena());
return RangeResult(RangeResultRef(VectorRef<KeyValueRef>(&_v[0], i + 1), false), _v.arena());
}
}
@ -230,7 +227,7 @@ public:
static void addConflictRange(ReadYourWritesTransaction* ryw,
GetRangeReq<false> read,
WriteMap::iterator& it,
Standalone<RangeResultRef> const& result) {
RangeResult const& result) {
KeyRef rangeBegin, rangeEnd;
bool endInArena = false;
@ -265,7 +262,7 @@ public:
static void addConflictRange(ReadYourWritesTransaction* ryw,
GetRangeReq<true> read,
WriteMap::iterator& it,
Standalone<RangeResultRef> 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 <class Iter>
static Future<Standalone<RangeResultRef>> getRangeValue(ReadYourWritesTransaction* ryw,
static Future<RangeResult> getRangeValue(ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
GetRangeLimits limits,
Iter* pit) {
state Iter& it(*pit);
state Iter itEnd(*pit);
state Standalone<RangeResultRef> 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<RangeResultRef> 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 <class Iter>
static Future<Standalone<RangeResultRef>> getRangeValueBack(ReadYourWritesTransaction* ryw,
static Future<RangeResult> getRangeValueBack(ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
GetRangeLimits limits,
Iter* pit) {
state Iter& it(*pit);
state Iter itEnd(*pit);
state Standalone<RangeResultRef> 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<RangeResultRef> 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<Optional<Value>> getJSON(Database db) {
return getValueFromJSON(statusObj);
}
ACTOR Future<Standalone<RangeResultRef>> getWorkerInterfaces(Reference<ClusterConnectionFile> clusterFile) {
ACTOR Future<RangeResult> getWorkerInterfaces(Reference<ClusterConnectionFile> clusterFile) {
state Reference<AsyncVar<Optional<ClusterInterface>>> clusterInterface(new AsyncVar<Optional<ClusterInterface>>);
state Future<Void> leaderMon = monitorLeader<ClusterInterface>(clusterFile, clusterInterface);
@ -1340,7 +1335,7 @@ ACTOR Future<Standalone<RangeResultRef>> getWorkerInterfaces(Reference<ClusterCo
? brokenPromiseToNever(
clusterInterface->get().get().getClientWorkers.getReply(GetClientWorkersRequest()))
: Never())) {
Standalone<RangeResultRef> result;
RangeResult result;
for (auto& it : workers) {
result.push_back_deep(
result.arena(),
@ -1434,7 +1429,7 @@ Future<Key> ReadYourWritesTransaction::getKey(const KeySelector& key, bool snaps
return result;
}
Future<Standalone<RangeResultRef>> ReadYourWritesTransaction::getRange(KeySelector begin,
Future<RangeResult> ReadYourWritesTransaction::getRange(KeySelector begin,
KeySelector end,
GetRangeLimits limits,
bool snapshot,
@ -1450,7 +1445,7 @@ Future<Standalone<RangeResultRef>> ReadYourWritesTransaction::getRange(KeySelect
if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionFile()) {
return getWorkerInterfaces(tr.getDatabase()->getConnectionFile());
} else {
return Standalone<RangeResultRef>();
return RangeResult();
}
}
}
@ -1469,7 +1464,7 @@ Future<Standalone<RangeResultRef>> 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<RangeResultRef>();
return RangeResult();
}
if (!limits.isValid())
@ -1483,10 +1478,10 @@ Future<Standalone<RangeResultRef>> ReadYourWritesTransaction::getRange(KeySelect
if (begin.offset >= end.offset && begin.getKey() >= end.getKey()) {
TEST(true); // RYW range inverted
return Standalone<RangeResultRef>();
return RangeResult();
}
Future<Standalone<RangeResultRef>> result =
Future<RangeResult> result =
reverse ? RYWImpl::readWithConflictRange(this, RYWImpl::GetRangeReq<true>(begin, end, limits), snapshot)
: RYWImpl::readWithConflictRange(this, RYWImpl::GetRangeReq<false>(begin, end, limits), snapshot);
@ -1494,7 +1489,7 @@ Future<Standalone<RangeResultRef>> ReadYourWritesTransaction::getRange(KeySelect
return result;
}
Future<Standalone<RangeResultRef>> ReadYourWritesTransaction::getRange(const KeySelector& begin,
Future<RangeResult> ReadYourWritesTransaction::getRange(const KeySelector& begin,
const KeySelector& end,
int limit,
bool snapshot,
@ -1739,11 +1734,11 @@ void ReadYourWritesTransaction::setToken(uint64_t token) {
tr.setToken(token);
}
Standalone<RangeResultRef> 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<RangeResultRef> result;
RangeResult result;
if (!options.readYourWritesDisabled) {
kr = kr.removePrefix(readConflictRangeKeysRange.begin);
auto iter = readConflicts.rangeContainingKeyBefore(kr.begin);
@ -1781,10 +1776,10 @@ Standalone<RangeResultRef> ReadYourWritesTransaction::getReadConflictRangeInters
return result;
}
Standalone<RangeResultRef> ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRangeRef kr) {
RangeResult ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRangeRef kr) {
TEST(true); // Special keys write conflict range
ASSERT(writeConflictRangeKeysRange.contains(kr));
Standalone<RangeResultRef> result;
RangeResult result;
// Memory owned by result
CoalescedKeyRefRangeMap<ValueRef> writeConflicts{ LiteralStringRef("0"), specialKeys.end };

View File

@ -78,27 +78,24 @@ public:
Optional<Version> getCachedReadVersion() { return tr.getCachedReadVersion(); }
Future<Optional<Value>> get(const Key& key, bool snapshot = false);
Future<Key> getKey(const KeySelector& key, bool snapshot = false);
Future<Standalone<RangeResultRef>> getRange(const KeySelector& begin,
Future<RangeResult> getRange(const KeySelector& begin,
const KeySelector& end,
int limit,
bool snapshot = false,
bool reverse = false);
Future<Standalone<RangeResultRef>> getRange(KeySelector begin,
Future<RangeResult> getRange(KeySelector begin,
KeySelector end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false);
Future<Standalone<RangeResultRef>> getRange(const KeyRange& keys,
int limit,
bool snapshot = false,
bool reverse = false) {
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(const KeyRange& keys,
Future<RangeResult> getRange(const KeyRange& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) {
@ -169,9 +166,9 @@ public:
void setToken(uint64_t token);
// Read from the special key space readConflictRangeKeysRange
Standalone<RangeResultRef> getReadConflictRangeIntersecting(KeyRangeRef kr);
RangeResult getReadConflictRangeIntersecting(KeyRangeRef kr);
// Read from the special key space writeConflictRangeKeysRange
Standalone<RangeResultRef> getWriteConflictRangeIntersecting(KeyRangeRef kr);
RangeResult getWriteConflictRangeIntersecting(KeyRangeRef kr);
bool specialKeySpaceRelaxed() const { return options.specialKeySpaceRelaxed; }
bool specialKeySpaceChangeConfiguration() const { return options.specialKeySpaceChangeConfiguration; }

View File

@ -124,9 +124,7 @@ std::set<std::string> SpecialKeySpace::options = { "excluded/force", "failed/for
std::set<std::string> SpecialKeySpace::tracingOptions = { kTracingTransactionIdKey, kTracingTokenKey };
Standalone<RangeResultRef> rywGetRange(ReadYourWritesTransaction* ryw,
const KeyRangeRef& kr,
const Standalone<RangeResultRef>& 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<RangeResultRef> rywGetRange(ReadYourWritesTransaction* ryw,
ACTOR Future<Void> moveKeySelectorOverRangeActor(const SpecialKeyRangeReadImpl* skrImpl,
ReadYourWritesTransaction* ryw,
KeySelector* ks,
Optional<Standalone<RangeResultRef>>* cache) {
Optional<RangeResult>* 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<RangeResultRef> result;
state RangeResult result;
if (ks->offset < 1) {
// less than the given key
@ -164,10 +162,10 @@ ACTOR Future<Void> moveKeySelectorOverRangeActor(const SpecialKeyRangeReadImpl*
if (skrImpl->isAsync()) {
const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast<const SpecialKeyRangeAsyncImpl*>(skrImpl);
Standalone<RangeResultRef> result_ = wait(ptr->getRange(ryw, KeyRangeRef(startKey, endKey), cache));
RangeResult result_ = wait(ptr->getRange(ryw, KeyRangeRef(startKey, endKey), cache));
result = result_;
} else {
Standalone<RangeResultRef> 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<Void> normalizeKeySelectorActor(SpecialKeySpace* sks,
KeySelector* ks,
KeyRangeRef boundary,
int* actualOffset,
Standalone<RangeResultRef>* result,
Optional<Standalone<RangeResultRef>>* cache) {
RangeResult* result,
Optional<RangeResult>* 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,7 +285,7 @@ void SpecialKeySpace::modulesBoundaryInit() {
}
}
ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::checkRYWValid(SpecialKeySpace* sks,
ACTOR Future<RangeResult> SpecialKeySpace::checkRYWValid(SpecialKeySpace* sks,
ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
@ -295,7 +293,7 @@ ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::checkRYWValid(SpecialK
bool reverse) {
ASSERT(ryw);
choose {
when(Standalone<RangeResultRef> result =
when(RangeResult result =
wait(SpecialKeySpace::getRangeAggregationActor(sks, ryw, begin, end, limits, reverse))) {
return result;
}
@ -303,7 +301,7 @@ ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::checkRYWValid(SpecialK
}
}
ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::getRangeAggregationActor(SpecialKeySpace* sks,
ACTOR Future<RangeResult> SpecialKeySpace::getRangeAggregationActor(SpecialKeySpace* sks,
ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
@ -311,14 +309,14 @@ ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::getRangeAggregationAct
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<RangeResultRef> result;
state Standalone<RangeResultRef> pairs;
state RangeResult result;
state RangeResult pairs;
state RangeMap<Key, SpecialKeyRangeReadImpl*, KeyRangeRef>::iterator iter;
state int actualBeginOffset;
state int actualEndOffset;
state KeyRangeRef moduleBoundary;
// used to cache result from potential first read
state Optional<Standalone<RangeResultRef>> cache;
state Optional<RangeResult> cache;
if (ryw->specialKeySpaceRelaxed()) {
moduleBoundary = sks->range;
@ -367,10 +365,10 @@ ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::getRangeAggregationAct
KeyRef keyEnd = kr.contains(end.getKey()) ? end.getKey() : kr.end;
if (iter->value()->isAsync() && cache.present()) {
const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast<const SpecialKeyRangeAsyncImpl*>(iter->value());
Standalone<RangeResultRef> pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache));
RangeResult pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache));
pairs = pairs_;
} else {
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> SpecialKeySpace::getRangeAggregationAct
KeyRef keyEnd = kr.contains(end.getKey()) ? end.getKey() : kr.end;
if (iter->value()->isAsync() && cache.present()) {
const SpecialKeyRangeAsyncImpl* ptr = dynamic_cast<const SpecialKeyRangeAsyncImpl*>(iter->value());
Standalone<RangeResultRef> pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache));
RangeResult pairs_ = wait(ptr->getRange(ryw, KeyRangeRef(keyStart, keyEnd), &cache));
pairs = pairs_;
} else {
Standalone<RangeResultRef> 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,7 +422,7 @@ ACTOR Future<Standalone<RangeResultRef>> SpecialKeySpace::getRangeAggregationAct
return result;
}
Future<Standalone<RangeResultRef>> SpecialKeySpace::getRange(ReadYourWritesTransaction* ryw,
Future<RangeResult> SpecialKeySpace::getRange(ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
GetRangeLimits limits,
@ -434,7 +432,7 @@ Future<Standalone<RangeResultRef>> SpecialKeySpace::getRange(ReadYourWritesTrans
return range_limits_invalid();
if (limits.isReached()) {
TEST(true); // read limit 0
return Standalone<RangeResultRef>();
return RangeResult();
}
// make sure orEqual == false
begin.removeOrEqual(begin.arena());
@ -442,7 +440,7 @@ Future<Standalone<RangeResultRef>> SpecialKeySpace::getRange(ReadYourWritesTrans
if (begin.offset >= end.offset && begin.getKey() >= end.getKey()) {
TEST(true); // range inverted
return Standalone<RangeResultRef>();
return RangeResult();
}
return checkRYWValid(this, ryw, begin, end, limits, reverse);
@ -452,7 +450,7 @@ ACTOR Future<Optional<Value>> SpecialKeySpace::getActor(SpecialKeySpace* sks,
ReadYourWritesTransaction* ryw,
KeyRef key) {
// use getRange to workaround this
Standalone<RangeResultRef> result = wait(sks->getRange(ryw,
RangeResult result = wait(sks->getRange(ryw,
KeySelector(firstGreaterOrEqual(key)),
KeySelector(firstGreaterOrEqual(keyAfter(key))),
GetRangeLimits(CLIENT_KNOBS->TOO_MANY),
@ -603,7 +601,7 @@ Future<Void> SpecialKeySpace::commit(ReadYourWritesTransaction* ryw) {
SKSCTestImpl::SKSCTestImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> SKSCTestImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> 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<Optional<std::string>> SKSCTestImpl::commit(ReadYourWritesTransaction* ry
ReadConflictRangeImpl::ReadConflictRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
ACTOR static Future<Standalone<RangeResultRef>> getReadConflictRangeImpl(ReadYourWritesTransaction* ryw, KeyRange kr) {
ACTOR static Future<RangeResult> getReadConflictRangeImpl(ReadYourWritesTransaction* ryw, KeyRange kr) {
wait(ryw->pendingReads());
return ryw->getReadConflictRangeIntersecting(kr);
}
Future<Standalone<RangeResultRef>> ReadConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> ReadConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return getReadConflictRangeImpl(ryw, kr);
}
WriteConflictRangeImpl::WriteConflictRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
Future<Standalone<RangeResultRef>> WriteConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> WriteConflictRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return ryw->getWriteConflictRangeIntersecting(kr);
}
ConflictingKeysImpl::ConflictingKeysImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
Future<Standalone<RangeResultRef>> ConflictingKeysImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Standalone<RangeResultRef> result;
Future<RangeResult> 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<Standalone<RangeResultRef>> ConflictingKeysImpl::getRange(ReadYourWritesT
return result;
}
ACTOR Future<Standalone<RangeResultRef>> ddMetricsGetRangeActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ACTOR Future<RangeResult> ddMetricsGetRangeActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
loop {
try {
auto keys = kr.removePrefix(ddStatsRange.begin);
Standalone<VectorRef<DDMetricsRef>> resultWithoutPrefix = wait(
waitDataDistributionMetricsList(ryw->getDatabase(), keys, CLIENT_KNOBS->STORAGE_METRICS_SHARD_LIMIT));
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> ddMetricsGetRangeActor(ReadYourWritesTr
DDStatsRangeImpl::DDStatsRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {}
Future<Standalone<RangeResultRef>> DDStatsRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> 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<Standalone<RangeResultRef>> ManagementCommandsOptionsImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Standalone<RangeResultRef> result;
Future<RangeResult> 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<Optional<std::string>> ManagementCommandsOptionsImpl::commit(ReadYourWrit
return Optional<std::string>();
}
Standalone<RangeResultRef> rywGetRange(ReadYourWritesTransaction* ryw,
const KeyRangeRef& kr,
const Standalone<RangeResultRef>& 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<RangeResultRef> result;
RangeResult result;
RangeMap<Key, std::pair<bool, Optional<Value>>, KeyRangeRef>::Ranges ranges =
ryw->getSpecialKeySpaceWriteMap().containedRanges(kr);
RangeMap<Key, std::pair<bool, Optional<Value>>, KeyRangeRef>::iterator iter = ranges.begin();
@ -800,13 +793,13 @@ Standalone<RangeResultRef> rywGetRange(ReadYourWritesTransaction* ryw,
}
// read from those readwrite modules in which special keys have one-to-one mapping with real persisted keys
ACTOR Future<Standalone<RangeResultRef>> rwModuleWithMappingGetRangeActor(ReadYourWritesTransaction* ryw,
ACTOR Future<RangeResult> rwModuleWithMappingGetRangeActor(ReadYourWritesTransaction* ryw,
const SpecialKeyRangeRWImpl* impl,
KeyRangeRef kr) {
Standalone<RangeResultRef> resultWithoutPrefix =
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<RangeResultRef> 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<Standalone<RangeResultRef>> rwModuleWithMappingGetRangeActor(ReadYo
ExcludeServersRangeImpl::ExcludeServersRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> ExcludeServersRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> ExcludeServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return rwModuleWithMappingGetRangeActor(ryw, this, kr);
}
@ -1054,8 +1046,7 @@ Future<Optional<std::string>> ExcludeServersRangeImpl::commit(ReadYourWritesTran
FailedServersRangeImpl::FailedServersRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> FailedServersRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> FailedServersRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return rwModuleWithMappingGetRangeActor(ryw, this, kr);
}
@ -1078,10 +1069,8 @@ Future<Optional<std::string>> FailedServersRangeImpl::commit(ReadYourWritesTrans
return excludeCommitActor(ryw, true);
}
ACTOR Future<Standalone<RangeResultRef>> ExclusionInProgressActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
state Standalone<RangeResultRef> result;
ACTOR Future<RangeResult> 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<Standalone<RangeResultRef>> ExclusionInProgressActor(ReadYourWrites
state std::set<NetworkAddress> 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<RangeResultRef> 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<Standalone<RangeResultRef>> ExclusionInProgressActor(ReadYourWrites
ExclusionInProgressRangeImpl::ExclusionInProgressRangeImpl(KeyRangeRef kr) : SpecialKeyRangeAsyncImpl(kr) {}
Future<Standalone<RangeResultRef>> ExclusionInProgressRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> ExclusionInProgressRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return ExclusionInProgressActor(ryw, getKeyRange().begin, kr);
}
ACTOR Future<Standalone<RangeResultRef>> getProcessClassActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
ACTOR Future<RangeResult> getProcessClassActor(ReadYourWritesTransaction* ryw, KeyRef prefix, KeyRangeRef kr) {
vector<ProcessData> _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<RangeResultRef> 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<Optional<std::string>> processClassCommitActor(ReadYourWritesTransa
ProcessClassRangeImpl::ProcessClassRangeImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> ProcessClassRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> 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<Standalone<RangeResultRef>> getProcessClassSourceActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
ACTOR Future<RangeResult> getProcessClassSourceActor(ReadYourWritesTransaction* ryw, KeyRef prefix, KeyRangeRef kr) {
vector<ProcessData> _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<RangeResultRef> 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<Standalone<RangeResultRef>> getProcessClassSourceActor(ReadYourWrit
ProcessClassSourceRangeImpl::ProcessClassSourceRangeImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
Future<Standalone<RangeResultRef>> ProcessClassSourceRangeImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> ProcessClassSourceRangeImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return getProcessClassSourceActor(ryw, getKeyRange().begin, kr);
}
ACTOR Future<Standalone<RangeResultRef>> getLockedKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ACTOR Future<RangeResult> getLockedKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE);
Optional<Value> val = wait(ryw->getTransaction().get(databaseLockedKey));
Standalone<RangeResultRef> result;
RangeResult result;
if (val.present()) {
result.push_back_deep(result.arena(), KeyValueRef(kr.begin, val.get()));
}
@ -1301,13 +1283,13 @@ ACTOR Future<Standalone<RangeResultRef>> getLockedKeyActor(ReadYourWritesTransac
LockDatabaseImpl::LockDatabaseImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> LockDatabaseImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> 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<RangeResultRef> result;
RangeResult result;
if (lockEntry.second.present()) {
result.push_back_deep(result.arena(), KeyValueRef(kr.begin, lockEntry.second.get()));
}
@ -1358,12 +1340,12 @@ Future<Optional<std::string>> LockDatabaseImpl::commit(ReadYourWritesTransaction
}
}
ACTOR Future<Standalone<RangeResultRef>> getConsistencyCheckKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ACTOR Future<RangeResult> getConsistencyCheckKeyActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE);
ryw->getTransaction().setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Optional<Value> val = wait(ryw->getTransaction().get(fdbShouldConsistencyCheckBeSuspended));
bool ccSuspendSetting = val.present() ? BinaryReader::fromStringRef<bool>(val.get(), Unversioned()) : false;
Standalone<RangeResultRef> result;
RangeResult result;
if (ccSuspendSetting) {
result.push_back_deep(result.arena(), KeyValueRef(kr.begin, ValueRef()));
}
@ -1372,14 +1354,13 @@ ACTOR Future<Standalone<RangeResultRef>> getConsistencyCheckKeyActor(ReadYourWri
ConsistencyCheckImpl::ConsistencyCheckImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> ConsistencyCheckImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> 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<RangeResultRef> 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<Standalone<RangeResultRef>> GlobalConfigImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Standalone<RangeResultRef> result;
Future<RangeResult> GlobalConfigImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
RangeResult result;
auto& globalConfig = GlobalConfig::globalConfig();
KeyRangeRef modified =
@ -1453,7 +1434,7 @@ ACTOR Future<Optional<std::string>> 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<RangeResultRef> 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<Standalone<RangeResultRef>> TracingOptionsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Standalone<RangeResultRef> result;
Future<RangeResult> 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<Standalone<RangeResultRef>> CoordinatorsImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Standalone<RangeResultRef> result;
Future<RangeResult> 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<Standalone<RangeResultRef>> CoordinatorsAutoImplActor(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) {
state Standalone<RangeResultRef> res;
ACTOR static Future<RangeResult> CoordinatorsAutoImplActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
state RangeResult res;
state std::string autoCoordinatorsKey;
state Transaction& tr = ryw->getTransaction();
@ -1768,18 +1748,16 @@ ACTOR static Future<Standalone<RangeResultRef>> CoordinatorsAutoImplActor(ReadYo
return res;
}
Future<Standalone<RangeResultRef>> CoordinatorsAutoImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> 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<Standalone<RangeResultRef>> getMinCommitVersionActor(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) {
ACTOR static Future<RangeResult> getMinCommitVersionActor(ReadYourWritesTransaction* ryw, KeyRangeRef kr) {
ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE);
Optional<Value> val = wait(ryw->getTransaction().get(minRequiredCommitVersionKey));
Standalone<RangeResultRef> result;
RangeResult result;
if (val.present()) {
Version minRequiredCommitVersion = BinaryReader::fromStringRef<Version>(val.get(), Unversioned());
ValueRef version(result.arena(), boost::lexical_cast<std::string>(minRequiredCommitVersion));
@ -1790,13 +1768,13 @@ ACTOR static Future<Standalone<RangeResultRef>> getMinCommitVersionActor(ReadYou
AdvanceVersionImpl::AdvanceVersionImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
Future<Standalone<RangeResultRef>> AdvanceVersionImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> 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<RangeResultRef> result;
RangeResult result;
if (entry.second.present()) {
result.push_back_deep(result.arena(), KeyValueRef(kr.begin, entry.second.get()));
}
@ -1845,10 +1823,10 @@ Future<Optional<std::string>> AdvanceVersionImpl::commit(ReadYourWritesTransacti
ClientProfilingImpl::ClientProfilingImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
ACTOR static Future<Standalone<RangeResultRef>> ClientProfilingGetRangeActor(ReadYourWritesTransaction* ryw,
ACTOR static Future<RangeResult> ClientProfilingGetRangeActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
state Standalone<RangeResultRef> result;
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<Standalone<RangeResultRef>> ClientProfilingGetRangeActor(Rea
}
// TODO : add limitation on set operation
Future<Standalone<RangeResultRef>> ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return ClientProfilingGetRangeActor(ryw, getKeyRange().begin, kr);
}
@ -2032,10 +2010,10 @@ void parse(std::vector<StringRef>::iterator it, std::vector<StringRef>::iterator
}
}
ACTOR static Future<Standalone<RangeResultRef>> actorLineageGetRangeActor(ReadYourWritesTransaction* ryw,
ACTOR static Future<RangeResult> actorLineageGetRangeActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
state Standalone<RangeResultRef> result;
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<Standalone<RangeResultRef>> actorLineageGetRangeActor(ReadYo
return result;
}
Future<Standalone<RangeResultRef>> ActorLineageImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> 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<Standalone<RangeResultRef>> ActorProfilerConf::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Standalone<RangeResultRef> res;
Future<RangeResult> 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<Standalone<RangeResultRef>> MaintenanceGetRangeActor(ReadYourWritesTransaction* ryw,
ACTOR static Future<RangeResult> MaintenanceGetRangeActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
state Standalone<RangeResultRef> result;
state RangeResult result;
// zoneId
ryw->getTransaction().setOption(FDBTransactionOptions::LOCK_AWARE);
Optional<Value> val = wait(ryw->getTransaction().get(healthyZoneKey));
@ -2246,7 +2224,7 @@ ACTOR static Future<Standalone<RangeResultRef>> MaintenanceGetRangeActor(ReadYou
return rywGetRange(ryw, kr, result);
}
Future<Standalone<RangeResultRef>> MaintenanceImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
Future<RangeResult> MaintenanceImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return MaintenanceGetRangeActor(ryw, getKeyRange().begin, kr);
}
@ -2315,10 +2293,10 @@ Future<Optional<std::string>> MaintenanceImpl::commit(ReadYourWritesTransaction*
DataDistributionImpl::DataDistributionImpl(KeyRangeRef kr) : SpecialKeyRangeRWImpl(kr) {}
// Read the system keys dataDistributionModeKey and rebalanceDDIgnoreKey
ACTOR static Future<Standalone<RangeResultRef>> DataDistributionGetRangeActor(ReadYourWritesTransaction* ryw,
ACTOR static Future<RangeResult> DataDistributionGetRangeActor(ReadYourWritesTransaction* ryw,
KeyRef prefix,
KeyRangeRef kr) {
state Standalone<RangeResultRef> result;
state RangeResult result;
// dataDistributionModeKey
state Key modeKey = LiteralStringRef("mode").withPrefix(prefix);
if (kr.contains(modeKey)) {
@ -2346,8 +2324,7 @@ ACTOR static Future<Standalone<RangeResultRef>> DataDistributionGetRangeActor(Re
return rywGetRange(ryw, kr, result);
}
Future<Standalone<RangeResultRef>> DataDistributionImpl::getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr) const {
Future<RangeResult> DataDistributionImpl::getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const {
return DataDistributionGetRangeActor(ryw, getKeyRange().begin, kr);
}

View File

@ -36,7 +36,7 @@
class SpecialKeyRangeReadImpl {
public:
// Each derived class only needs to implement this simple version of getRange
virtual Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const = 0;
virtual Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override = 0;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override = 0;
// calling with a cache object to have consistent results if we need to call rpc
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw,
KeyRangeRef kr,
Optional<Standalone<RangeResultRef>>* cache) const {
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr, Optional<RangeResult>* cache) const {
return getRangeAsyncActor(this, ryw, kr, cache);
}
bool isAsync() const override { return true; }
ACTOR static Future<Standalone<RangeResultRef>> getRangeAsyncActor(const SpecialKeyRangeReadImpl* skrAyncImpl,
ACTOR static Future<RangeResult> getRangeAsyncActor(const SpecialKeyRangeReadImpl* skrAyncImpl,
ReadYourWritesTransaction* ryw,
KeyRangeRef kr,
Optional<Standalone<RangeResultRef>>* cache) {
Optional<RangeResult>* 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef>();
return RangeResult();
}
};
@ -168,7 +166,7 @@ public:
Future<Optional<Value>> get(ReadYourWritesTransaction* ryw, const Key& key);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw,
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
GetRangeLimits limits,
@ -214,13 +212,13 @@ public:
private:
ACTOR static Future<Optional<Value>> getActor(SpecialKeySpace* sks, ReadYourWritesTransaction* ryw, KeyRef key);
ACTOR static Future<Standalone<RangeResultRef>> checkRYWValid(SpecialKeySpace* sks,
ACTOR static Future<RangeResult> checkRYWValid(SpecialKeySpace* sks,
ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
GetRangeLimits limits,
bool reverse);
ACTOR static Future<Standalone<RangeResultRef>> getRangeAggregationActor(SpecialKeySpace* sks,
ACTOR static Future<RangeResult> getRangeAggregationActor(SpecialKeySpace* sks,
ReadYourWritesTransaction* ryw,
KeySelector begin,
KeySelector end,
@ -247,7 +245,7 @@ private:
class SKSCTestImpl : public SpecialKeyRangeRWImpl {
public:
explicit SKSCTestImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};
@ -260,31 +258,31 @@ public:
class ConflictingKeysImpl : public SpecialKeyRangeReadImpl {
public:
explicit ConflictingKeysImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class ReadConflictRangeImpl : public SpecialKeyRangeReadImpl {
public:
explicit ReadConflictRangeImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class WriteConflictRangeImpl : public SpecialKeyRangeReadImpl {
public:
explicit WriteConflictRangeImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class DDStatsRangeImpl : public SpecialKeyRangeAsyncImpl {
public:
explicit DDStatsRangeImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class ManagementCommandsOptionsImpl : public SpecialKeyRangeRWImpl {
public:
explicit ManagementCommandsOptionsImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class ProcessClassRangeImpl : public SpecialKeyRangeRWImpl {
public:
explicit ProcessClassRangeImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class LockDatabaseImpl : public SpecialKeyRangeRWImpl {
public:
explicit LockDatabaseImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};
class ConsistencyCheckImpl : public SpecialKeyRangeRWImpl {
public:
explicit ConsistencyCheckImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};
class GlobalConfigImpl : public SpecialKeyRangeRWImpl {
public:
explicit GlobalConfigImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
Future<Optional<std::string>> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
Future<Optional<std::string>> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
};
class AdvanceVersionImpl : public SpecialKeyRangeRWImpl {
public:
explicit AdvanceVersionImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};
class ClientProfilingImpl : public SpecialKeyRangeRWImpl {
public:
explicit ClientProfilingImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};
class DataDistributionImpl : public SpecialKeyRangeRWImpl {
public:
explicit DataDistributionImpl(KeyRangeRef kr);
Future<Standalone<RangeResultRef>> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw, KeyRangeRef kr) const override;
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
};

View File

@ -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<RangeResultRef> result,
const std::vector<UID>& src,
const std::vector<UID>& dest) {
const Value keyServersValue(RangeResult result, const std::vector<UID>& src, const std::vector<UID>& 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<Tag>& srcTag, const std::vector<Ta
return wr.toValue();
}
void decodeKeyServersValue(Standalone<RangeResultRef> result,
void decodeKeyServersValue(RangeResult result,
const ValueRef& value,
std::vector<UID>& src,
std::vector<UID>& dest,

View File

@ -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<RangeResultRef> result,
const Value keyServersValue(RangeResult result,
const std::vector<UID>& src,
const std::vector<UID>& dest = std::vector<UID>());
const Value keyServersValue(const std::vector<Tag>& srcTag, const std::vector<Tag>& destTag = std::vector<Tag>());
// `result` must be the full result of getting serverTagKeys
void decodeKeyServersValue(Standalone<RangeResultRef> result,
void decodeKeyServersValue(RangeResult result,
const ValueRef& value,
std::vector<UID>& src,
std::vector<UID>& dest,

View File

@ -179,7 +179,7 @@ ACTOR Future<std::vector<TagThrottleInfo>> getThrottledTags(Database db, int lim
if (!containsRecommend) {
wait(store(reportAuto, getValidAutoEnabled(&tr, db)));
}
Standalone<RangeResultRef> throttles = wait(tr.getRange(
RangeResult throttles = wait(tr.getRange(
reportAuto ? tagThrottleKeys : KeyRangeRef(tagThrottleKeysPrefix, tagThrottleAutoKeysPrefix), limit));
std::vector<TagThrottleInfo> results;
for (auto throttle : throttles) {
@ -202,7 +202,7 @@ ACTOR Future<std::vector<TagThrottleInfo>> getRecommendedTags(Database db, int l
return std::vector<TagThrottleInfo>();
}
Standalone<RangeResultRef> throttles =
RangeResult throttles =
wait(tr.getRange(KeyRangeRef(tagThrottleAutoKeysPrefix, tagThrottleKeys.end), limit));
std::vector<TagThrottleInfo> results;
for (auto throttle : throttles) {
@ -339,7 +339,7 @@ ACTOR Future<bool> unthrottleMatchingThrottles(Database db,
loop {
try {
state Standalone<RangeResultRef> 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) {

View File

@ -243,8 +243,7 @@ public:
state Reference<Task> task(new Task());
task->key = taskUID;
state Standalone<RangeResultRef> 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<Future<Standalone<RangeResultRef>>> resultFutures;
state std::vector<Future<RangeResult>> 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<RangeResultRef> results = wait(resultFutures[i]);
RangeResult results = wait(resultFutures[i]);
if (results.size() > 0)
return false;
}
Standalone<RangeResultRef> 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<Future<Standalone<RangeResultRef>>> resultFutures;
state std::vector<Future<RangeResult>> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<Void> debugPrintRange(Reference<ReadYourWritesTransaction> tr, Subspace subspace, Key msg) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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<RangeResultRef> 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<bool> isSet(Reference<ReadYourWritesTransaction> tr, Reference<TaskFuture> taskFuture) {
taskFuture->futureBucket->setOptions(tr);
Standalone<RangeResultRef> 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) {
taskFuture->futureBucket->setOptions(tr);
Standalone<RangeResultRef> 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<Future<Void>> actions;

View File

@ -217,7 +217,7 @@ ThreadFuture<Standalone<VectorRef<KeyRef>>> ThreadSafeTransaction::getRangeSplit
});
}
ThreadFuture<Standalone<RangeResultRef>> ThreadSafeTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> ThreadSafeTransaction::getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot,
@ -226,13 +226,13 @@ ThreadFuture<Standalone<RangeResultRef>> ThreadSafeTransaction::getRange(const K
KeySelector e = end;
ReadYourWritesTransaction* tr = this->tr;
return onMainThread([tr, b, e, limit, snapshot, reverse]() -> Future<Standalone<RangeResultRef>> {
return onMainThread([tr, b, e, limit, snapshot, reverse]() -> Future<RangeResult> {
tr->checkDeferredError();
return tr->getRange(b, e, limit, snapshot, reverse);
});
}
ThreadFuture<Standalone<RangeResultRef>> ThreadSafeTransaction::getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> ThreadSafeTransaction::getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot,
@ -241,7 +241,7 @@ ThreadFuture<Standalone<RangeResultRef>> ThreadSafeTransaction::getRange(const K
KeySelector e = end;
ReadYourWritesTransaction* tr = this->tr;
return onMainThread([tr, b, e, limits, snapshot, reverse]() -> Future<Standalone<RangeResultRef>> {
return onMainThread([tr, b, e, limits, snapshot, reverse]() -> Future<RangeResult> {
tr->checkDeferredError();
return tr->getRange(b, e, limits, snapshot, reverse);
});

View File

@ -79,23 +79,23 @@ public:
ThreadFuture<Optional<Value>> get(const KeyRef& key, bool snapshot = false) override;
ThreadFuture<Key> getKey(const KeySelectorRef& key, bool snapshot = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
int limit,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeySelectorRef& begin,
ThreadFuture<RangeResult> getRange(const KeySelectorRef& begin,
const KeySelectorRef& end,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override;
ThreadFuture<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> 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<Standalone<RangeResultRef>> getRange(const KeyRangeRef& keys,
ThreadFuture<RangeResult> getRange(const KeyRangeRef& keys,
GetRangeLimits limits,
bool snapshot = false,
bool reverse = false) override {

View File

@ -84,7 +84,7 @@ void applyMetadataMutations(SpanID const& spanContext,
vector<UID> 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<Standalone<RangeResultRef>> fResult = txnStateStore->readRange(serverTagKeys);
Future<RangeResult> fResult = txnStateStore->readRange(serverTagKeys);
decodeKeyServersValue(fResult.get(), m.param2, src, dest);
ASSERT(storageCache);

View File

@ -153,7 +153,7 @@ ACTOR Future<Void> getBackupProgress(Database cx, UID dbgid, Reference<BackupPro
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
state Future<Optional<Value>> fValue = tr.get(backupStartedKey);
state Standalone<RangeResultRef> 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> value = wait(fValue);

View File

@ -2595,7 +2595,7 @@ public:
std::map<Optional<Standalone<StringRef>>, WorkerInfo> id_worker;
std::map<Optional<Standalone<StringRef>>, ProcessClass>
id_class; // contains the mapping from process id to process class from the database
Standalone<RangeResultRef> lastProcessClasses;
RangeResult lastProcessClasses;
bool gotProcessClasses;
bool gotFullyRecoveredConfig;
Optional<Standalone<StringRef>> masterProcessId;
@ -3642,7 +3642,7 @@ ACTOR Future<Void> monitorProcessClasses(ClusterControllerData* self) {
if (val.present())
break;
Standalone<RangeResultRef> 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<Void> monitorProcessClasses(ClusterControllerData* self) {
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Standalone<RangeResultRef> 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<Void> monitorGlobalConfig(ClusterControllerData::DBInfo* db) {
// Since the history keys end with versionstamps, they
// should be sorted correctly (versionstamps are stored in
// big-endian order).
Standalone<RangeResultRef> 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.

View File

@ -1515,8 +1515,7 @@ ACTOR static Future<Void> rejoinServer(CommitProxyInterface proxy, ProxyCommitDa
GetStorageServerRejoinInfoReply rep;
rep.version = commitData->version;
rep.tag = decodeServerTagValue(commitData->txnStateStore->readValue(serverTagKeyFor(req.id)).get().get());
Standalone<RangeResultRef> 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,14 +1939,14 @@ ACTOR Future<Void> commitProxyServerCore(CommitProxyInterface proxy,
if (txnSequences.size() == maxSequence) {
state KeyRange txnKeys = allKeys;
Standalone<RangeResultRef> UIDtoTagMap = commitData.txnStateStore->readRange(serverTagKeys).get();
RangeResult UIDtoTagMap = commitData.txnStateStore->readRange(serverTagKeys).get();
state std::map<Tag, UID> tag_uid;
for (const KeyValueRef& kv : UIDtoTagMap) {
tag_uid[decodeServerTagValue(kv.value)] = decodeServerTagKey(kv.key);
}
loop {
wait(yield());
Standalone<RangeResultRef> data = commitData.txnStateStore
RangeResult data = commitData.txnStateStore
->readRange(txnKeys,
SERVER_KNOBS->BUGGIFIED_ROW_LIMIT,
SERVER_KNOBS->APPLY_MUTATION_BYTES)

View File

@ -480,7 +480,7 @@ struct LeaderRegisterCollection {
if (!self->pStore->exists())
return Void();
OnDemandStore& store = *self->pStore;
Standalone<RangeResultRef> forwardingInfo = wait(store->readRange(fwdKeys));
RangeResult forwardingInfo = wait(store->readRange(fwdKeys));
for (int i = 0; i < forwardingInfo.size(); i++) {
LeaderInfo forwardInfo;
forwardInfo.forward = true;

View File

@ -435,7 +435,7 @@ ACTOR Future<Reference<InitialDataDistribution>> getInitialDataDistribution(Data
}
state Future<vector<ProcessData>> workers = getWorkers(&tr);
state Future<Standalone<RangeResultRef>> serverList = tr.getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> 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,9 +469,9 @@ ACTOR Future<Reference<InitialDataDistribution>> getInitialDataDistribution(Data
try {
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
wait(checkMoveKeysLockReadOnly(&tr, moveKeysLock, ddEnabledState));
state Standalone<RangeResultRef> 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<RangeResultRef> keyServers = wait(krmGetRanges(&tr,
RangeResult keyServers = wait(krmGetRanges(&tr,
keyServersPrefix,
KeyRangeRef(beginKey, allKeys.end),
SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT,
@ -3657,16 +3657,14 @@ ACTOR Future<Void> trackExcludedServers(DDTeamCollection* self) {
loop {
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
state Future<Standalone<RangeResultRef>> fresultsExclude =
tr.getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> fresultsFailed =
tr.getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fresultsExclude = tr.getRange(excludedServersKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fresultsFailed = tr.getRange(failedServersKeys, CLIENT_KNOBS->TOO_MANY);
wait(success(fresultsExclude) && success(fresultsFailed));
Standalone<RangeResultRef> excludedResults = fresultsExclude.get();
RangeResult excludedResults = fresultsExclude.get();
ASSERT(!excludedResults.more && excludedResults.size() < CLIENT_KNOBS->TOO_MANY);
Standalone<RangeResultRef> failedResults = fresultsFailed.get();
RangeResult failedResults = fresultsFailed.get();
ASSERT(!failedResults.more && failedResults.size() < CLIENT_KNOBS->TOO_MANY);
std::set<AddressExclusion> excluded;
@ -3720,7 +3718,7 @@ ACTOR Future<Void> trackExcludedServers(DDTeamCollection* self) {
ACTOR Future<vector<std::pair<StorageServerInterface, ProcessClass>>> getServerListAndProcessClasses(Transaction* tr) {
state Future<vector<ProcessData>> workers = getWorkers(tr);
state Future<Standalone<RangeResultRef>> serverList = tr->getRange(serverListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> 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<Void> debugCheckCoalescing(Database cx) {
state Transaction tr(cx);
loop {
try {
state Standalone<RangeResultRef> 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<RangeResultRef> 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<Void> dataDistribution(Reference<DataDistributorData> self,
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Standalone<RangeResultRef> 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<Void> cacheServerWatcher(Database* db) {
loop {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
try {
Standalone<RangeResultRef> range = wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY));
RangeResult range = wait(tr.getRange(storageCacheServerKeys, CLIENT_KNOBS->TOO_MANY));
ASSERT(!range.more);
std::set<UID> caches;
for (auto& kv : range) {

View File

@ -595,10 +595,9 @@ struct DDQueueData {
servers.clear();
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
try {
state Standalone<RangeResultRef> 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<RangeResultRef> keyServersEntries =
wait(tr.getRange(lastLessOrEqual(keyServersKey(input.keys.begin)),
RangeResult keyServersEntries = wait(tr.getRange(lastLessOrEqual(keyServersKey(input.keys.begin)),
firstGreaterOrEqual(keyServersKey(input.keys.end)),
SERVER_KNOBS->DD_QUEUE_MAX_KEY_SERVERS));
@ -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<RangeResultRef> 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)

View File

@ -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<Standalone<RangeResultRef>> readRange(KeyRangeRef keys,
int rowLimit = 1 << 30,
int byteLimit = 1 << 30) = 0;
virtual Future<RangeResult> 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

View File

@ -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<Standalone<RangeResultRef>> readRange(KeyRangeRef keys,
int rowLimit = 1 << 30,
int byteLimit = 1 << 30) override {
Future<RangeResult> 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<Standalone<RangeResultRef>> doReadRange(IKeyValueStore* store,
KeyRangeRef keys,
int rowLimit,
int byteLimit) {
Standalone<RangeResultRef> _vs = wait(store->readRange(keys, rowLimit, byteLimit));
Standalone<RangeResultRef> vs = _vs; // Get rid of implicit const& from wait statement
ACTOR Future<RangeResult> 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));

View File

@ -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<Standalone<RangeResultRef>> readRange(KeyRangeRef keys,
int rowLimit = 1 << 30,
int byteLimit = 1 << 30) override {
Future<RangeResult> 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<RangeResultRef> result;
RangeResult result;
if (rowLimit == 0) {
return result;
}
@ -835,7 +833,7 @@ private:
wait(self->recovering);
return self->readValuePrefix(key, maxLength).get();
}
ACTOR static Future<Standalone<RangeResultRef>> waitAndReadRange(KeyValueStoreMemory* self,
ACTOR static Future<RangeResult> waitAndReadRange(KeyValueStoreMemory* self,
KeyRange keys,
int rowLimit,
int byteLimit) {

View File

@ -290,13 +290,13 @@ struct RocksDBKeyValueStore : IKeyValueStore {
struct ReadRangeAction : TypedAction<Reader, ReadRangeAction>, FastAllocated<ReadRangeAction> {
KeyRange keys;
int rowLimit, byteLimit;
ThreadReturnPromise<Standalone<RangeResultRef>> result;
ThreadReturnPromise<RangeResult> 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<RangeResultRef> result;
RangeResult result;
if (a.rowLimit == 0 || a.byteLimit == 0) {
a.result.send(result);
}
@ -446,7 +446,7 @@ struct RocksDBKeyValueStore : IKeyValueStore {
return res;
}
Future<Standalone<RangeResultRef>> readRange(KeyRangeRef keys, int rowLimit, int byteLimit) override {
Future<RangeResult> readRange(KeyRangeRef keys, int rowLimit, int byteLimit) override {
auto a = new Reader::ReadRangeAction(keys, rowLimit, byteLimit);
auto res = a->result.getFuture();
readThreads->post(a);

View File

@ -1145,8 +1145,8 @@ struct RawCursor {
}
return Optional<Value>();
}
Standalone<RangeResultRef> getRange(KeyRangeRef keys, int rowLimit, int byteLimit) {
Standalone<RangeResultRef> 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<Optional<Value>> readValue(KeyRef key, Optional<UID> debugID) override;
Future<Optional<Value>> readValuePrefix(KeyRef key, int maxLength, Optional<UID> debugID) override;
Future<Standalone<RangeResultRef>> readRange(KeyRangeRef keys,
int rowLimit = 1 << 30,
int byteLimit = 1 << 30) override;
Future<RangeResult> 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<Reader, ReadRangeAction>, FastAllocated<ReadRangeAction> {
KeyRange keys;
int rowLimit, byteLimit;
ThreadReturnPromise<Standalone<RangeResultRef>> result;
ThreadReturnPromise<RangeResult> 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<Optional<Value>> KeyValueStoreSQLite::readValuePrefix(KeyRef key, int max
readThreads->post(p);
return f;
}
Future<Standalone<RangeResultRef>> KeyValueStoreSQLite::readRange(KeyRangeRef keys, int rowLimit, int byteLimit) {
Future<RangeResult> KeyValueStoreSQLite::readRange(KeyRangeRef keys, int rowLimit, int byteLimit) {
++readsRequested;
auto p = new Reader::ReadRangeAction(keys, rowLimit, byteLimit);
auto f = p->result.getFuture();

View File

@ -182,7 +182,7 @@ public:
// levelKey is the prefix for the entire level, no timestamp at the end
ACTOR static Future<Optional<Standalone<StringRef>>> getLastBlock_impl(ReadYourWritesTransaction* tr,
Standalone<StringRef> levelKey) {
Standalone<RangeResultRef> 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<Standalone<StringRef>>();

View File

@ -234,11 +234,11 @@ ACTOR Future<vector<UID>> addReadWriteDestinations(KeyRangeRef shard,
return result;
}
ACTOR Future<vector<vector<UID>>> additionalSources(Standalone<RangeResultRef> shards,
ACTOR Future<vector<vector<UID>>> additionalSources(RangeResult shards,
Transaction* tr,
int desiredHealthy,
int maxServers) {
state Standalone<RangeResultRef> 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<Future<Optional<Value>>> serverListEntries;
std::set<UID> fetching;
@ -380,7 +380,7 @@ ACTOR static Future<Void> 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<RangeResultRef> old = wait(krmGetRanges(&tr,
state RangeResult old = wait(krmGetRanges(&tr,
keyServersPrefix,
currentKeys,
SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT,
@ -399,8 +399,7 @@ ACTOR static Future<Void> 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<RangeResultRef> 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<vector<UID>> addAsSource = wait(additionalSources(
old, &tr, servers.size(), SERVER_KNOBS->MAX_ADDED_SOURCES_MULTIPLIER * servers.size()));
@ -630,11 +629,9 @@ ACTOR static Future<Void> finishMoveKeys(Database occ,
wait(checkMoveKeysLock(&tr, lock, ddEnabledState));
state KeyRange currentKeys = KeyRangeRef(begin, keys.end);
state Standalone<RangeResultRef> 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<RangeResultRef> keyServers =
wait(krmGetRanges(&tr,
state RangeResult keyServers = wait(krmGetRanges(&tr,
keyServersPrefix,
currentKeys,
SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT,
@ -869,8 +866,7 @@ ACTOR Future<std::pair<Version, Tag>> addStorageServer(Database cx, StorageServe
state int maxSkipTags = 1;
loop {
try {
state Future<Standalone<RangeResultRef>> fTagLocalities =
tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fTagLocalities = tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Optional<Value>> fv = tr.get(serverListKeyFor(server.id()));
state Future<Optional<Value>> fExclProc = tr.get(
@ -901,9 +897,8 @@ ACTOR Future<std::pair<Version, Tag>> addStorageServer(Database cx, StorageServe
? tr.get(StringRef(encodeFailedServersKey(AddressExclusion(server.secondaryAddress().get().ip))))
: Future<Optional<Value>>(Optional<Value>());
state Future<Standalone<RangeResultRef>> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY, true);
state Future<Standalone<RangeResultRef>> fHistoryTags =
tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY, true);
state Future<RangeResult> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY, true);
state Future<RangeResult> 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<std::pair<Version, Tag>> 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<bool> canRemoveStorageServer(Transaction* tr, UID serverID) {
Standalone<RangeResultRef> 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<Void> removeStorageServer(Database cx,
} else {
state Future<Optional<Value>> fListKey = tr.get(serverListKeyFor(serverID));
state Future<Standalone<RangeResultRef>> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> fHistoryTags =
tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> fTagLocalities =
tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> fTLogDatacenters =
tr.getRange(tLogDatacentersKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fTags = tr.getRange(serverTagKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fHistoryTags = tr.getRange(serverTagHistoryKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fTagLocalities = tr.getRange(tagLocalityListKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fTLogDatacenters = tr.getRange(tLogDatacentersKeys, CLIENT_KNOBS->TOO_MANY);
wait(success(fListKey) && success(fTags) && success(fHistoryTags) && success(fTagLocalities) &&
success(fTLogDatacenters));
@ -1122,10 +1114,9 @@ ACTOR Future<Void> 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<RangeResultRef> 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<RangeResultRef> keyServers =
wait(krmGetRanges(&tr,
state RangeResult keyServers = wait(krmGetRanges(&tr,
keyServersPrefix,
KeyRangeRef(begin, allKeys.end),
SERVER_KNOBS->MOVE_KEYS_KRM_LIMIT,
@ -1248,7 +1239,7 @@ void seedShardServers(Arena& arena, CommitTransactionRef& tr, vector<StorageServ
}
auto ksValue = CLIENT_KNOBS->TAG_ENCODE_KEY_SERVERS ? keyServersValue(serverTags)
: keyServersValue(Standalone<RangeResultRef>(), 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)

View File

@ -1063,7 +1063,7 @@ ACTOR Future<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
peekMessagesFromMemory(logData, req, messages2, endVersion);
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self, LocalityData locality)
IKeyValueStore* storage = self->persistentData;
state Future<Optional<Value>> fFormat = storage->readValue(persistFormat.key);
state Future<Standalone<RangeResultRef>> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<Standalone<RangeResultRef>> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<RangeResult> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<RangeResult> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
// FIXME: metadata in queue?
@ -1407,8 +1407,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self, LocalityData locality)
}
if (!fFormat.get().present()) {
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self, LocalityData locality)
loop {
if (logData->removed.isReady())
break;
Standalone<RangeResultRef> 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);

View File

@ -1357,7 +1357,7 @@ ACTOR Future<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
peekMessagesFromMemory(logData, req, messages2, endVersion);
}
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
state IKeyValueStore* storage = self->persistentData;
wait(storage->init());
state Future<Optional<Value>> fFormat = storage->readValue(persistFormat.key);
state Future<Standalone<RangeResultRef>> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<Standalone<RangeResultRef>> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<Standalone<RangeResultRef>> fLocality = storage->readRange(persistLocalityKeys);
state Future<Standalone<RangeResultRef>> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<Standalone<RangeResultRef>> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<Standalone<RangeResultRef>> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<RangeResult> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<RangeResult> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<RangeResult> fLocality = storage->readRange(persistLocalityKeys);
state Future<RangeResult> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<RangeResult> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<RangeResult> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
// FIXME: metadata in queue?
@ -2258,8 +2258,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
}
if (!fFormat.get().present()) {
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
loop {
if (logData->removed.isReady())
break;
Standalone<RangeResultRef> 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);

View File

@ -828,7 +828,7 @@ ACTOR Future<Void> updatePoppedLocation(TLogData* self, Reference<LogData> 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<RangeResultRef> 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<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
}
if (req.tag.locality == tagLocalityTxs || req.tag == txsTag) {
Standalone<RangeResultRef> 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<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
}
} else {
// FIXME: Limit to approximately DESIRED_TOTATL_BYTES somehow.
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
wait(storage->init());
state Future<Optional<Value>> fFormat = storage->readValue(persistFormat.key);
state Future<Optional<Value>> fRecoveryLocation = storage->readValue(persistRecoveryLocationKey);
state Future<Standalone<RangeResultRef>> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<Standalone<RangeResultRef>> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<Standalone<RangeResultRef>> fLocality = storage->readRange(persistLocalityKeys);
state Future<Standalone<RangeResultRef>> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<Standalone<RangeResultRef>> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<Standalone<RangeResultRef>> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<Standalone<RangeResultRef>> fProtocolVersions = storage->readRange(persistProtocolVersionKeys);
state Future<RangeResult> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<RangeResult> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<RangeResult> fLocality = storage->readRange(persistLocalityKeys);
state Future<RangeResult> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<RangeResult> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<RangeResult> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<RangeResult> fProtocolVersions = storage->readRange(persistProtocolVersionKeys);
// FIXME: metadata in queue?
@ -2711,8 +2711,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
}
if (!fFormat.get().present()) {
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
loop {
if (logData->removed.isReady())
break;
Standalone<RangeResultRef> 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);

View File

@ -229,7 +229,7 @@ ACTOR Future<vector<StorageServerInterface>> getStorageServers(Database cx, bool
}
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
try {
Standalone<RangeResultRef> 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<StorageServerInterface> servers;

View File

@ -784,8 +784,7 @@ ACTOR Future<Void> monitorThrottlingChanges(RatekeeperData* self) {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
state Future<Standalone<RangeResultRef>> throttledTagKeys =
tr.getRange(tagThrottleKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> throttledTagKeys = tr.getRange(tagThrottleKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Optional<Value>> autoThrottlingEnabled = tr.get(tagThrottleAutoEnabledKey);
if (!committed) {
@ -1388,7 +1387,7 @@ ACTOR Future<Void> configurationMonitor(RatekeeperData* self) {
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Standalone<RangeResultRef> 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<KeyValueRef>)results);

View File

@ -722,8 +722,7 @@ ACTOR static Future<std::vector<RestoreRequest>> collectRestoreRequests(Database
Optional<Value> numRequests = wait(tr.get(restoreRequestTriggerKey));
ASSERT(numRequests.present());
Standalone<RangeResultRef> 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) {

View File

@ -153,7 +153,7 @@ ACTOR Future<Void> collectRestoreWorkerInterface(Reference<RestoreWorkerData> se
tr.reset();
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> 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

View File

@ -1410,10 +1410,9 @@ ACTOR static Future<Void> logRangeWarningFetcher(Database cx,
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
state Future<Standalone<RangeResultRef>> existingDestUidValues =
state Future<RangeResult> existingDestUidValues =
tr.getRange(KeyRangeRef(destUidLookupPrefix, strinc(destUidLookupPrefix)), CLIENT_KNOBS->TOO_MANY);
state Future<Standalone<RangeResultRef>> existingLogRanges =
tr.getRange(logRangesRange, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> existingLogRanges = tr.getRange(logRangesRange, CLIENT_KNOBS->TOO_MANY);
wait((success(existingDestUidValues) && success(existingLogRanges)) || timeoutFuture);
std::set<LogRangeAndUID> loggingRanges;
@ -1494,8 +1493,7 @@ loadConfiguration(Database cx, JsonBuilderArray* messages, std::set<std::string>
tr.setOption(FDBTransactionOptions::CAUSAL_READ_RISKY);
try {
choose {
when(Standalone<RangeResultRef> 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<JsonBuilderObject> layerStatusFetcher(Database cx,
tr.setOption(FDBTransactionOptions::TIMEOUT, StringRef((uint8_t*)&timeout_ms, sizeof(int64_t)));
std::string jsonPrefix = layerStatusMetaPrefixRange.begin.toString() + "json/";
Standalone<RangeResultRef> 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<Future<Standalone<RangeResultRef>>> docFutures;
state std::vector<Future<RangeResult>> docFutures;
state int i;
for (i = 0; i < jsonLayers.size(); ++i)
docFutures.push_back(
@ -2536,7 +2533,7 @@ ACTOR Future<JsonBuilderObject> layerStatusFetcher(Database cx,
JSONDoc::expires_reference_version = (uint64_t)tr.getReadVersion().get();
for (i = 0; i < docFutures.size(); ++i) {
state Standalone<RangeResultRef> 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<Optional<Value>> getActivePrimaryDC(Database cx, int* fullyReplicat
}
tr.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
state Future<Standalone<RangeResultRef>> fReplicaKeys =
tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY);
state Future<RangeResult> fReplicaKeys = tr.getRange(datacenterReplicasKeys, CLIENT_KNOBS->TOO_MANY);
state Future<Optional<Value>> fPrimaryDatacenterKey = tr.get(primaryDatacenterKey);
wait(timeoutError(success(fPrimaryDatacenterKey) && success(fReplicaKeys), 5));

View File

@ -1174,13 +1174,13 @@ void coalesceCacheRanges(StorageCacheData* data, KeyRangeRef keys) {
}
}
ACTOR Future<Standalone<RangeResultRef>> tryFetchRange(Database cx,
ACTOR Future<RangeResult> tryFetchRange(Database cx,
Version version,
KeyRangeRef keys,
GetRangeLimits limits,
bool* isTooOld) {
state Transaction tr(cx);
state Standalone<RangeResultRef> output;
state RangeResult output;
state KeySelectorRef begin = firstGreaterOrEqual(keys.begin);
state KeySelectorRef end = firstGreaterOrEqual(keys.end);
@ -1194,7 +1194,7 @@ ACTOR Future<Standalone<RangeResultRef>> tryFetchRange(Database cx,
try {
loop {
Standalone<RangeResultRef> 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<Void> fetchKeys(StorageCacheData* data, AddingCacheRange* cacheRang
try {
TEST(true); // Fetching keys for transferred cacheRange
state Standalone<RangeResultRef> this_block =
state RangeResult this_block =
wait(tryFetchRange(data->cx,
fetchVersion,
keys,
@ -1367,7 +1367,7 @@ ACTOR Future<Void> fetchKeys(StorageCacheData* data, AddingCacheRange* cacheRang
throw please_reboot();
}
this_block = Standalone<RangeResultRef>();
this_block = RangeResult();
if (BUGGIFY)
wait(delay(1));
@ -2099,7 +2099,7 @@ ACTOR Future<Void> storageCacheStartUpWarmup(StorageCacheData* self) {
tr.setOption(FDBTransactionOptions::READ_LOCK_AWARE);
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
try {
Standalone<RangeResultRef> 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;

View File

@ -867,7 +867,7 @@ ACTOR Future<Void> updatePoppedLocation(TLogData* self, Reference<LogData> 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<RangeResultRef> 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<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
}
if (logData->shouldSpillByValue(req.tag)) {
Standalone<RangeResultRef> 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<Void> tLogPeekMessages(TLogData* self, TLogPeekRequest req, Referen
}
} else {
// FIXME: Limit to approximately DESIRED_TOTATL_BYTES somehow.
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
wait(storage->init());
state Future<Optional<Value>> fFormat = storage->readValue(persistFormat.key);
state Future<Optional<Value>> fRecoveryLocation = storage->readValue(persistRecoveryLocationKey);
state Future<Standalone<RangeResultRef>> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<Standalone<RangeResultRef>> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<Standalone<RangeResultRef>> fLocality = storage->readRange(persistLocalityKeys);
state Future<Standalone<RangeResultRef>> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<Standalone<RangeResultRef>> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<Standalone<RangeResultRef>> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<Standalone<RangeResultRef>> fProtocolVersions = storage->readRange(persistProtocolVersionKeys);
state Future<Standalone<RangeResultRef>> fTLogSpillTypes = storage->readRange(persistTLogSpillTypeKeys);
state Future<RangeResult> fVers = storage->readRange(persistCurrentVersionKeys);
state Future<RangeResult> fKnownCommitted = storage->readRange(persistKnownCommittedVersionKeys);
state Future<RangeResult> fLocality = storage->readRange(persistLocalityKeys);
state Future<RangeResult> fLogRouterTags = storage->readRange(persistLogRouterTagsKeys);
state Future<RangeResult> fTxsTags = storage->readRange(persistTxsTagsKeys);
state Future<RangeResult> fRecoverCounts = storage->readRange(persistRecoveryCountKeys);
state Future<RangeResult> fProtocolVersions = storage->readRange(persistProtocolVersionKeys);
state Future<RangeResult> fTLogSpillTypes = storage->readRange(persistTLogSpillTypeKeys);
// FIXME: metadata in queue?
@ -2776,8 +2776,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
}
if (!fFormat.get().present()) {
Standalone<RangeResultRef> 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<Void> restorePersistentState(TLogData* self,
loop {
if (logData->removed.isReady())
break;
Standalone<RangeResultRef> 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);

View File

@ -6026,14 +6026,12 @@ public:
m_tree->set(keyValue);
}
Future<Standalone<RangeResultRef>> readRange(KeyRangeRef keys,
int rowLimit = 1 << 30,
int byteLimit = 1 << 30) override {
Future<RangeResult> 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<Standalone<RangeResultRef>> readRange_impl(KeyValueStoreRedwoodUnversioned* self,
ACTOR static Future<RangeResult> readRange_impl(KeyValueStoreRedwoodUnversioned* self,
KeyRange keys,
int rowLimit,
int byteLimit) {
@ -6045,7 +6043,7 @@ public:
state FlowLock::Releaser releaser(*readLock);
++g_redwoodMetrics.opGetRange;
state Standalone<RangeResultRef> result;
state RangeResult result;
state int accumulatedBytes = 0;
ASSERT(byteLimit > 0);
@ -8687,7 +8685,7 @@ ACTOR Future<Void> randomRangeScans(IKeyValueStore* kvs,
KeyRangeRef range = source.getKeyRangeRef(singlePrefix, suffixSize);
int rowLim = (deterministicRandom()->randomInt(0, 2) != 0) ? rowLimit : -rowLimit;
Standalone<RangeResultRef> result = wait(kvs->readRange(range, rowLim));
RangeResult result = wait(kvs->readRange(range, rowLim));
recordsRead += result.size();
bytesRead += result.size() * recordSize;

View File

@ -436,7 +436,7 @@ ACTOR Future<Void> dumpDatabase(Database cx, std::string outputFilename, KeyRang
fprintf(output, "<h3>Database version: %" PRId64 "</h3>", ver);
loop {
Standalone<RangeResultRef> 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, "<p>%s <b>:=</b> %s</p>\n", key.c_str(), value.c_str());

View File

@ -825,7 +825,7 @@ ACTOR Future<Void> readTransactionSystemState(Reference<MasterData> self,
.detail("LastEpochEnd", self->lastEpochEnd)
.detail("RecoveryTransactionVersion", self->recoveryTransactionVersion);
Standalone<RangeResultRef> rawConf = wait(self->txnStateStore->readRange(configKeys));
RangeResult rawConf = wait(self->txnStateStore->readRange(configKeys));
self->configuration.fromKeyValues(rawConf.castTo<VectorRef<KeyValueRef>>());
self->originalConfiguration = self->configuration;
self->hasConfiguration = true;
@ -836,13 +836,13 @@ ACTOR Future<Void> readTransactionSystemState(Reference<MasterData> self,
.detail("Conf", self->configuration.toString())
.trackLatest("RecoveredConfig");
Standalone<RangeResultRef> 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<RangeResultRef> 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<Void> readTransactionSystemState(Reference<MasterData> self,
}
}
Standalone<RangeResultRef> 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<Void> sendInitialCommitToResolvers(Reference<MasterData> self) {
state Sequence txnSequence = 0;
ASSERT(self->recoveryTransactionVersion);
state Standalone<RangeResultRef> 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<Void> sendInitialCommitToResolvers(Reference<MasterData> self) {
if (!data.size())
break;
((KeyRangeRef&)txnKeys) = KeyRangeRef(keyAfter(data.back().key, txnKeys.arena()), txnKeys.end);
Standalone<RangeResultRef> 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<Void> configurationMonitor(Reference<MasterData> self, Database cx)
loop {
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
Standalone<RangeResultRef> 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;

View File

@ -212,7 +212,7 @@ ACTOR Future<Void> updateFeedWatchers(Transaction* tr, uint64_t feed) {
state bool first = true;
loop {
// Grab watching inboxes in swaths of 100
state Standalone<RangeResultRef> 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<uint64_t> _postMessage(Database cx, uint64_t feed, Standalone<Strin
}
// Get globally latest message, set our ID to that less one
state Standalone<RangeResultRef> 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<int> singlePassInboxCacheUpdate(Database cx, uint64_t inbox, int sw
loop {
try {
// For each stale feed, update cache with latest message id
state Standalone<RangeResultRef> staleFeeds =
state RangeResult staleFeeds =
wait(tr.getRange(firstGreaterOrEqual(keyForInboxStaleFeed(inbox, 0)),
firstGreaterOrEqual(keyForInboxStaleFeed(inbox, UINT64_MAX)),
swath)); // REVIEW: does 100 make sense?
@ -376,8 +376,7 @@ ACTOR Future<Void> updateInboxCache(Database cx, uint64_t inbox) {
}
ACTOR Future<MessageId> getFeedLatestAtOrAfter(Transaction* tr, Feed feed, MessageId position) {
state Standalone<RangeResultRef> lastMessageRange =
wait((*tr).getRange(firstGreaterOrEqual(keyForFeedMessage(feed, position)),
state RangeResult lastMessageRange = wait((*tr).getRange(firstGreaterOrEqual(keyForFeedMessage(feed, position)),
firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)),
1));
if (!lastMessageRange.size())
@ -413,8 +412,7 @@ ACTOR Future<std::vector<Message>> _listInboxMessages(Database cx, uint64_t inbo
// Fetch all cached entries for all the feeds to which we are subscribed
Optional<Value> cntValue = wait(tr.get(keyForInboxSubcriptionCount(inbox)));
uint64_t subscriptions = valueToUInt64(cntValue.get());
state Standalone<RangeResultRef> feeds =
wait(tr.getRange(firstGreaterOrEqual(keyForInboxCacheByID(inbox, 0)),
state RangeResult feeds = wait(tr.getRange(firstGreaterOrEqual(keyForInboxCacheByID(inbox, 0)),
firstGreaterOrEqual(keyForInboxCacheByID(inbox, UINT64_MAX)),
subscriptions));
if (!feeds.size())
@ -444,8 +442,7 @@ ACTOR Future<std::vector<Message>> _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<RangeResultRef> dispatching =
wait(tr.getRange(firstGreaterOrEqual(keyForDisptchEntry(earliestMessage)),
RangeResult dispatching = wait(tr.getRange(firstGreaterOrEqual(keyForDisptchEntry(earliestMessage)),
firstGreaterOrEqual(keyForDisptchEntry(UINT64_MAX)),
1));
// If there are messages "older" than ours, try this again
@ -487,8 +484,7 @@ ACTOR Future<std::vector<Message>> _listFeedMessages(Database cx, Feed feed, int
TraceEvent("PubSubListFeed").detail("Feed", feed).detail("Count", count).detail("Cursor", cursor);
loop {
try {
state Standalone<RangeResultRef> messageIds =
wait(tr.getRange(firstGreaterOrEqual(keyForFeedMessage(feed, cursor)),
state RangeResult messageIds = wait(tr.getRange(firstGreaterOrEqual(keyForFeedMessage(feed, cursor)),
firstGreaterOrEqual(keyForFeedMessage(feed, UINT64_MAX)),
count));
if (!messageIds.size())

View File

@ -187,7 +187,7 @@ struct StorageServerDisk {
Future<Optional<Value>> readValuePrefix(KeyRef key, int maxLength, Optional<UID> debugID = Optional<UID>()) {
return storage->readValuePrefix(key, maxLength, debugID);
}
Future<Standalone<RangeResultRef>> readRange(KeyRangeRef keys, int rowLimit = 1 << 30, int byteLimit = 1 << 30) {
Future<RangeResult> 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<MutationRef>& mutations, Version debugVersion, const char* debugContext);
ACTOR static Future<Key> readFirstKey(IKeyValueStore* storage, KeyRangeRef range) {
Standalone<RangeResultRef> 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<Void> getShardStateQ(StorageServer* data, GetShardStateRequest req)
void merge(Arena& arena,
VectorRef<KeyValueRef, VecSerStrategy::String>& output,
VectorRef<KeyValueRef> const& vm_output,
Standalone<RangeResultRef> const& base,
RangeResult const& base,
int& vCount,
int limit,
bool stopAtEndOfBase,
@ -1557,7 +1557,7 @@ ACTOR Future<GetKeyValuesReply> 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<RangeResultRef> atStorageVersion =
RangeResult atStorageVersion =
wait(data->storage.readRange(KeyRangeRef(readBegin, readEnd), limit, *pLimitBytes));
ASSERT(atStorageVersion.size() <= limit);
@ -1638,7 +1638,7 @@ ACTOR Future<GetKeyValuesReply> readRange(StorageServer* data,
readBegin = vCurrent ? std::max(vCurrent->isClearTo() ? vCurrent->getEndKey() : vCurrent.key(), range.begin)
: range.begin;
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> tryGetRange(Database cx,
ACTOR Future<RangeResult> tryGetRange(Database cx,
Version version,
KeyRangeRef keys,
GetRangeLimits limits,
bool* isTooOld) {
state Transaction tr(cx);
state Standalone<RangeResultRef> output;
state RangeResult output;
state KeySelectorRef begin = firstGreaterOrEqual(keys.begin);
state KeySelectorRef end = firstGreaterOrEqual(keys.end);
@ -2412,7 +2412,7 @@ ACTOR Future<Standalone<RangeResultRef>> tryGetRange(Database cx,
try {
loop {
Standalone<RangeResultRef> 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<Void> fetchKeys(StorageServer* data, AddingShard* shard) {
try {
TEST(true); // Fetching keys for transferred shard
state Standalone<RangeResultRef> this_block =
state RangeResult this_block =
wait(tryGetRange(data->cx,
fetchVersion,
keys,
@ -2701,7 +2701,7 @@ ACTOR Future<Void> fetchKeys(StorageServer* data, AddingShard* shard) {
}
}
this_block = Standalone<RangeResultRef>();
this_block = RangeResult();
if (BUGGIFY)
wait(delay(1));
@ -3819,7 +3819,7 @@ ACTOR Future<Void> applyByteSampleResult(StorageServer* data,
state int totalKeys = 0;
state int totalBytes = 0;
loop {
Standalone<RangeResultRef> 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<VectorRef<KeyValueRef>>());
@ -3922,8 +3922,8 @@ ACTOR Future<bool> restoreDurableState(StorageServer* data, IKeyValueStore* stor
state Future<Optional<Value>> fVersion = storage->readValue(persistVersion);
state Future<Optional<Value>> fLogProtocol = storage->readValue(persistLogProtocol);
state Future<Optional<Value>> fPrimaryLocality = storage->readValue(persistPrimaryLocality);
state Future<Standalone<RangeResultRef>> fShardAssigned = storage->readRange(persistShardAssignedKeys);
state Future<Standalone<RangeResultRef>> fShardAvailable = storage->readRange(persistShardAvailableKeys);
state Future<RangeResult> fShardAssigned = storage->readRange(persistShardAssignedKeys);
state Future<RangeResult> fShardAvailable = storage->readRange(persistShardAvailableKeys);
state Promise<Void> byteSampleSampleRecovered;
state Promise<Void> startByteSampleRestore;
@ -3963,7 +3963,7 @@ ACTOR Future<bool> restoreDurableState(StorageServer* data, IKeyValueStore* stor
debug_checkRestoredVersion(data->thisServerID, version, "StorageServer");
data->setInitialVersion(version);
state Standalone<RangeResultRef> 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<bool> restoreDurableState(StorageServer* data, IKeyValueStore* stor
wait(yield());
}
state Standalone<RangeResultRef> 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),

View File

@ -447,10 +447,10 @@ public:
state bool reverse = deterministicRandom()->random01() > 0.5 ? false : true;
// Get the range from memory
state Standalone<RangeResultRef> 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<RangeResultRef> dbResults;
state RangeResult dbResults;
state Version readVersion;
state Reference<TransactionWrapper> transaction = self->createTransaction();
@ -461,7 +461,7 @@ public:
readVersion = version;
KeyRangeRef range(start, end);
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> dbResults;
state RangeResult dbResults;
state Reference<TransactionWrapper> transaction = self->createTransaction();
state Version readVersion;
@ -547,8 +546,7 @@ public:
Version version = wait(transaction->getReadVersion());
readVersion = version;
Standalone<RangeResultRef> 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++) {

View File

@ -167,15 +167,14 @@ ACTOR Future<bool> compareDatabaseToMemory(ApiWorkload* self) {
loop {
// Fetch a subset of the results from each of the database and the memory store and compare them
state Standalone<RangeResultRef> storeResults =
self->store.getRange(KeyRangeRef(startKey, endKey), resultsPerRange, false);
state RangeResult storeResults = self->store.getRange(KeyRangeRef(startKey, endKey), resultsPerRange, false);
state Reference<TransactionWrapper> transaction = self->createTransaction();
state KeyRangeRef range(startKey, endKey);
loop {
try {
state Standalone<RangeResultRef> 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());

View File

@ -46,13 +46,10 @@ struct TransactionWrapper : public ReferenceCounted<TransactionWrapper> {
virtual Future<Optional<Value>> get(KeyRef& key) = 0;
// Gets a range of key-value pairs from the database specified by a key range
virtual Future<Standalone<RangeResultRef>> getRange(KeyRangeRef& keys, int limit, bool reverse) = 0;
virtual Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(KeySelectorRef& begin,
KeySelectorRef& end,
int limit,
bool reverse) = 0;
virtual Future<RangeResult> getRange(KeySelectorRef& begin, KeySelectorRef& end, int limit, bool reverse) = 0;
// Gets the key from the database specified by a given key selector
virtual Future<Key> getKey(KeySelectorRef& key) = 0;
@ -104,15 +101,12 @@ struct FlowTransactionWrapper : public TransactionWrapper {
Future<Optional<Value>> get(KeyRef& key) override { return transaction.get(key); }
// Gets a range of key-value pairs from the database specified by a key range
Future<Standalone<RangeResultRef>> getRange(KeyRangeRef& keys, int limit, bool reverse) override {
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(KeySelectorRef& begin,
KeySelectorRef& end,
int limit,
bool reverse) override {
Future<RangeResult> 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<Optional<Value>> 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<Standalone<RangeResultRef>> getRange(KeyRangeRef& keys, int limit, bool reverse) override {
Future<RangeResult> 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<Standalone<RangeResultRef>> getRange(KeySelectorRef& begin,
KeySelectorRef& end,
int limit,
bool reverse) override {
Future<RangeResult> getRange(KeySelectorRef& begin, KeySelectorRef& end, int limit, bool reverse) override {
return unsafeThreadFutureToFuture(transaction->getRange(begin, end, limit, false, reverse));
}

View File

@ -148,8 +148,7 @@ struct AtomicOpsWorkload : TestWorkload {
loop {
try {
Key begin(std::string("log"));
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<Key, Key> records; // <ops, debugKey>
Standalone<RangeResultRef> 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<Key, int64_t> logVal; // debugKey, log's value
Standalone<RangeResultRef> 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<Key, int64_t> opsVal; // ops key, ops value
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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)));

View File

@ -92,9 +92,8 @@ struct AtomicSwitchoverWorkload : TestWorkload {
state Transaction tr2(dest);
try {
loop {
state Future<Standalone<RangeResultRef>> srcFuture =
tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<Standalone<RangeResultRef>> bkpFuture =
state Future<RangeResult> srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<RangeResult> bkpFuture =
tr2.getRange(KeyRangeRef(begin, range.end).withPrefix(backupPrefix), 1000);
wait(success(srcFuture) && success(bkpFuture));

View File

@ -87,7 +87,7 @@ struct BackgroundSelectorWorkload : TestWorkload {
state Key endKey;
state int diff;
state Transaction tr(cx);
state Standalone<RangeResultRef> rangeResult;
state RangeResult rangeResult;
state Standalone<StringRef> startResult;
state Standalone<StringRef> endResult;
state int startDrift;
@ -148,7 +148,7 @@ struct BackgroundSelectorWorkload : TestWorkload {
loop {
try {
if (diff < 0) {
Standalone<RangeResultRef> rangeResult_ =
RangeResult rangeResult_ =
wait(tr.getRange(randomizedSelector(endKey, true, endDrift),
randomizedSelector(startKey, true, startDrift + 1),
self->resultLimit));
@ -160,8 +160,7 @@ struct BackgroundSelectorWorkload : TestWorkload {
wait(tr.getKey(randomizedSelector(endKey, true, endDrift)));
startResult = startResult_;
} else {
Standalone<RangeResultRef> rangeResult_ =
wait(tr.getRange(randomizedSelector(startKey, true, startDrift),
RangeResult rangeResult_ = wait(tr.getRange(randomizedSelector(startKey, true, startDrift),
randomizedSelector(endKey, true, endDrift + 1),
self->resultLimit));
rangeResult = rangeResult_;

View File

@ -360,7 +360,7 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
state int rowCount = 0;
loop {
try {
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> versions = wait(tr->getRange(
RangeResult versions = wait(tr->getRange(
KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1));
if (!self->shareLogRange || !versions.size()) {
Standalone<RangeResultRef> 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

View File

@ -187,7 +187,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
for (restoreIndex = 0; restoreIndex < self->skippedRestoreRanges.size(); restoreIndex++) {
state KeyRangeRef range = self->skippedRestoreRanges[restoreIndex];
Standalone<StringRef> restoreTag(self->backupTag.toString() + "_" + std::to_string(restoreIndex));
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> versions = wait(tr->getRange(
RangeResult versions = wait(tr->getRange(
KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1));
if (!self->shareLogRange || !versions.size()) {
Standalone<RangeResultRef> 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

View File

@ -148,19 +148,19 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
void getMetrics(vector<PerfMetric>& m) override {}
// Reads a series of key ranges and returns each range.
ACTOR static Future<std::vector<Standalone<RangeResultRef>>> readRanges(Database cx,
ACTOR static Future<std::vector<RangeResult>> readRanges(Database cx,
Standalone<VectorRef<KeyRangeRef>> ranges,
StringRef removePrefix) {
loop {
state Transaction tr(cx);
try {
state std::vector<Future<Standalone<RangeResultRef>>> results;
state std::vector<Future<RangeResult>> results;
for (auto& range : ranges) {
results.push_back(tr.getRange(range.removePrefix(removePrefix), 1000));
}
wait(waitForAll(results));
std::vector<Standalone<RangeResultRef>> ret;
std::vector<RangeResult> 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<Standalone<RangeResultRef>> srcFuture =
tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<Standalone<RangeResultRef>> bkpFuture =
state Future<RangeResult> srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<RangeResult> 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<RangeResultRef> 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<RangeResultRef> versions = wait(
RangeResult versions = wait(
tr->getRange(KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1));
if (!shareLogRange || !versions.size()) {
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> res1 = wait(readRanges(cx, restoreRange, self->backupPrefix));
state std::vector<RangeResult> res1 = wait(readRanges(cx, restoreRange, self->backupPrefix));
wait(delay(5));
state std::vector<Standalone<RangeResultRef>> res2 = wait(readRanges(cx, restoreRange, self->backupPrefix));
state std::vector<RangeResult> 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);

View File

@ -204,7 +204,7 @@ struct BackupToDBUpgradeWorkload : TestWorkload {
printf("BackupCorrectnessLeftoverLogTasks: %ld\n", (long)taskCount);
}
Standalone<RangeResultRef> 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<RangeResultRef> versions = wait(
RangeResult versions = wait(
tr->getRange(KeyRange(KeyRangeRef(backupLatestVersionsPath, strinc(backupLatestVersionsPath))), 1));
if (!versions.size()) {
Standalone<RangeResultRef> 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<Standalone<RangeResultRef>> srcFuture =
tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<Standalone<RangeResultRef>> bkpFuture =
state Future<RangeResult> srcFuture = tr.getRange(KeyRangeRef(begin, range.end), 1000);
state Future<RangeResult> bkpFuture =
tr2.getRange(KeyRangeRef(begin, range.end).withPrefix(backupPrefix), 1000);
wait(success(srcFuture) && success(bkpFuture));

View File

@ -217,7 +217,7 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
std::string getTrId(KeyRef key) const { return key.substr(trIdStartIndex, trIdFormatSize).toString(); }
bool checkTxInfoEntriesFormat(const Standalone<RangeResultRef>& txInfoEntries) {
bool checkTxInfoEntriesFormat(const RangeResult& txInfoEntries) {
std::string val;
std::map<std::string, std::vector<ValueRef>> 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<RangeResultRef> txInfoEntries;
state RangeResult txInfoEntries;
Optional<Value> ctrValue =
wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Optional<Value>> {
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<RangeResultRef> 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());

View File

@ -82,7 +82,7 @@ struct ConflictRangeWorkload : TestWorkload {
state int randomLimit;
state bool randomSets = false;
state std::set<int> insertedSet;
state Standalone<RangeResultRef> originalResults;
state RangeResult originalResults;
state Standalone<StringRef> firstElement;
state std::set<int> clearedSet;
@ -154,8 +154,7 @@ struct ConflictRangeWorkload : TestWorkload {
offsetB = deterministicRandom()->randomInt(-1 * self->maxOffset, self->maxOffset);
randomLimit = deterministicRandom()->randomInt(1, self->maxKeySpace);
Standalone<RangeResultRef> res =
wait(tr1.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
RangeResult res = wait(tr1.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB),
randomLimit));
if (res.size()) {
@ -219,15 +218,13 @@ struct ConflictRangeWorkload : TestWorkload {
if (self->testReadYourWrites) {
trRYOW.clear(KeyRangeRef(StringRef(format("%010d", clearedBegin)),
StringRef(format("%010d", clearedEnd))));
Standalone<RangeResultRef> res =
wait(trRYOW.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
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<RangeResultRef> res =
wait(tr3.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
RangeResult res = wait(tr3.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB),
randomLimit));
wait(tr3.commit());
@ -248,8 +245,7 @@ struct ConflictRangeWorkload : TestWorkload {
tr1 = Transaction(cx);
}
Standalone<RangeResultRef> res =
wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
RangeResult res = wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB),
randomLimit));
++self->withConflicts;
@ -312,7 +308,7 @@ struct ConflictRangeWorkload : TestWorkload {
.detail("Original", keyStr2);
tr4 = Transaction(cx);
Standalone<RangeResultRef> res = wait(tr4.getRange(
RangeResult res = wait(tr4.getRange(
KeyRangeRef(StringRef(format("%010d", 0)), StringRef(format("%010d", self->maxKeySpace))),
200));
std::string allKeyEntries = "";
@ -325,8 +321,7 @@ struct ConflictRangeWorkload : TestWorkload {
throw not_committed();
} else {
// If the commit is successful, check that the result matches the first execution.
Standalone<RangeResultRef> res =
wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
RangeResult res = wait(tr4.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB),
randomLimit));
++self->withoutConflicts;

View File

@ -210,7 +210,7 @@ struct ConsistencyCheckWorkload : TestWorkload {
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
loop {
try {
Standalone<RangeResultRef> 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<RangeResultRef> currentLocations = krmDecodeRanges(
RangeResult currentLocations = krmDecodeRanges(
keyServersPrefix,
KeyRangeRef(beginKey.removePrefix(keyServersPrefix),
std::min<KeyRef>(shards[i].first.end, endKey).removePrefix(keyServersPrefix)),
@ -1174,7 +1174,7 @@ struct ConsistencyCheckWorkload : TestWorkload {
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
state int bytesReadInRange = 0;
Standalone<RangeResultRef> 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);

View File

@ -250,8 +250,7 @@ struct CycleWorkload : TestWorkload {
loop {
try {
state Version v = wait(tr.getReadVersion());
Standalone<RangeResultRef> data =
wait(tr.getRange(firstGreaterOrEqual(doubleToTestKey(0.0, self->keyPrefix)),
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;

View File

@ -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<RangeResultRef> 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<ReadYourWritesTransaction> tr = makeReference<ReadYourWritesTransaction>(cx);
try {
state Standalone<RangeResultRef> 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<RangeResultRef> 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

View File

@ -89,7 +89,7 @@ struct DiskDurabilityTest : TestWorkload {
state Transaction tr(db);
loop {
try {
state Standalone<RangeResultRef> 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++) {

View File

@ -280,8 +280,7 @@ struct FileSystemWorkload : TestWorkload {
if (self->loggingQueries)
TraceEvent("UserQuery").detail("UserID", userID).detail("PathBase", base);
Key keyEnd(base + "/updated0");
Standalone<RangeResultRef> 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<RangeResultRef> val = wait(tr->getRange(begin, end, transferSize));
RangeResult val = wait(tr->getRange(begin, end, transferSize));
transfered = val.size();
deletedFiles += transfered;
begin = begin + transfered;

View File

@ -679,8 +679,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
}
};
struct TestGetRange0 : public BaseTest<TestGetRange0, Standalone<RangeResultRef>> {
typedef BaseTest<TestGetRange0, Standalone<RangeResultRef>> base_type;
struct TestGetRange0 : public BaseTest<TestGetRange0, RangeResult> {
typedef BaseTest<TestGetRange0, RangeResult> base_type;
KeySelector keysel1, keysel2;
int limit;
@ -730,8 +730,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
}
};
struct TestGetRange1 : public BaseTest<TestGetRange1, Standalone<RangeResultRef>> {
typedef BaseTest<TestGetRange1, Standalone<RangeResultRef>> base_type;
struct TestGetRange1 : public BaseTest<TestGetRange1, RangeResult> {
typedef BaseTest<TestGetRange1, RangeResult> base_type;
KeySelector keysel1, keysel2;
GetRangeLimits limits;
@ -776,8 +776,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
}
};
struct TestGetRange2 : public BaseTest<TestGetRange2, Standalone<RangeResultRef>> {
typedef BaseTest<TestGetRange2, Standalone<RangeResultRef>> base_type;
struct TestGetRange2 : public BaseTest<TestGetRange2, RangeResult> {
typedef BaseTest<TestGetRange2, RangeResult> base_type;
Key key1, key2;
int limit;
@ -836,8 +836,8 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
}
};
struct TestGetRange3 : public BaseTest<TestGetRange3, Standalone<RangeResultRef>> {
typedef BaseTest<TestGetRange3, Standalone<RangeResultRef>> base_type;
struct TestGetRange3 : public BaseTest<TestGetRange3, RangeResult> {
typedef BaseTest<TestGetRange3, RangeResult> base_type;
Key key1, key2;
GetRangeLimits limits;

View File

@ -161,8 +161,7 @@ struct Increment : TestWorkload {
loop {
try {
state Version v = wait(tr.getReadVersion());
Standalone<RangeResultRef> data =
wait(tr.getRange(firstGreaterOrEqual(intToTestKey(0)),
RangeResult data = wait(tr.getRange(firstGreaterOrEqual(intToTestKey(0)),
firstGreaterOrEqual(intToTestKey(self->nodeCount)),
self->nodeCount + 1));
ok = self->incrementCheckData(data, v, self) && ok;

View File

@ -120,7 +120,7 @@ struct IndexScanWorkload : KVWorkload {
try {
loop {
Standalone<RangeResultRef> 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) {

View File

@ -116,7 +116,7 @@ struct InventoryTestWorkload : TestWorkload {
state Transaction tr(cx);
loop {
try {
Standalone<RangeResultRef> data = wait(tr.getRange(
RangeResult data = wait(tr.getRange(
firstGreaterOrEqual(doubleToTestKey(0)), firstGreaterOrEqual(doubleToTestKey(1)), self->nProducts));
std::map<Key, int> actualResults;

View File

@ -270,8 +270,7 @@ ACTOR Future<Void> testKVStoreMain(KVStoreTestWorkload* workload, KVTest* ptest)
state Key k;
state double cst = timer();
while (true) {
Standalone<RangeResultRef> 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;

View File

@ -30,7 +30,7 @@ ACTOR Future<StorageServerInterface> getRandomStorage(Database cx) {
try {
tr.reset();
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
Standalone<RangeResultRef> 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);

View File

@ -50,12 +50,12 @@ struct LockDatabaseWorkload : TestWorkload {
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Standalone<RangeResultRef>> lockAndSave(Database cx, LockDatabaseWorkload* self, UID lockID) {
ACTOR static Future<RangeResult> lockAndSave(Database cx, LockDatabaseWorkload* self, UID lockID) {
state Transaction tr(cx);
loop {
try {
wait(lockDatabase(&tr, lockID));
state Standalone<RangeResultRef> 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<Void> unlockAndCheck(Database cx,
LockDatabaseWorkload* self,
UID lockID,
Standalone<RangeResultRef> data) {
ACTOR static Future<Void> 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<RangeResultRef> 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<Void> lockWorker(Database cx, LockDatabaseWorkload* self) {
state UID lockID = deterministicRandom()->randomUniqueID();
wait(delay(self->lockAfter));
state Standalone<RangeResultRef> data = wait(lockAndSave(cx, self, lockID));
state RangeResult data = wait(lockAndSave(cx, self, lockID));
state Future<Void> checker = checkLocked(cx, self);
wait(delay(self->unlockAfter - self->lockAfter));
checker.cancel();

View File

@ -78,8 +78,8 @@ Key MemoryKeyValueStore::getKey(KeySelectorRef selector) const {
}
// Gets a range of key-value pairs, returning a maximum of <limit> results
Standalone<RangeResultRef> MemoryKeyValueStore::getRange(KeyRangeRef range, int limit, bool reverse) const {
Standalone<RangeResultRef> results;
RangeResult MemoryKeyValueStore::getRange(KeyRangeRef range, int limit, bool reverse) const {
RangeResult results;
if (!reverse) {
std::map<Key, Value>::const_iterator mapItr = store.lower_bound(range.begin);

View File

@ -38,7 +38,7 @@ public:
Key getKey(KeySelectorRef selector) const;
// Gets a range of key-value pairs, returning a maximum of <limit> results
Standalone<RangeResultRef> 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);

View File

@ -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<RangeResultRef> 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<RangeResultRef> 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++) {

View File

@ -118,13 +118,13 @@ struct RYWPerformanceWorkload : TestWorkload {
tr->clear(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 1)));
}
} else if (type == 9) {
std::vector<Future<Standalone<RangeResultRef>>> gets;
std::vector<Future<RangeResult>> 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<Future<Standalone<RangeResultRef>>> gets;
std::vector<Future<RangeResult>> 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<Future<Standalone<RangeResultRef>>> gets;
std::vector<Future<RangeResult>> 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<Future<Standalone<RangeResultRef>>> gets;
std::vector<Future<RangeResult>> 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<Future<Standalone<RangeResultRef>>> gets;
std::vector<Future<RangeResult>> gets;
for (i = 0; i < self->nodes; i++) {
gets.push_back(tr->getRange(KeyRangeRef(self->keyForIndex(i), self->keyForIndex(i + 2)), self->nodes));
}

View File

@ -51,7 +51,7 @@ struct MoveKeysWorkload : TestWorkload {
state Transaction tr(cx);
loop {
try {
Standalone<RangeResultRef> 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);

View File

@ -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<RangeResultRef> getRangeTest1;
Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> finalTest1 = wait(finalTransaction.getRange(
state RangeResult finalTest1 = wait(finalTransaction.getRange(
KeyRangeRef(StringRef(clientID + "b/"), StringRef(clientID + "c/")), self->maxKeySpace));
Standalone<RangeResultRef> finalTest2 = wait(finalTransaction.getRange(
RangeResult finalTest2 = wait(finalTransaction.getRange(
KeyRangeRef(StringRef(clientID + "d/"), StringRef(clientID + "e/")), self->maxKeySpace));
if (finalTest1.size() != finalTest2.size()) {

View File

@ -481,14 +481,14 @@ struct ReadWriteWorkload : KVWorkload {
return Void();
}
ACTOR static Future<Void> logLatency(Future<Standalone<RangeResultRef>> f,
ACTOR static Future<Void> logLatency(Future<RangeResult> f,
ContinuousSample<double>* latencies,
double* totalLatency,
int* latencyCount,
EventMetricHandle<ReadMetric> readMetric,
bool shouldRecord) {
state double readBegin = now();
Standalone<RangeResultRef> value = wait(f);
RangeResult value = wait(f);
double latency = now() - readBegin;
readMetric->readLatency = latency * 1e9;
@ -816,12 +816,12 @@ ACTOR Future<std::vector<std::pair<uint64_t, double>>> trackInsertionCount(Datab
while (currentCountIndex < countsOfInterest.size()) {
try {
state Future<Standalone<RangeResultRef>> countFuture = tr.getRange(keyPrefix, 1000000000);
state Future<Standalone<RangeResultRef>> bytesFuture = tr.getRange(bytesPrefix, 1000000000);
state Future<RangeResult> countFuture = tr.getRange(keyPrefix, 1000000000);
state Future<RangeResult> bytesFuture = tr.getRange(bytesPrefix, 1000000000);
wait(success(countFuture) && success(bytesFuture));
Standalone<RangeResultRef> counts = countFuture.get();
Standalone<RangeResultRef> bytes = bytesFuture.get();
RangeResult counts = countFuture.get();
RangeResult bytes = bytesFuture.get();
uint64_t numInserted = 0;
for (int i = 0; i < counts.size(); i++)

View File

@ -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<Standalone<RangeResultRef>> conflictingKeyRangesFuture =
tr2->getRange(ckr, CLIENT_KNOBS->TOO_MANY);
Future<RangeResult> conflictingKeyRangesFuture = tr2->getRange(ckr, CLIENT_KNOBS->TOO_MANY);
ASSERT(conflictingKeyRangesFuture.isReady());
tr2 = makeReference<ReadYourWritesTransaction>(cx);
const Standalone<RangeResultRef> conflictingKeyRanges = conflictingKeyRangesFuture.get();
const RangeResult conflictingKeyRanges = conflictingKeyRangesFuture.get();
ASSERT(conflictingKeyRanges.size() &&
(conflictingKeyRanges.size() <= readConflictRanges.size() * 2));
ASSERT(conflictingKeyRanges.size() % 2 == 0);

View File

@ -139,8 +139,8 @@ struct RyowCorrectnessWorkload : ApiWorkload {
}
// Adds a single KV-pair to the list of results
void pushKVPair(std::vector<Standalone<RangeResultRef>>& results, Key const& key, Optional<Value> const& value) {
Standalone<RangeResultRef> result;
void pushKVPair(std::vector<RangeResult>& results, Key const& key, Optional<Value> 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<Standalone<RangeResultRef>> applySequenceToStore(std::vector<Operation> sequence) {
std::vector<Standalone<RangeResultRef>> results;
std::vector<RangeResult> applySequenceToStore(std::vector<Operation> sequence) {
std::vector<RangeResult> 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<std::vector<Standalone<RangeResultRef>>> applySequenceToDatabase(
Reference<TransactionWrapper> transaction,
ACTOR Future<std::vector<RangeResult>> applySequenceToDatabase(Reference<TransactionWrapper> transaction,
std::vector<Operation> sequence,
RyowCorrectnessWorkload* self) {
state bool dontUpdateResults = false;
state std::vector<Standalone<RangeResultRef>> results;
state std::vector<RangeResult> 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<RangeResultRef> 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<RangeResultRef> 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<Standalone<RangeResultRef>> dbResults,
std::vector<Standalone<RangeResultRef>> storeResults,
bool compareResults(std::vector<RangeResult> dbResults,
std::vector<RangeResult> storeResults,
std::vector<Operation> sequence,
Version readVersion) {
ASSERT(storeResults.size() == dbResults.size());
@ -334,9 +333,8 @@ struct RyowCorrectnessWorkload : ApiWorkload {
loop {
state Reference<TransactionWrapper> transaction = self->createTransaction();
state std::vector<Operation> sequence = self->generateOperationSequence(data);
state std::vector<Standalone<RangeResultRef>> storeResults = self->applySequenceToStore(sequence);
state std::vector<Standalone<RangeResultRef>> dbResults =
wait(self->applySequenceToDatabase(transaction, sequence, self));
state std::vector<RangeResult> storeResults = self->applySequenceToStore(sequence);
state std::vector<RangeResult> dbResults = wait(self->applySequenceToDatabase(transaction, sequence, self));
Version readVersion = wait(transaction->getReadVersion());

View File

@ -176,7 +176,7 @@ struct SelectorCorrectnessWorkload : TestWorkload {
2;
if (self->testReadYourWrites) {
Standalone<RangeResultRef> 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<RangeResultRef> getRangeTest =
RangeResult getRangeTest =
wait(tr.getRange(KeySelectorRef(StringRef(myKeyA), onEqualA, offsetA),
KeySelectorRef(StringRef(myKeyB), onEqualB, offsetB),
2 * (self->maxKeySpace + self->maxOffset),

View File

@ -232,7 +232,7 @@ struct SerializabilityWorkload : TestWorkload {
std::vector<TransactionOperation> ops,
std::vector<Future<Optional<Value>>>* getFutures,
std::vector<Future<Key>>* getKeyFutures,
std::vector<Future<Standalone<RangeResultRef>>>* getRangeFutures,
std::vector<Future<RangeResult>>* getRangeFutures,
std::vector<Future<Void>>* watchFutures,
bool checkSnapshotReads) {
state int opNum = 0;
@ -306,10 +306,10 @@ struct SerializabilityWorkload : TestWorkload {
return Void();
}
ACTOR static Future<Standalone<RangeResultRef>> getDatabaseContents(Database cx, int nodes) {
ACTOR static Future<RangeResult> getDatabaseContents(Database cx, int nodes) {
state ReadYourWritesTransaction tr(cx);
Standalone<RangeResultRef> 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<ReadYourWritesTransaction> tr;
state std::vector<std::vector<Future<Optional<Value>>>> getFutures;
state std::vector<std::vector<Future<Key>>> getKeyFutures;
state std::vector<std::vector<Future<Standalone<RangeResultRef>>>> getRangeFutures;
state std::vector<std::vector<Future<RangeResult>>> getRangeFutures;
state std::vector<std::vector<Future<Void>>> watchFutures;
for (int i = 0; i < 5; i++) {
tr.push_back(ReadYourWritesTransaction(cx));
getFutures.push_back(std::vector<Future<Optional<Value>>>());
getKeyFutures.push_back(std::vector<Future<Key>>());
getRangeFutures.push_back(std::vector<Future<Standalone<RangeResultRef>>>());
getRangeFutures.push_back(std::vector<Future<RangeResult>>());
watchFutures.push_back(std::vector<Future<Void>>());
}
@ -382,7 +382,7 @@ struct SerializabilityWorkload : TestWorkload {
wait(tr[2].commit());
// get contents of database
state Standalone<RangeResultRef> 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<RangeResultRef> result2 = wait(getDatabaseContents(cx, self->nodes));
RangeResult result2 = wait(getDatabaseContents(cx, self->nodes));
if (result1.size() != result2.size()) {
TraceEvent(SevError, "SRL_ResultMismatch")

View File

@ -263,7 +263,7 @@ public: // workload functions
tr.reset();
loop {
try {
Standalone<RangeResultRef> kvRange = wait(tr.getRange(begin, end, 1000));
RangeResult kvRange = wait(tr.getRange(begin, end, 1000));
if (!kvRange.more && kvRange.size() == 0) {
TraceEvent("SnapTestNoMoreEntries");
break;

View File

@ -193,7 +193,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
}
}
bool compareRangeResult(Standalone<RangeResultRef>& res1, Standalone<RangeResultRef>& 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> result =
RangeResult result =
wait(tx->getRange(startKeySelector, endKeySelector, GetRangeLimits(CLIENT_KNOBS->TOO_MANY)));
ASSERT(false);
} catch (Error& e) {
@ -451,8 +451,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
}
// test case when registered range is the same as the underlying module
try {
state Standalone<RangeResultRef> result =
wait(tx->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"),
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
@ -609,7 +608,7 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
return Void();
}
bool getRangeResultInOrder(const Standalone<RangeResultRef>& 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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(

View File

@ -185,7 +185,7 @@ struct StorefrontWorkload : TestWorkload {
state KeySelectorRef begin = firstGreaterThan(keyRange.begin);
state KeySelectorRef end = lastLessThan(keyRange.end);
while (fetched == 10000) {
Standalone<RangeResultRef> 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<int> 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<Standalone<RangeResultRef>> values =
state Future<RangeResult> 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<RangeResultRef> 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")

View File

@ -119,7 +119,7 @@ struct StreamingReadWorkload : TestWorkload {
else if (currentIndex > maxIndex - thisRangeSize)
currentIndex = minIndex;
Standalone<RangeResultRef> values =
RangeResult values =
wait(tr.getRange(firstGreaterOrEqual(self->keyForIndex(currentIndex)),
firstGreaterOrEqual(self->keyForIndex(currentIndex + thisRangeSize)),
thisRangeSize));

View File

@ -31,8 +31,7 @@ struct SuspendProcessesWorkload : TestWorkload {
try {
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
Standalone<RangeResultRef> kvs =
wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"),
RangeResult kvs = wait(tr.getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"),
LiteralStringRef("\xff\xff/worker_interfaces0")),
CLIENT_KNOBS->TOO_MANY));
ASSERT(!kvs.more);

View File

@ -347,7 +347,7 @@ struct TPCC : TestWorkload {
memcpy(end, s.begin(), s.size());
begin[s.size()] = '/';
end[s.size()] = '0';
state Standalone<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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<RangeResultRef> 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) {

Some files were not shown because too many files have changed in this diff Show More