Merge pull request #8223 from sfc-gh-ajbeamon/change-literal-string-ref

Convert literal string ref instances to use _sr suffix
This commit is contained in:
A.J. Beamon 2022-09-19 12:53:17 -07:00 committed by GitHub
commit 3a1fa5bd7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
240 changed files with 2306 additions and 2607 deletions

View File

@ -23,17 +23,17 @@
namespace FDB {
const uint8_t DirectoryLayer::LITTLE_ENDIAN_LONG_ONE[8] = { 1, 0, 0, 0, 0, 0, 0, 0 };
const StringRef DirectoryLayer::HIGH_CONTENTION_KEY = LiteralStringRef("hca");
const StringRef DirectoryLayer::LAYER_KEY = LiteralStringRef("layer");
const StringRef DirectoryLayer::VERSION_KEY = LiteralStringRef("version");
const StringRef DirectoryLayer::HIGH_CONTENTION_KEY = "hca"_sr;
const StringRef DirectoryLayer::LAYER_KEY = "layer"_sr;
const StringRef DirectoryLayer::VERSION_KEY = "version"_sr;
const int64_t DirectoryLayer::SUB_DIR_KEY = 0;
const uint32_t DirectoryLayer::VERSION[3] = { 1, 0, 0 };
const StringRef DirectoryLayer::DEFAULT_NODE_SUBSPACE_PREFIX = LiteralStringRef("\xfe");
const StringRef DirectoryLayer::DEFAULT_NODE_SUBSPACE_PREFIX = "\xfe"_sr;
const Subspace DirectoryLayer::DEFAULT_NODE_SUBSPACE = Subspace(DEFAULT_NODE_SUBSPACE_PREFIX);
const Subspace DirectoryLayer::DEFAULT_CONTENT_SUBSPACE = Subspace();
const StringRef DirectoryLayer::PARTITION_LAYER = LiteralStringRef("partition");
const StringRef DirectoryLayer::PARTITION_LAYER = "partition"_sr;
DirectoryLayer::DirectoryLayer(Subspace nodeSubspace, Subspace contentSubspace, bool allowManualPrefixes)
: rootNode(nodeSubspace.get(nodeSubspace.key())), nodeSubspace(nodeSubspace), contentSubspace(contentSubspace),

View File

@ -31,7 +31,7 @@ typedef Standalone<KeyRef> Key;
typedef Standalone<ValueRef> Value;
inline Key keyAfter(const KeyRef& key) {
if (key == LiteralStringRef("\xff\xff"))
if (key == "\xff\xff"_sr)
return key;
Standalone<StringRef> r;
@ -43,7 +43,7 @@ inline Key keyAfter(const KeyRef& key) {
}
inline KeyRef keyAfter(const KeyRef& key, Arena& arena) {
if (key == LiteralStringRef("\xff\xff"))
if (key == "\xff\xff"_sr)
return key;
uint8_t* t = new (arena) uint8_t[key.size() + 1];
memcpy(t, key.begin(), key.size());

View File

@ -63,15 +63,14 @@ ACTOR Future<Void> _test() {
// wait( waitForAllReady( versions ) );
printf("Elapsed: %lf\n", timer_monotonic() - starttime);
tr->set(LiteralStringRef("foo"), LiteralStringRef("bar"));
tr->set("foo"_sr, "bar"_sr);
Optional<FDBStandalone<ValueRef>> v = wait(tr->get(LiteralStringRef("foo")));
Optional<FDBStandalone<ValueRef>> v = wait(tr->get("foo"_sr));
if (v.present()) {
printf("%s\n", v.get().toString().c_str());
}
FDBStandalone<RangeResultRef> r =
wait(tr->getRange(KeyRangeRef(LiteralStringRef("a"), LiteralStringRef("z")), 100));
FDBStandalone<RangeResultRef> r = wait(tr->getRange(KeyRangeRef("a"_sr, "z"_sr), 100));
for (auto kv : r) {
printf("%s is %s\n", kv.key.toString().c_str(), kv.value.toString().c_str());

View File

@ -545,11 +545,10 @@ struct DirectoryLogDirectoryFunc : InstructionFunc {
pathTuple.append(p, true);
}
instruction->tr->set(logSubspace.pack(LiteralStringRef("path"), true), pathTuple.pack());
instruction->tr->set(logSubspace.pack(LiteralStringRef("layer"), true),
Tuple().append(directory->getLayer()).pack());
instruction->tr->set(logSubspace.pack(LiteralStringRef("exists"), true), Tuple().append(exists ? 1 : 0).pack());
instruction->tr->set(logSubspace.pack(LiteralStringRef("children"), true), childrenTuple.pack());
instruction->tr->set(logSubspace.pack("path"_sr, true), pathTuple.pack());
instruction->tr->set(logSubspace.pack("layer"_sr, true), Tuple().append(directory->getLayer()).pack());
instruction->tr->set(logSubspace.pack("exists"_sr, true), Tuple().append(exists ? 1 : 0).pack());
instruction->tr->set(logSubspace.pack("children"_sr, true), childrenTuple.pack());
return Void();
}

View File

@ -470,12 +470,12 @@ ACTOR Future<Standalone<StringRef>> waitForVoid(Future<Void> f) {
try {
wait(f);
Tuple t;
t.append(LiteralStringRef("RESULT_NOT_PRESENT"));
t.append("RESULT_NOT_PRESENT"_sr);
return t.pack();
} catch (Error& e) {
// printf("FDBError1:%d\n", e.code());
Tuple t;
t.append(LiteralStringRef("ERROR"));
t.append("ERROR"_sr);
t.append(format("%d", e.code()));
// pack above as error string into another tuple
Tuple ret;
@ -493,7 +493,7 @@ ACTOR Future<Standalone<StringRef>> waitForValue(Future<FDBStandalone<KeyRef>> f
} catch (Error& e) {
// printf("FDBError2:%d\n", e.code());
Tuple t;
t.append(LiteralStringRef("ERROR"));
t.append("ERROR"_sr);
t.append(format("%d", e.code()));
// pack above as error string into another tuple
Tuple ret;
@ -509,7 +509,7 @@ ACTOR Future<Standalone<StringRef>> waitForValue(Future<Optional<FDBStandalone<V
if (value.present())
str = value.get();
else
str = LiteralStringRef("RESULT_NOT_PRESENT");
str = "RESULT_NOT_PRESENT"_sr;
Tuple t;
t.append(str);
@ -517,7 +517,7 @@ ACTOR Future<Standalone<StringRef>> waitForValue(Future<Optional<FDBStandalone<V
} catch (Error& e) {
// printf("FDBError3:%d\n", e.code());
Tuple t;
t.append(LiteralStringRef("ERROR"));
t.append("ERROR"_sr);
t.append(format("%d", e.code()));
// pack above as error string into another tuple
Tuple ret;
@ -543,7 +543,7 @@ ACTOR Future<Standalone<StringRef>> getKey(Future<FDBStandalone<KeyRef>> f, Stan
} catch (Error& e) {
// printf("FDBError4:%d\n", e.code());
Tuple t;
t.append(LiteralStringRef("ERROR"));
t.append("ERROR"_sr);
t.append(format("%d", e.code()));
// pack above as error string into another tuple
Tuple ret;
@ -670,7 +670,7 @@ struct GetEstimatedRangeSize : InstructionFunc {
state Standalone<StringRef> endKey = Tuple::unpack(s2).getString(0);
Future<int64_t> fsize = instruction->tr->getEstimatedRangeSizeBytes(KeyRangeRef(beginKey, endKey));
int64_t size = wait(fsize);
data->stack.pushTuple(LiteralStringRef("GOT_ESTIMATED_RANGE_SIZE"));
data->stack.pushTuple("GOT_ESTIMATED_RANGE_SIZE"_sr);
return Void();
}
@ -698,7 +698,7 @@ struct GetRangeSplitPoints : InstructionFunc {
Future<FDBStandalone<VectorRef<KeyRef>>> fsplitPoints =
instruction->tr->getRangeSplitPoints(KeyRangeRef(beginKey, endKey), chunkSize);
FDBStandalone<VectorRef<KeyRef>> splitPoints = wait(fsplitPoints);
data->stack.pushTuple(LiteralStringRef("GOT_RANGE_SPLIT_POINTS"));
data->stack.pushTuple("GOT_RANGE_SPLIT_POINTS"_sr);
return Void();
}
@ -743,7 +743,7 @@ struct GetReadVersionFunc : InstructionFunc {
ACTOR static Future<Void> call(Reference<FlowTesterData> data, Reference<InstructionData> instruction) {
Version v = wait(instruction->tr->getReadVersion());
data->lastVersion = v;
data->stack.pushTuple(LiteralStringRef("GOT_READ_VERSION"));
data->stack.pushTuple("GOT_READ_VERSION"_sr);
return Void();
}
};
@ -767,7 +767,7 @@ struct GetCommittedVersionFunc : InstructionFunc {
static Future<Void> call(Reference<FlowTesterData> const& data, Reference<InstructionData> const& instruction) {
data->lastVersion = instruction->tr->getCommittedVersion();
data->stack.pushTuple(LiteralStringRef("GOT_COMMITTED_VERSION"));
data->stack.pushTuple("GOT_COMMITTED_VERSION"_sr);
return Void();
}
};
@ -781,7 +781,7 @@ struct GetApproximateSizeFunc : InstructionFunc {
ACTOR static Future<Void> call(Reference<FlowTesterData> data, Reference<InstructionData> instruction) {
int64_t _ = wait(instruction->tr->getApproximateSize());
(void)_; // disable unused variable warning
data->stack.pushTuple(LiteralStringRef("GOT_APPROXIMATE_SIZE"));
data->stack.pushTuple("GOT_APPROXIMATE_SIZE"_sr);
return Void();
}
};
@ -1485,7 +1485,7 @@ struct ReadConflictKeyFunc : InstructionFunc {
// printf("=========READ_CONFLICT_KEY:%s\n", printable(key).c_str());
instruction->tr->addReadConflictKey(key);
data->stack.pushTuple(LiteralStringRef("SET_CONFLICT_KEY"));
data->stack.pushTuple("SET_CONFLICT_KEY"_sr);
return Void();
}
};
@ -1506,7 +1506,7 @@ struct WriteConflictKeyFunc : InstructionFunc {
// printf("=========WRITE_CONFLICT_KEY:%s\n", printable(key).c_str());
instruction->tr->addWriteConflictKey(key);
data->stack.pushTuple(LiteralStringRef("SET_CONFLICT_KEY"));
data->stack.pushTuple("SET_CONFLICT_KEY"_sr);
return Void();
}
};
@ -1529,7 +1529,7 @@ struct ReadConflictRangeFunc : InstructionFunc {
// printf("=========READ_CONFLICT_RANGE:%s:%s\n", printable(begin).c_str(), printable(end).c_str());
instruction->tr->addReadConflictRange(KeyRange(KeyRangeRef(begin, end)));
data->stack.pushTuple(LiteralStringRef("SET_CONFLICT_RANGE"));
data->stack.pushTuple("SET_CONFLICT_RANGE"_sr);
return Void();
}
};
@ -1553,7 +1553,7 @@ struct WriteConflictRangeFunc : InstructionFunc {
// printf("=========WRITE_CONFLICT_RANGE:%s:%s\n", printable(begin).c_str(), printable(end).c_str());
instruction->tr->addWriteConflictRange(KeyRange(KeyRangeRef(begin, end)));
data->stack.pushTuple(LiteralStringRef("SET_CONFLICT_RANGE"));
data->stack.pushTuple("SET_CONFLICT_RANGE"_sr);
return Void();
}
};
@ -1643,10 +1643,8 @@ struct UnitTestsFunc : InstructionFunc {
Optional<StringRef>(StringRef((const uint8_t*)&locationCacheSize, 8)));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_MAX_WATCHES,
Optional<StringRef>(StringRef((const uint8_t*)&maxWatches, 8)));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_DATACENTER_ID,
Optional<StringRef>(LiteralStringRef("dc_id")));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_MACHINE_ID,
Optional<StringRef>(LiteralStringRef("machine_id")));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_DATACENTER_ID, Optional<StringRef>("dc_id"_sr));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_MACHINE_ID, Optional<StringRef>("machine_id"_sr));
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_ENABLE);
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_DISABLE);
data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_LOGGING_MAX_FIELD_LENGTH,
@ -1685,13 +1683,13 @@ struct UnitTestsFunc : InstructionFunc {
Optional<StringRef>(StringRef((const uint8_t*)&maxRetryDelay, 8)));
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_USED_DURING_COMMIT_PROTECTION_DISABLE);
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TRANSACTION_LOGGING_ENABLE,
Optional<StringRef>(LiteralStringRef("my_transaction")));
Optional<StringRef>("my_transaction"_sr));
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_LOCK_AWARE);
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_LOCK_AWARE);
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_INCLUDE_PORT_IN_ADDRESS);
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_REPORT_CONFLICTING_KEYS);
Optional<FDBStandalone<ValueRef>> _ = wait(tr->get(LiteralStringRef("\xff")));
Optional<FDBStandalone<ValueRef>> _ = wait(tr->get("\xff"_sr));
tr->cancel();
return Void();
@ -1724,13 +1722,13 @@ ACTOR static Future<Void> doInstructions(Reference<FlowTesterData> data) {
Tuple opTuple = Tuple::unpack(data->instructions[idx].value);
state Standalone<StringRef> op = opTuple.getString(0);
state bool isDatabase = op.endsWith(LiteralStringRef("_DATABASE"));
state bool isSnapshot = op.endsWith(LiteralStringRef("_SNAPSHOT"));
state bool isDirectory = op.startsWith(LiteralStringRef("DIRECTORY_"));
state bool isDatabase = op.endsWith("_DATABASE"_sr);
state bool isSnapshot = op.endsWith("_SNAPSHOT"_sr);
state bool isDirectory = op.startsWith("DIRECTORY_"_sr);
try {
if (LOG_INSTRUCTIONS) {
if (op != LiteralStringRef("SWAP") && op != LiteralStringRef("PUSH")) {
if (op != "SWAP"_sr && op != "PUSH"_sr) {
printf("%zu. %s\n", idx, tupleToString(opTuple).c_str());
fflush(stdout);
}
@ -1773,7 +1771,7 @@ ACTOR static Future<Void> doInstructions(Reference<FlowTesterData> data) {
if (opsThatCreateDirectories.count(op.toString())) {
data->directoryData.directoryList.push_back(DirectoryOrSubspace());
}
data->stack.pushTuple(LiteralStringRef("DIRECTORY_ERROR"));
data->stack.pushTuple("DIRECTORY_ERROR"_sr);
} else {
data->stack.pushError(e.code());
}
@ -1883,15 +1881,14 @@ ACTOR void _test_versionstamp() {
state Future<FDBStandalone<StringRef>> ftrVersion = tr->getVersionstamp();
tr->atomicOp(LiteralStringRef("foo"),
LiteralStringRef("blahblahbl\x00\x00\x00\x00"),
FDBMutationType::FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_VALUE);
tr->atomicOp(
"foo"_sr, "blahblahbl\x00\x00\x00\x00"_sr, FDBMutationType::FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_VALUE);
wait(tr->commit()); // should use retry loop
tr->reset();
Optional<FDBStandalone<StringRef>> optionalDbVersion = wait(tr->get(LiteralStringRef("foo")));
Optional<FDBStandalone<StringRef>> optionalDbVersion = wait(tr->get("foo"_sr));
state FDBStandalone<StringRef> dbVersion = optionalDbVersion.get();
FDBStandalone<StringRef> trVersion = wait(ftrVersion);

View File

@ -71,7 +71,7 @@ struct FlowTesterStack {
void pushError(int errorCode) {
FDB::Tuple t;
t.append(LiteralStringRef("ERROR"));
t.append("ERROR"_sr);
t.append(format("%d", errorCode));
// pack above as error string into another tuple
pushTuple(t.pack().toString());

View File

@ -32,10 +32,10 @@ public:
explicit SKRExampleImpl(KeyRangeRef kr): SpecialKeyRangeReadImpl(kr) {
// Our implementation is quite simple here, the key-value pairs are formatted as:
// \xff\xff/example/<country_name> : <capital_city_name>
CountryToCapitalCity[LiteralStringRef("USA")] = LiteralStringRef("Washington, D.C.");
CountryToCapitalCity[LiteralStringRef("UK")] = LiteralStringRef("London");
CountryToCapitalCity[LiteralStringRef("Japan")] = LiteralStringRef("Tokyo");
CountryToCapitalCity[LiteralStringRef("China")] = LiteralStringRef("Beijing");
CountryToCapitalCity["USA"_sr] = "Washington, D.C."_sr;
CountryToCapitalCity["UK"_sr] = "London"_sr;
CountryToCapitalCity["Japan"_sr] = "Tokyo"_sr;
CountryToCapitalCity["China"_sr] = "Beijing"_sr;
}
// Implement the getRange interface
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
@ -58,7 +58,7 @@ private:
};
// Instantiate the function object
// In development, you should have a function object pointer in DatabaseContext(DatabaseContext.h) and initialize in DatabaseContext's constructor(NativeAPI.actor.cpp)
const KeyRangeRef exampleRange(LiteralStringRef("\xff\xff/example/"), LiteralStringRef("\xff\xff/example/\xff"));
const KeyRangeRef exampleRange("\xff\xff/example/"_sr, "\xff\xff/example/\xff"_sr);
SKRExampleImpl exampleImpl(exampleRange);
// Assuming the database handler is `cx`, register to special-key-space
// In development, you should register all function objects in the constructor of DatabaseContext(NativeAPI.actor.cpp)
@ -67,16 +67,16 @@ cx->specialKeySpace->registerKeyRange(exampleRange, &exampleImpl);
state ReadYourWritesTransaction tr(cx);
// get
Optional<Value> res1 = wait(tr.get("\xff\xff/example/Japan"));
ASSERT(res1.present() && res.getValue() == LiteralStringRef("Tokyo"));
ASSERT(res1.present() && res.getValue() == "Tokyo"_sr);
// 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
RangeResult res2 = wait(tr.getRange(LiteralStringRef("\xff\xff/example/U"), LiteralStringRef("\xff\xff/example/U\xff")));
RangeResult res2 = wait(tr.getRange("\xff\xff/example/U"_sr, "\xff\xff/example/U\xff"_sr));
// res2 should contain USA and UK
ASSERT(
res2.size() == 2 &&
res2[0].value == LiteralStringRef("London") &&
res2[1].value == LiteralStringRef("Washington, D.C.")
res2[0].value == "London"_sr &&
res2[1].value == "Washington, D.C."_sr
);
```

View File

@ -82,7 +82,7 @@ Values must always be encoded according to the :ref:`api-python-tuple-layer`.
// In GlobalConfig.actor.h
extern const KeyRef myGlobalConfigKey;
// In GlobalConfig.actor.cpp
const KeyRef myGlobalConfigKey = LiteralStringRef("config/key");
const KeyRef myGlobalConfigKey = "config/key"_sr;
// When you want to set the value..
Tuple value = Tuple::makeTuple((double)1.5);

View File

@ -478,7 +478,7 @@ ACTOR Future<Void> fdbClient() {
state Transaction tx(db);
state std::string keyPrefix = "/tut/";
state Key startKey;
state KeyRef endKey = LiteralStringRef("/tut0");
state KeyRef endKey = "/tut0"_sr;
state int beginIdx = 0;
loop {
try {
@ -494,7 +494,7 @@ ACTOR Future<Void> fdbClient() {
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"));
tx.set(k, "foo"_sr);
}
wait(tx.commit());
std::cout << "Committed\n";

View File

@ -905,12 +905,12 @@ CSimpleOpt::SOption g_rgDBPauseOptions[] = {
SO_END_OF_OPTIONS
};
const KeyRef exeAgent = LiteralStringRef("backup_agent");
const KeyRef exeBackup = LiteralStringRef("fdbbackup");
const KeyRef exeRestore = LiteralStringRef("fdbrestore");
const KeyRef exeFastRestoreTool = LiteralStringRef("fastrestore_tool"); // must be lower case
const KeyRef exeDatabaseAgent = LiteralStringRef("dr_agent");
const KeyRef exeDatabaseBackup = LiteralStringRef("fdbdr");
const KeyRef exeAgent = "backup_agent"_sr;
const KeyRef exeBackup = "fdbbackup"_sr;
const KeyRef exeRestore = "fdbrestore"_sr;
const KeyRef exeFastRestoreTool = "fastrestore_tool"_sr; // must be lower case
const KeyRef exeDatabaseAgent = "dr_agent"_sr;
const KeyRef exeDatabaseBackup = "fdbdr"_sr;
extern const char* getSourceVersion();
@ -1351,7 +1351,7 @@ ProgramExe getProgramType(std::string programExe) {
}
#endif
// For debugging convenience, remove .debug suffix if present.
if (StringRef(programExe).endsWith(LiteralStringRef(".debug")))
if (StringRef(programExe).endsWith(".debug"_sr))
programExe = programExe.substr(0, programExe.size() - 6);
// Check if backup agent
@ -2449,8 +2449,8 @@ ACTOR Future<Void> runFastRestoreTool(Database db,
dbVersion,
LockDB::True,
randomUID,
LiteralStringRef(""),
LiteralStringRef("")));
""_sr,
""_sr));
// TODO: Support addPrefix and removePrefix
if (waitForDone) {
// Wait for parallel restore to finish and unlock DB after that
@ -3089,7 +3089,7 @@ static void addKeyRange(std::string optionValue, Standalone<VectorRef<KeyRangeRe
Version parseVersion(const char* str) {
StringRef s((const uint8_t*)str, strlen(str));
if (s.endsWith(LiteralStringRef("days")) || s.endsWith(LiteralStringRef("d"))) {
if (s.endsWith("days"_sr) || s.endsWith("d"_sr)) {
float days;
if (sscanf(str, "%f", &days) != 1) {
fprintf(stderr, "Could not parse version: %s\n", str);
@ -3608,7 +3608,7 @@ int main(int argc, char* argv[]) {
case OPT_DESTCONTAINER:
destinationContainer = args->OptionArg();
// If the url starts with '/' then prepend "file://" for backwards compatibility
if (StringRef(destinationContainer).startsWith(LiteralStringRef("/")))
if (StringRef(destinationContainer).startsWith("/"_sr))
destinationContainer = std::string("file://") + destinationContainer;
modifyOptions.destURL = destinationContainer;
break;
@ -3654,7 +3654,7 @@ int main(int argc, char* argv[]) {
case OPT_RESTORECONTAINER:
restoreContainer = args->OptionArg();
// If the url starts with '/' then prepend "file://" for backwards compatibility
if (StringRef(restoreContainer).startsWith(LiteralStringRef("/")))
if (StringRef(restoreContainer).startsWith("/"_sr))
restoreContainer = std::string("file://") + restoreContainer;
break;
case OPT_DESCRIBE_DEEP:
@ -4323,19 +4323,19 @@ int main(int argc, char* argv[]) {
char* demangled = abi::__cxa_demangle(i->first, NULL, NULL, NULL);
if (demangled) {
s = demangled;
if (StringRef(s).startsWith(LiteralStringRef("(anonymous namespace)::")))
s = s.substr(LiteralStringRef("(anonymous namespace)::").size());
if (StringRef(s).startsWith("(anonymous namespace)::"_sr))
s = s.substr("(anonymous namespace)::"_sr.size());
free(demangled);
} else
s = i->first;
#else
s = i->first;
if (StringRef(s).startsWith(LiteralStringRef("class `anonymous namespace'::")))
s = s.substr(LiteralStringRef("class `anonymous namespace'::").size());
else if (StringRef(s).startsWith(LiteralStringRef("class ")))
s = s.substr(LiteralStringRef("class ").size());
else if (StringRef(s).startsWith(LiteralStringRef("struct ")))
s = s.substr(LiteralStringRef("struct ").size());
if (StringRef(s).startsWith("class `anonymous namespace'::"_sr))
s = s.substr("class `anonymous namespace'::"_sr.size());
else if (StringRef(s).startsWith("class "_sr))
s = s.substr("class "_sr.size());
else if (StringRef(s).startsWith("struct "_sr))
s = s.substr("struct "_sr.size());
#endif
typeNames.emplace_back(s, i->first);

View File

@ -31,7 +31,7 @@
namespace fdb_cli {
const KeyRef advanceVersionSpecialKey = LiteralStringRef("\xff\xff/management/min_required_commit_version");
const KeyRef advanceVersionSpecialKey = "\xff\xff/management/min_required_commit_version"_sr;
ACTOR Future<bool> advanceVersionCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
if (tokens.size() != 2) {

View File

@ -112,7 +112,7 @@ ACTOR Future<bool> blobRangeCommandActor(Database localDb,
end = tokens[3];
}
if (end > LiteralStringRef("\xff")) {
if (end > "\xff"_sr) {
// TODO is this something we want?
fmt::print("Cannot blobbify system keyspace! Problematic End Key: {0}\n", tokens[3].printable());
return false;

View File

@ -44,20 +44,20 @@ ACTOR Future<bool> configureCommandActor(Reference<IDatabase> db,
if (tokens.size() < 2)
result = ConfigurationResult::NO_OPTIONS_PROVIDED;
else {
if (tokens[startToken] == LiteralStringRef("FORCE")) {
if (tokens[startToken] == "FORCE"_sr) {
force = true;
startToken = 2;
}
state Optional<ConfigureAutoResult> conf;
if (tokens[startToken] == LiteralStringRef("auto")) {
if (tokens[startToken] == "auto"_sr) {
// get cluster status
state Reference<ITransaction> tr = db->createTransaction();
if (!tr->isValid()) {
StatusObject _s = wait(StatusClient::statusFetcher(localDb));
s = _s;
} else {
state ThreadFuture<Optional<Value>> statusValueF = tr->get(LiteralStringRef("\xff\xff/status/json"));
state ThreadFuture<Optional<Value>> statusValueF = tr->get("\xff\xff/status/json"_sr);
Optional<Value> statusValue = wait(safeThreadFutureToFuture(statusValueF));
if (!statusValue.present()) {
fprintf(stderr, "ERROR: Failed to get status json from the cluster\n");
@ -166,7 +166,7 @@ ACTOR Future<bool> configureCommandActor(Reference<IDatabase> db,
case ConfigurationResult::CONFLICTING_OPTIONS:
case ConfigurationResult::UNKNOWN_OPTION:
case ConfigurationResult::INCOMPLETE_CONFIGURATION:
printUsage(LiteralStringRef("configure"));
printUsage("configure"_sr);
ret = false;
break;
case ConfigurationResult::INVALID_CONFIGURATION:

View File

@ -30,7 +30,7 @@
namespace fdb_cli {
const KeyRef consistencyCheckSpecialKey = LiteralStringRef("\xff\xff/management/consistency_check_suspended");
const KeyRef consistencyCheckSpecialKey = "\xff\xff/management/consistency_check_suspended"_sr;
ACTOR Future<bool> consistencyCheckCommandActor(Reference<ITransaction> tr,
std::vector<StringRef> tokens,

View File

@ -65,8 +65,8 @@ ACTOR Future<bool> changeCoordinators(Reference<IDatabase> db, std::vector<Strin
state StringRef new_cluster_description;
state std::string auto_coordinators_str;
state bool disableConfigDB = false;
StringRef nameTokenBegin = LiteralStringRef("description=");
StringRef noConfigDB = LiteralStringRef("--no-config-db");
StringRef nameTokenBegin = "description="_sr;
StringRef noConfigDB = "--no-config-db"_sr;
for (auto tok = tokens.begin() + 1; tok != tokens.end(); ++tok) {
if (tok->startsWith(nameTokenBegin) && new_cluster_description.empty()) {
new_cluster_description = tok->substr(nameTokenBegin.size());
@ -83,7 +83,7 @@ ACTOR Future<bool> changeCoordinators(Reference<IDatabase> db, std::vector<Strin
}
}
state bool automatic = tokens.size() == 2 && tokens[1] == LiteralStringRef("auto");
state bool automatic = tokens.size() == 2 && tokens[1] == "auto"_sr;
state Reference<ITransaction> tr = db->createTransaction();
loop {
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
@ -186,10 +186,10 @@ ACTOR Future<bool> changeCoordinators(Reference<IDatabase> db, std::vector<Strin
namespace fdb_cli {
const KeyRef clusterDescriptionSpecialKey = LiteralStringRef("\xff\xff/configuration/coordinators/cluster_description");
const KeyRef configDBSpecialKey = LiteralStringRef("\xff\xff/configuration/coordinators/config_db");
const KeyRef coordinatorsAutoSpecialKey = LiteralStringRef("\xff\xff/management/auto_coordinators");
const KeyRef coordinatorsProcessSpecialKey = LiteralStringRef("\xff\xff/configuration/coordinators/processes");
const KeyRef clusterDescriptionSpecialKey = "\xff\xff/configuration/coordinators/cluster_description"_sr;
const KeyRef configDBSpecialKey = "\xff\xff/configuration/coordinators/config_db"_sr;
const KeyRef coordinatorsAutoSpecialKey = "\xff\xff/management/auto_coordinators"_sr;
const KeyRef coordinatorsProcessSpecialKey = "\xff\xff/configuration/coordinators/processes"_sr;
ACTOR Future<bool> coordinatorsCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
if (tokens.size() < 2) {

View File

@ -108,8 +108,8 @@ Future<Void> setDDIgnoreRebalanceOff(Reference<IDatabase> db, uint8_t DDIgnoreOp
namespace fdb_cli {
const KeyRef ddModeSpecialKey = LiteralStringRef("\xff\xff/management/data_distribution/mode");
const KeyRef ddIgnoreRebalanceSpecialKey = LiteralStringRef("\xff\xff/management/data_distribution/rebalance_ignored");
const KeyRef ddModeSpecialKey = "\xff\xff/management/data_distribution/mode"_sr;
const KeyRef ddIgnoreRebalanceSpecialKey = "\xff\xff/management/data_distribution/rebalance_ignored"_sr;
constexpr auto usage =
"Usage: datadistribution <on|off|disable <ssfailure|rebalance|rebalance_disk|rebalance_read>|enable "
"<ssfailure|rebalance|rebalance_disk|rebalance_read>>\n";
@ -127,7 +127,7 @@ ACTOR Future<bool> dataDistributionCommandActor(Reference<IDatabase> db, std::ve
printf("Data distribution is turned off.\n");
} else if (tokencmp(tokens[1], "disable")) {
if (tokencmp(tokens[2], "ssfailure")) {
wait(success((setHealthyZone(db, LiteralStringRef("IgnoreSSFailures"), 0))));
wait(success((setHealthyZone(db, "IgnoreSSFailures"_sr, 0))));
printf("Data distribution is disabled for storage server failures.\n");
} else if (tokencmp(tokens[2], "rebalance")) {
wait(setDDIgnoreRebalanceOn(db, DDIgnore::REBALANCE_DISK | DDIgnore::REBALANCE_READ));

View File

@ -227,22 +227,19 @@ ACTOR Future<Void> checkForCoordinators(Reference<IDatabase> db, std::vector<Add
namespace fdb_cli {
const KeyRangeRef excludedServersSpecialKeyRange(LiteralStringRef("\xff\xff/management/excluded/"),
LiteralStringRef("\xff\xff/management/excluded0"));
const KeyRangeRef failedServersSpecialKeyRange(LiteralStringRef("\xff\xff/management/failed/"),
LiteralStringRef("\xff\xff/management/failed0"));
const KeyRangeRef excludedLocalitySpecialKeyRange(LiteralStringRef("\xff\xff/management/excluded_locality/"),
LiteralStringRef("\xff\xff/management/excluded_locality0"));
const KeyRangeRef failedLocalitySpecialKeyRange(LiteralStringRef("\xff\xff/management/failed_locality/"),
LiteralStringRef("\xff\xff/management/failed_locality0"));
const KeyRef excludedForceOptionSpecialKey = LiteralStringRef("\xff\xff/management/options/excluded/force");
const KeyRef failedForceOptionSpecialKey = LiteralStringRef("\xff\xff/management/options/failed/force");
const KeyRef excludedLocalityForceOptionSpecialKey =
LiteralStringRef("\xff\xff/management/options/excluded_locality/force");
const KeyRef failedLocalityForceOptionSpecialKey =
LiteralStringRef("\xff\xff/management/options/failed_locality/force");
const KeyRangeRef exclusionInProgressSpecialKeyRange(LiteralStringRef("\xff\xff/management/in_progress_exclusion/"),
LiteralStringRef("\xff\xff/management/in_progress_exclusion0"));
const KeyRangeRef excludedServersSpecialKeyRange("\xff\xff/management/excluded/"_sr,
"\xff\xff/management/excluded0"_sr);
const KeyRangeRef failedServersSpecialKeyRange("\xff\xff/management/failed/"_sr, "\xff\xff/management/failed0"_sr);
const KeyRangeRef excludedLocalitySpecialKeyRange("\xff\xff/management/excluded_locality/"_sr,
"\xff\xff/management/excluded_locality0"_sr);
const KeyRangeRef failedLocalitySpecialKeyRange("\xff\xff/management/failed_locality/"_sr,
"\xff\xff/management/failed_locality0"_sr);
const KeyRef excludedForceOptionSpecialKey = "\xff\xff/management/options/excluded/force"_sr;
const KeyRef failedForceOptionSpecialKey = "\xff\xff/management/options/failed/force"_sr;
const KeyRef excludedLocalityForceOptionSpecialKey = "\xff\xff/management/options/excluded_locality/force"_sr;
const KeyRef failedLocalityForceOptionSpecialKey = "\xff\xff/management/options/failed_locality/force"_sr;
const KeyRangeRef exclusionInProgressSpecialKeyRange("\xff\xff/management/in_progress_exclusion/"_sr,
"\xff\xff/management/in_progress_exclusion0"_sr);
ACTOR Future<bool> excludeCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens, Future<Void> warn) {
if (tokens.size() <= 1) {
@ -281,11 +278,11 @@ ACTOR Future<bool> excludeCommandActor(Reference<IDatabase> db, std::vector<Stri
if (!result)
return false;
for (auto t = tokens.begin() + 1; t != tokens.end(); ++t) {
if (*t == LiteralStringRef("FORCE")) {
if (*t == "FORCE"_sr) {
force = true;
} else if (*t == LiteralStringRef("no_wait")) {
} else if (*t == "no_wait"_sr) {
waitForAllExcluded = false;
} else if (*t == LiteralStringRef("failed")) {
} else if (*t == "failed"_sr) {
markFailed = true;
} else if (t->startsWith(LocalityData::ExcludeLocalityPrefix) &&
t->toString().find(':') != std::string::npos) {

View File

@ -78,7 +78,7 @@ ACTOR Future<bool> fileConfigureCommandActor(Reference<IDatabase> db,
name + "=" +
json_spirit::write_string(json_spirit::mValue(value.get_array()), json_spirit::Output_options::none);
} else {
printUsage(LiteralStringRef("fileconfigure"));
printUsage("fileconfigure"_sr);
return false;
}
}

View File

@ -92,8 +92,7 @@ ACTOR Future<Void> includeServers(Reference<IDatabase> db, std::vector<AddressEx
// This is why we now make two clears: first only of the ip
// address, the second will delete all ports.
if (s.isWholeMachine())
tr->clear(KeyRangeRef(addr.withSuffix(LiteralStringRef(":")),
addr.withSuffix(LiteralStringRef(";"))));
tr->clear(KeyRangeRef(addr.withSuffix(":"_sr), addr.withSuffix(";"_sr)));
}
}
wait(safeThreadFutureToFuture(tr->commit()));
@ -112,9 +111,9 @@ ACTOR Future<bool> include(Reference<IDatabase> db, std::vector<StringRef> token
state bool failed = false;
state bool all = false;
for (auto t = tokens.begin() + 1; t != tokens.end(); ++t) {
if (*t == LiteralStringRef("all")) {
if (*t == "all"_sr) {
all = true;
} else if (*t == LiteralStringRef("failed")) {
} else if (*t == "failed"_sr) {
failed = true;
} else if (t->startsWith(LocalityData::ExcludeLocalityPrefix) && t->toString().find(':') != std::string::npos) {
// if the token starts with 'locality_' prefix.

View File

@ -59,7 +59,7 @@ ACTOR Future<bool> lockDatabase(Reference<IDatabase> db, UID id) {
namespace fdb_cli {
const KeyRef lockSpecialKey = LiteralStringRef("\xff\xff/management/db_locked");
const KeyRef lockSpecialKey = "\xff\xff/management/db_locked"_sr;
ACTOR Future<bool> lockCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
if (tokens.size() != 1) {

View File

@ -69,10 +69,10 @@ ACTOR Future<Void> printHealthyZone(Reference<IDatabase> db) {
namespace fdb_cli {
const KeyRangeRef maintenanceSpecialKeyRange = KeyRangeRef(LiteralStringRef("\xff\xff/management/maintenance/"),
LiteralStringRef("\xff\xff/management/maintenance0"));
const KeyRangeRef maintenanceSpecialKeyRange =
KeyRangeRef("\xff\xff/management/maintenance/"_sr, "\xff\xff/management/maintenance0"_sr);
// The special key, if present, means data distribution is disabled for storage failures;
const KeyRef ignoreSSFailureSpecialKey = LiteralStringRef("\xff\xff/management/maintenance/IgnoreSSFailures");
const KeyRef ignoreSSFailureSpecialKey = "\xff\xff/management/maintenance/IgnoreSSFailures"_sr;
// add a zone to maintenance and specify the maintenance duration
ACTOR Future<bool> setHealthyZone(Reference<IDatabase> db, StringRef zoneId, double seconds, bool printWarning) {

View File

@ -115,17 +115,13 @@ ACTOR Future<bool> profileCommandActor(Database db,
return false;
}
// Hold the reference to the standalone's memory
state ThreadFuture<RangeResult> kvsFuture =
tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"),
LiteralStringRef("\xff\xff/worker_interfaces0")),
CLIENT_KNOBS->TOO_MANY);
state ThreadFuture<RangeResult> kvsFuture = tr->getRange(
KeyRangeRef("\xff\xff/worker_interfaces/"_sr, "\xff\xff/worker_interfaces0"_sr), CLIENT_KNOBS->TOO_MANY);
RangeResult kvs = wait(safeThreadFutureToFuture(kvsFuture));
ASSERT(!kvs.more);
for (const auto& pair : kvs) {
auto ip_port =
(pair.key.endsWith(LiteralStringRef(":tls")) ? pair.key.removeSuffix(LiteralStringRef(":tls"))
: pair.key)
.removePrefix(LiteralStringRef("\xff\xff/worker_interfaces/"));
auto ip_port = (pair.key.endsWith(":tls"_sr) ? pair.key.removeSuffix(":tls"_sr) : pair.key)
.removePrefix("\xff\xff/worker_interfaces/"_sr);
printf("%s\n", printable(ip_port).c_str());
}
} else {

View File

@ -105,12 +105,10 @@ ACTOR Future<bool> setProcessClass(Reference<IDatabase> db, KeyRef network_addre
namespace fdb_cli {
const KeyRangeRef processClassSourceSpecialKeyRange =
KeyRangeRef(LiteralStringRef("\xff\xff/configuration/process/class_source/"),
LiteralStringRef("\xff\xff/configuration/process/class_source0"));
KeyRangeRef("\xff\xff/configuration/process/class_source/"_sr, "\xff\xff/configuration/process/class_source0"_sr);
const KeyRangeRef processClassTypeSpecialKeyRange =
KeyRangeRef(LiteralStringRef("\xff\xff/configuration/process/class_type/"),
LiteralStringRef("\xff\xff/configuration/process/class_type0"));
KeyRangeRef("\xff\xff/configuration/process/class_type/"_sr, "\xff\xff/configuration/process/class_type0"_sr);
ACTOR Future<bool> setClassCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
if (tokens.size() != 3 && tokens.size() != 1) {

View File

@ -40,7 +40,7 @@ ACTOR Future<bool> snapshotCommandActor(Reference<IDatabase> db, std::vector<Str
for (int i = 1; i < tokens.size(); i++) {
snap_cmd = snap_cmd.withSuffix(tokens[i]);
if (i != tokens.size() - 1) {
snap_cmd = snap_cmd.withSuffix(LiteralStringRef(" "));
snap_cmd = snap_cmd.withSuffix(" "_sr);
}
}
try {

View File

@ -1256,7 +1256,7 @@ ACTOR Future<bool> statusCommandActor(Reference<IDatabase> db,
StatusObject _s = wait(StatusClient::statusFetcher(localDb));
s = _s;
} else {
state ThreadFuture<Optional<Value>> statusValueF = tr->get(LiteralStringRef("\xff\xff/status/json"));
state ThreadFuture<Optional<Value>> statusValueF = tr->get("\xff\xff/status/json"_sr);
Optional<Value> statusValue = wait(safeThreadFutureToFuture(statusValueF));
if (!statusValue.present()) {
fprintf(stderr, "ERROR: Failed to get status json from the cluster\n");

View File

@ -163,11 +163,11 @@ ACTOR Future<bool> throttleCommandActor(Reference<IDatabase> db, std::vector<Str
}
}
if (tokens.size() == 7) {
if (tokens[6] == LiteralStringRef("default")) {
if (tokens[6] == "default"_sr) {
priority = TransactionPriority::DEFAULT;
} else if (tokens[6] == LiteralStringRef("immediate")) {
} else if (tokens[6] == "immediate"_sr) {
priority = TransactionPriority::IMMEDIATE;
} else if (tokens[6] == LiteralStringRef("batch")) {
} else if (tokens[6] == "batch"_sr) {
priority = TransactionPriority::BATCH;
} else {
fprintf(stderr,

View File

@ -89,7 +89,7 @@ ACTOR Future<bool> tssQuarantine(Reference<IDatabase> db, bool enable, UID tssId
}
if (enable) {
tr->set(tssQuarantineKeyFor(tssId), LiteralStringRef(""));
tr->set(tssQuarantineKeyFor(tssId), ""_sr);
// remove server from TSS mapping when quarantine is enabled
tssMapDB.erase(tr, ssi.tssPairID.get());
} else {
@ -112,19 +112,19 @@ namespace fdb_cli {
ACTOR Future<bool> tssqCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
if (tokens.size() == 2) {
if (tokens[1] != LiteralStringRef("list")) {
if (tokens[1] != "list"_sr) {
printUsage(tokens[0]);
return false;
} else {
wait(tssQuarantineList(db));
}
} else if (tokens.size() == 3) {
if ((tokens[1] != LiteralStringRef("start") && tokens[1] != LiteralStringRef("stop")) ||
(tokens[2].size() != 32) || !std::all_of(tokens[2].begin(), tokens[2].end(), &isxdigit)) {
if ((tokens[1] != "start"_sr && tokens[1] != "stop"_sr) || (tokens[2].size() != 32) ||
!std::all_of(tokens[2].begin(), tokens[2].end(), &isxdigit)) {
printUsage(tokens[0]);
return false;
} else {
bool enable = tokens[1] == LiteralStringRef("start");
bool enable = tokens[1] == "start"_sr;
UID tssId = UID::fromString(tokens[2].toString());
bool success = wait(tssQuarantine(db, enable, tssId));
return success;

View File

@ -74,17 +74,15 @@ void addInterfacesFromKVs(RangeResult& kvs,
return;
}
ClientLeaderRegInterface leaderInterf(workerInterf.address());
StringRef ip_port =
(kv.key.endsWith(LiteralStringRef(":tls")) ? kv.key.removeSuffix(LiteralStringRef(":tls")) : kv.key)
.removePrefix(LiteralStringRef("\xff\xff/worker_interfaces/"));
StringRef ip_port = (kv.key.endsWith(":tls"_sr) ? kv.key.removeSuffix(":tls"_sr) : kv.key)
.removePrefix("\xff\xff/worker_interfaces/"_sr);
(*address_interface)[ip_port] = std::make_pair(kv.value, leaderInterf);
if (workerInterf.reboot.getEndpoint().addresses.secondaryAddress.present()) {
Key full_ip_port2 =
StringRef(workerInterf.reboot.getEndpoint().addresses.secondaryAddress.get().toString());
StringRef ip_port2 = full_ip_port2.endsWith(LiteralStringRef(":tls"))
? full_ip_port2.removeSuffix(LiteralStringRef(":tls"))
: full_ip_port2;
StringRef ip_port2 =
full_ip_port2.endsWith(":tls"_sr) ? full_ip_port2.removeSuffix(":tls"_sr) : full_ip_port2;
(*address_interface)[ip_port2] = std::make_pair(kv.value, leaderInterf);
}
}
@ -99,8 +97,7 @@ ACTOR Future<Void> getWorkerInterfaces(Reference<ITransaction> tr,
}
// Hold the reference to the standalone's memory
state ThreadFuture<RangeResult> kvsFuture = tr->getRange(
KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")),
CLIENT_KNOBS->TOO_MANY);
KeyRangeRef("\xff\xff/worker_interfaces/"_sr, "\xff\xff/worker_interfaces0"_sr), CLIENT_KNOBS->TOO_MANY);
state RangeResult kvs = wait(safeThreadFutureToFuture(kvsFuture));
ASSERT(!kvs.more);
if (verify) {

View File

@ -32,7 +32,7 @@
namespace fdb_cli {
const KeyRef versionEpochSpecialKey = LiteralStringRef("\xff\xff/management/version_epoch");
const KeyRef versionEpochSpecialKey = "\xff\xff/management/version_epoch"_sr;
struct VersionInfo {
int64_t version;

View File

@ -654,7 +654,7 @@ ACTOR Future<Void> checkStatus(Future<Void> f,
StatusObject _s = wait(StatusClient::statusFetcher(localDb));
s = _s;
} else {
state ThreadFuture<Optional<Value>> statusValueF = tr->get(LiteralStringRef("\xff\xff/status/json"));
state ThreadFuture<Optional<Value>> statusValueF = tr->get("\xff\xff/status/json"_sr);
Optional<Value> statusValue = wait(safeThreadFutureToFuture(statusValueF));
if (!statusValue.present()) {
fprintf(stderr, "ERROR: Failed to get status json from the cluster\n");
@ -698,7 +698,7 @@ ACTOR Future<bool> createSnapshot(Database db, std::vector<StringRef> tokens) {
for (int i = 1; i < tokens.size(); i++) {
snapCmd = snapCmd.withSuffix(tokens[i]);
if (i != tokens.size() - 1) {
snapCmd = snapCmd.withSuffix(LiteralStringRef(" "));
snapCmd = snapCmd.withSuffix(" "_sr);
}
}
try {
@ -1328,13 +1328,10 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise, Reference<ClusterCo
}
if (tokencmp(tokens[0], "fileconfigure")) {
if (tokens.size() == 2 || (tokens.size() == 3 && (tokens[1] == LiteralStringRef("new") ||
tokens[1] == LiteralStringRef("FORCE")))) {
bool _result =
wait(makeInterruptable(fileConfigureCommandActor(db,
tokens.back().toString(),
tokens[1] == LiteralStringRef("new"),
tokens[1] == LiteralStringRef("FORCE"))));
if (tokens.size() == 2 ||
(tokens.size() == 3 && (tokens[1] == "new"_sr || tokens[1] == "FORCE"_sr))) {
bool _result = wait(makeInterruptable(fileConfigureCommandActor(
db, tokens.back().toString(), tokens[1] == "new"_sr, tokens[1] == "FORCE"_sr)));
if (!_result)
is_error = true;
} else {

View File

@ -120,7 +120,7 @@ extern const KeyRef ignoreSSFailureSpecialKey;
extern const KeyRangeRef processClassSourceSpecialKeyRange;
extern const KeyRangeRef processClassTypeSpecialKeyRange;
// Other special keys
inline const KeyRef errorMsgSpecialKey = LiteralStringRef("\xff\xff/error_message");
inline const KeyRef errorMsgSpecialKey = "\xff\xff/error_message"_sr;
inline const KeyRef workerInterfacesVerifyOptionSpecialKey = "\xff\xff/management/options/worker_interfaces/verify"_sr;
// help functions (Copied from fdbcli.actor.cpp)

View File

@ -968,10 +968,9 @@ ACTOR Future<Void> cleanupLogMutations(Database cx, Value destUidValue, bool del
.get(BackupAgentBase::keySourceStates)
.get(currLogUid)
.pack(DatabaseBackupAgent::keyStateStatus));
state Future<Optional<Value>> foundBackupKey =
tr->get(Subspace(currLogUid.withPrefix(LiteralStringRef("uid->config/"))
.withPrefix(fileBackupPrefixRange.begin))
.pack(LiteralStringRef("stateEnum")));
state Future<Optional<Value>> foundBackupKey = tr->get(
Subspace(currLogUid.withPrefix("uid->config/"_sr).withPrefix(fileBackupPrefixRange.begin))
.pack("stateEnum"_sr));
wait(success(foundDRKey) && success(foundBackupKey));
if (foundDRKey.get().present() && foundBackupKey.get().present()) {

View File

@ -1697,7 +1697,7 @@ ACTOR Future<Void> testBackupContainer(std::string url,
// List of sizes to use to test edge cases on underlying file implementations
state std::vector<int> fileSizes = { 0 };
if (StringRef(url).startsWith(LiteralStringRef("blob"))) {
if (StringRef(url).startsWith("blob"_sr)) {
fileSizes.push_back(CLIENT_KNOBS->BLOBSTORE_MULTIPART_MIN_PART_SIZE);
fileSizes.push_back(CLIENT_KNOBS->BLOBSTORE_MULTIPART_MIN_PART_SIZE + 10);
}
@ -1705,8 +1705,8 @@ ACTOR Future<Void> testBackupContainer(std::string url,
loop {
state Version logStart = v;
state int kvfiles = deterministicRandom()->randomInt(0, 3);
state Key begin = LiteralStringRef("");
state Key end = LiteralStringRef("");
state Key begin = ""_sr;
state Key end = ""_sr;
state int blockSize = 3 * sizeof(uint32_t) + begin.size() + end.size() + 8;
while (kvfiles > 0) {

View File

@ -103,16 +103,15 @@ ACTOR static Future<BackupContainerFileSystem::FilesAndSizesT> listFiles_impl(st
// Remove .lnk files from results, they are a side effect of a backup that was *read* during simulation. See
// openFile() above for more info on why they are created.
if (g_network->isSimulated())
files.erase(
std::remove_if(files.begin(),
files.end(),
[](std::string const& f) { return StringRef(f).endsWith(LiteralStringRef(".lnk")); }),
files.end());
files.erase(std::remove_if(files.begin(),
files.end(),
[](std::string const& f) { return StringRef(f).endsWith(".lnk"_sr); }),
files.end());
for (const auto& f : files) {
// Hide .part or .temp files.
StringRef s(f);
if (!s.endsWith(LiteralStringRef(".part")) && !s.endsWith(LiteralStringRef(".temp")))
if (!s.endsWith(".part"_sr) && !s.endsWith(".temp"_sr))
results.push_back({ f.substr(m_path.size() + 1), ::fileSize(f) });
}

View File

@ -1980,7 +1980,7 @@ struct KeyValueGen {
sharedPrefix = sharedPrefix.substr(0, sharedPrefixLen) + "_";
targetValueLength = deterministicRandom()->randomExp(0, 12);
allRange = KeyRangeRef(StringRef(sharedPrefix),
sharedPrefix.size() == 0 ? LiteralStringRef("\xff") : strinc(StringRef(sharedPrefix)));
sharedPrefix.size() == 0 ? "\xff"_sr : strinc(StringRef(sharedPrefix)));
if (deterministicRandom()->coinflip()) {
clearFrequency = 0.0;
@ -2299,9 +2299,9 @@ TEST_CASE("/blobgranule/files/snapshotFormatUnitTest") {
}
checkSnapshotEmpty(serialized, normalKeys.begin, data.front().key, kvGen.cipherKeys);
checkSnapshotEmpty(serialized, normalKeys.begin, LiteralStringRef("\x00"), kvGen.cipherKeys);
checkSnapshotEmpty(serialized, normalKeys.begin, "\x00"_sr, kvGen.cipherKeys);
checkSnapshotEmpty(serialized, keyAfter(data.back().key), normalKeys.end, kvGen.cipherKeys);
checkSnapshotEmpty(serialized, LiteralStringRef("\xfe"), normalKeys.end, kvGen.cipherKeys);
checkSnapshotEmpty(serialized, "\xfe"_sr, normalKeys.end, kvGen.cipherKeys);
fmt::print("Snapshot format test done!\n");

View File

@ -167,7 +167,7 @@ TEST_CASE("/fdbserver/blobgranule/isRangeCoveredByBlob") {
}
// check '' to \xff
{ ASSERT(isRangeFullyCovered(KeyRangeRef(LiteralStringRef(""), LiteralStringRef("\xff")), chunks) == false); }
{ ASSERT(isRangeFullyCovered(KeyRangeRef(""_sr, "\xff"_sr), chunks) == false); }
// check {key_a1, key_a9}
{ ASSERT(isRangeFullyCovered(KeyRangeRef("key_a1"_sr, "key_a9"_sr), chunks)); }

View File

@ -37,11 +37,11 @@
#include "flow/actorcompiler.h" // has to be last include
const Key DatabaseBackupAgent::keyAddPrefix = LiteralStringRef("add_prefix");
const Key DatabaseBackupAgent::keyRemovePrefix = LiteralStringRef("remove_prefix");
const Key DatabaseBackupAgent::keyRangeVersions = LiteralStringRef("range_versions");
const Key DatabaseBackupAgent::keyCopyStop = LiteralStringRef("copy_stop");
const Key DatabaseBackupAgent::keyDatabasesInSync = LiteralStringRef("databases_in_sync");
const Key DatabaseBackupAgent::keyAddPrefix = "add_prefix"_sr;
const Key DatabaseBackupAgent::keyRemovePrefix = "remove_prefix"_sr;
const Key DatabaseBackupAgent::keyRangeVersions = "range_versions"_sr;
const Key DatabaseBackupAgent::keyCopyStop = "copy_stop"_sr;
const Key DatabaseBackupAgent::keyDatabasesInSync = "databases_in_sync"_sr;
const int DatabaseBackupAgent::LATEST_DR_VERSION = 1;
DatabaseBackupAgent::DatabaseBackupAgent()
@ -75,8 +75,7 @@ DatabaseBackupAgent::DatabaseBackupAgent(Database src)
class DRConfig {
public:
DRConfig(UID uid = UID())
: uid(uid),
configSpace(uidPrefixKey(LiteralStringRef("uid->config/").withPrefix(databaseBackupPrefixRange.begin), uid)) {}
: uid(uid), configSpace(uidPrefixKey("uid->config/"_sr.withPrefix(databaseBackupPrefixRange.begin), uid)) {}
DRConfig(Reference<Task> task)
: DRConfig(BinaryReader::fromStringRef<UID>(task->params[BackupAgentBase::keyConfigLogUid], Unversioned())) {}
@ -203,7 +202,7 @@ struct BackupRangeTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
ACTOR static Future<Void> _execute(Database cx,
@ -536,9 +535,9 @@ struct BackupRangeTaskFunc : TaskFuncBase {
return Void();
}
};
StringRef BackupRangeTaskFunc::name = LiteralStringRef("dr_backup_range");
const Key BackupRangeTaskFunc::keyAddBackupRangeTasks = LiteralStringRef("addBackupRangeTasks");
const Key BackupRangeTaskFunc::keyBackupRangeBeginKey = LiteralStringRef("backupRangeBeginKey");
StringRef BackupRangeTaskFunc::name = "dr_backup_range"_sr;
const Key BackupRangeTaskFunc::keyAddBackupRangeTasks = "addBackupRangeTasks"_sr;
const Key BackupRangeTaskFunc::keyBackupRangeBeginKey = "backupRangeBeginKey"_sr;
REGISTER_TASKFUNC(BackupRangeTaskFunc);
struct FinishFullBackupTaskFunc : TaskFuncBase {
@ -588,7 +587,7 @@ struct FinishFullBackupTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -606,7 +605,7 @@ struct FinishFullBackupTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef FinishFullBackupTaskFunc::name = LiteralStringRef("dr_finish_full_backup");
StringRef FinishFullBackupTaskFunc::name = "dr_finish_full_backup"_sr;
REGISTER_TASKFUNC(FinishFullBackupTaskFunc);
struct EraseLogRangeTaskFunc : TaskFuncBase {
@ -683,7 +682,7 @@ struct EraseLogRangeTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -697,7 +696,7 @@ struct EraseLogRangeTaskFunc : TaskFuncBase {
return Void();
}
};
StringRef EraseLogRangeTaskFunc::name = LiteralStringRef("dr_erase_log_range");
StringRef EraseLogRangeTaskFunc::name = "dr_erase_log_range"_sr;
REGISTER_TASKFUNC(EraseLogRangeTaskFunc);
struct CopyLogRangeTaskFunc : TaskFuncBase {
@ -958,7 +957,7 @@ struct CopyLogRangeTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -989,8 +988,8 @@ struct CopyLogRangeTaskFunc : TaskFuncBase {
return Void();
}
};
StringRef CopyLogRangeTaskFunc::name = LiteralStringRef("dr_copy_log_range");
const Key CopyLogRangeTaskFunc::keyNextBeginVersion = LiteralStringRef("nextBeginVersion");
StringRef CopyLogRangeTaskFunc::name = "dr_copy_log_range"_sr;
const Key CopyLogRangeTaskFunc::keyNextBeginVersion = "nextBeginVersion"_sr;
REGISTER_TASKFUNC(CopyLogRangeTaskFunc);
struct CopyLogsTaskFunc : TaskFuncBase {
@ -1125,7 +1124,7 @@ struct CopyLogsTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -1143,7 +1142,7 @@ struct CopyLogsTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef CopyLogsTaskFunc::name = LiteralStringRef("dr_copy_logs");
StringRef CopyLogsTaskFunc::name = "dr_copy_logs"_sr;
REGISTER_TASKFUNC(CopyLogsTaskFunc);
struct FinishedFullBackupTaskFunc : TaskFuncBase {
@ -1235,7 +1234,7 @@ struct FinishedFullBackupTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -1283,8 +1282,8 @@ struct FinishedFullBackupTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef FinishedFullBackupTaskFunc::name = LiteralStringRef("dr_finished_full_backup");
const Key FinishedFullBackupTaskFunc::keyInsertTask = LiteralStringRef("insertTask");
StringRef FinishedFullBackupTaskFunc::name = "dr_finished_full_backup"_sr;
const Key FinishedFullBackupTaskFunc::keyInsertTask = "insertTask"_sr;
REGISTER_TASKFUNC(FinishedFullBackupTaskFunc);
struct CopyDiffLogsTaskFunc : TaskFuncBase {
@ -1396,7 +1395,7 @@ struct CopyDiffLogsTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -1414,7 +1413,7 @@ struct CopyDiffLogsTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef CopyDiffLogsTaskFunc::name = LiteralStringRef("dr_copy_diff_logs");
StringRef CopyDiffLogsTaskFunc::name = "dr_copy_diff_logs"_sr;
REGISTER_TASKFUNC(CopyDiffLogsTaskFunc);
// Skip unneeded EraseLogRangeTaskFunc in 5.1
@ -1446,7 +1445,7 @@ struct SkipOldEraseLogRangeTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef SkipOldEraseLogRangeTaskFunc::name = LiteralStringRef("dr_skip_legacy_task");
StringRef SkipOldEraseLogRangeTaskFunc::name = "dr_skip_legacy_task"_sr;
REGISTER_TASKFUNC(SkipOldEraseLogRangeTaskFunc);
REGISTER_TASKFUNC_ALIAS(SkipOldEraseLogRangeTaskFunc, db_erase_log_range);
@ -1652,7 +1651,7 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -1683,8 +1682,8 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase {
return Void();
}
};
StringRef OldCopyLogRangeTaskFunc::name = LiteralStringRef("db_copy_log_range");
const Key OldCopyLogRangeTaskFunc::keyNextBeginVersion = LiteralStringRef("nextBeginVersion");
StringRef OldCopyLogRangeTaskFunc::name = "db_copy_log_range"_sr;
const Key OldCopyLogRangeTaskFunc::keyNextBeginVersion = "nextBeginVersion"_sr;
REGISTER_TASKFUNC(OldCopyLogRangeTaskFunc);
struct AbortOldBackupTaskFunc : TaskFuncBase {
@ -1753,7 +1752,7 @@ struct AbortOldBackupTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -1771,7 +1770,7 @@ struct AbortOldBackupTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef AbortOldBackupTaskFunc::name = LiteralStringRef("dr_abort_legacy_backup");
StringRef AbortOldBackupTaskFunc::name = "dr_abort_legacy_backup"_sr;
REGISTER_TASKFUNC(AbortOldBackupTaskFunc);
REGISTER_TASKFUNC_ALIAS(AbortOldBackupTaskFunc, db_backup_range);
REGISTER_TASKFUNC_ALIAS(AbortOldBackupTaskFunc, db_finish_full_backup);
@ -1918,7 +1917,7 @@ struct CopyDiffLogsUpgradeTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef CopyDiffLogsUpgradeTaskFunc::name = LiteralStringRef("db_copy_diff_logs");
StringRef CopyDiffLogsUpgradeTaskFunc::name = "db_copy_diff_logs"_sr;
REGISTER_TASKFUNC(CopyDiffLogsUpgradeTaskFunc);
struct BackupRestorableTaskFunc : TaskFuncBase {
@ -2031,7 +2030,7 @@ struct BackupRestorableTaskFunc : TaskFuncBase {
task,
parentTask->params[Task::reservedTaskParamValidKey],
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -2049,7 +2048,7 @@ struct BackupRestorableTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef BackupRestorableTaskFunc::name = LiteralStringRef("dr_backup_restorable");
StringRef BackupRestorableTaskFunc::name = "dr_backup_restorable"_sr;
REGISTER_TASKFUNC(BackupRestorableTaskFunc);
struct StartFullBackupTaskFunc : TaskFuncBase {
@ -2281,7 +2280,7 @@ struct StartFullBackupTaskFunc : TaskFuncBase {
task->params[BackupAgentBase::keyConfigBackupRanges] = keyConfigBackupRanges;
task->params[BackupAgentBase::keyTagName] = tagName;
task->params[DatabaseBackupAgent::keyDatabasesInSync] =
backupAction == DatabaseBackupAgent::PreBackupAction::NONE ? LiteralStringRef("t") : LiteralStringRef("f");
backupAction == DatabaseBackupAgent::PreBackupAction::NONE ? "t"_sr : "f"_sr;
if (!waitFor) {
return taskBucket->addTask(tr,
@ -2301,7 +2300,7 @@ struct StartFullBackupTaskFunc : TaskFuncBase {
.get(logUid)
.pack(BackupAgentBase::keyFolderId),
task->params[BackupAgentBase::keyFolderId]));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -2319,7 +2318,7 @@ struct StartFullBackupTaskFunc : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef StartFullBackupTaskFunc::name = LiteralStringRef("dr_start_full_backup");
StringRef StartFullBackupTaskFunc::name = "dr_start_full_backup"_sr;
REGISTER_TASKFUNC(StartFullBackupTaskFunc);
} // namespace dbBackup

View File

@ -560,38 +560,38 @@ bool DatabaseConfiguration::setInternal(KeyRef key, ValueRef value) {
KeyRef ck = key.removePrefix(configKeysPrefix);
int type;
if (ck == LiteralStringRef("initialized")) {
if (ck == "initialized"_sr) {
initialized = true;
} else if (ck == LiteralStringRef("commit_proxies")) {
} else if (ck == "commit_proxies"_sr) {
commitProxyCount = toInt(value);
if (commitProxyCount == -1)
overwriteProxiesCount();
} else if (ck == LiteralStringRef("grv_proxies")) {
} else if (ck == "grv_proxies"_sr) {
grvProxyCount = toInt(value);
if (grvProxyCount == -1)
overwriteProxiesCount();
} else if (ck == LiteralStringRef("resolvers")) {
} else if (ck == "resolvers"_sr) {
parse(&resolverCount, value);
} else if (ck == LiteralStringRef("logs")) {
} else if (ck == "logs"_sr) {
parse(&desiredTLogCount, value);
} else if (ck == LiteralStringRef("log_replicas")) {
} else if (ck == "log_replicas"_sr) {
parse(&tLogReplicationFactor, value);
tLogWriteAntiQuorum = std::min(tLogWriteAntiQuorum, tLogReplicationFactor / 2);
} else if (ck == LiteralStringRef("log_anti_quorum")) {
} else if (ck == "log_anti_quorum"_sr) {
parse(&tLogWriteAntiQuorum, value);
if (tLogReplicationFactor > 0) {
tLogWriteAntiQuorum = std::min(tLogWriteAntiQuorum, tLogReplicationFactor / 2);
}
} else if (ck == LiteralStringRef("storage_replicas")) {
} else if (ck == "storage_replicas"_sr) {
parse(&storageTeamSize, value);
} else if (ck == LiteralStringRef("tss_count")) {
} else if (ck == "tss_count"_sr) {
parse(&desiredTSSCount, value);
} else if (ck == LiteralStringRef("log_version")) {
} else if (ck == "log_version"_sr) {
parse((&type), value);
type = std::max((int)TLogVersion::MIN_RECRUITABLE, type);
type = std::min((int)TLogVersion::MAX_SUPPORTED, type);
tLogVersion = (TLogVersion::Version)type;
} else if (ck == LiteralStringRef("log_engine")) {
} else if (ck == "log_engine"_sr) {
parse((&type), value);
tLogDataStoreType = (KeyValueStoreType::StoreType)type;
// TODO: Remove this once Redwood works as a log engine
@ -602,62 +602,62 @@ bool DatabaseConfiguration::setInternal(KeyRef key, ValueRef value) {
if (tLogDataStoreType == KeyValueStoreType::MEMORY_RADIXTREE) {
tLogDataStoreType = KeyValueStoreType::SSD_BTREE_V2;
}
} else if (ck == LiteralStringRef("log_spill")) {
} else if (ck == "log_spill"_sr) {
parse((&type), value);
tLogSpillType = (TLogSpillType::SpillType)type;
} else if (ck == LiteralStringRef("storage_engine")) {
} else if (ck == "storage_engine"_sr) {
parse((&type), value);
storageServerStoreType = (KeyValueStoreType::StoreType)type;
} else if (ck == LiteralStringRef("tss_storage_engine")) {
} else if (ck == "tss_storage_engine"_sr) {
parse((&type), value);
testingStorageServerStoreType = (KeyValueStoreType::StoreType)type;
} else if (ck == LiteralStringRef("auto_commit_proxies")) {
} else if (ck == "auto_commit_proxies"_sr) {
parse(&autoCommitProxyCount, value);
} else if (ck == LiteralStringRef("auto_grv_proxies")) {
} else if (ck == "auto_grv_proxies"_sr) {
parse(&autoGrvProxyCount, value);
} else if (ck == LiteralStringRef("auto_resolvers")) {
} else if (ck == "auto_resolvers"_sr) {
parse(&autoResolverCount, value);
} else if (ck == LiteralStringRef("auto_logs")) {
} else if (ck == "auto_logs"_sr) {
parse(&autoDesiredTLogCount, value);
} else if (ck == LiteralStringRef("storage_replication_policy")) {
} else if (ck == "storage_replication_policy"_sr) {
parseReplicationPolicy(&storagePolicy, value);
} else if (ck == LiteralStringRef("log_replication_policy")) {
} else if (ck == "log_replication_policy"_sr) {
parseReplicationPolicy(&tLogPolicy, value);
} else if (ck == LiteralStringRef("log_routers")) {
} else if (ck == "log_routers"_sr) {
parse(&desiredLogRouterCount, value);
} else if (ck == LiteralStringRef("remote_logs")) {
} else if (ck == "remote_logs"_sr) {
parse(&remoteDesiredTLogCount, value);
} else if (ck == LiteralStringRef("remote_log_replicas")) {
} else if (ck == "remote_log_replicas"_sr) {
parse(&remoteTLogReplicationFactor, value);
} else if (ck == LiteralStringRef("remote_log_policy")) {
} else if (ck == "remote_log_policy"_sr) {
parseReplicationPolicy(&remoteTLogPolicy, value);
} else if (ck == LiteralStringRef("backup_worker_enabled")) {
} else if (ck == "backup_worker_enabled"_sr) {
parse((&type), value);
backupWorkerEnabled = (type != 0);
} else if (ck == LiteralStringRef("usable_regions")) {
} else if (ck == "usable_regions"_sr) {
parse(&usableRegions, value);
} else if (ck == LiteralStringRef("repopulate_anti_quorum")) {
} else if (ck == "repopulate_anti_quorum"_sr) {
parse(&repopulateRegionAntiQuorum, value);
} else if (ck == LiteralStringRef("regions")) {
} else if (ck == "regions"_sr) {
parse(&regions, value);
} else if (ck == LiteralStringRef("perpetual_storage_wiggle")) {
} else if (ck == "perpetual_storage_wiggle"_sr) {
parse(&perpetualStorageWiggleSpeed, value);
} else if (ck == LiteralStringRef("perpetual_storage_wiggle_locality")) {
} else if (ck == "perpetual_storage_wiggle_locality"_sr) {
if (!isValidPerpetualStorageWiggleLocality(value.toString())) {
return false;
}
perpetualStorageWiggleLocality = value.toString();
} else if (ck == LiteralStringRef("storage_migration_type")) {
} else if (ck == "storage_migration_type"_sr) {
parse((&type), value);
storageMigrationType = (StorageMigrationType::MigrationType)type;
} else if (ck == LiteralStringRef("tenant_mode")) {
} else if (ck == "tenant_mode"_sr) {
tenantMode = TenantMode::fromValue(value);
} else if (ck == LiteralStringRef("proxies")) {
} else if (ck == "proxies"_sr) {
overwriteProxiesCount();
} else if (ck == LiteralStringRef("blob_granules_enabled")) {
} else if (ck == "blob_granules_enabled"_sr) {
parse((&type), value);
blobGranulesEnabled = (type != 0);
} else if (ck == LiteralStringRef("encryption_at_rest_mode")) {
} else if (ck == "encryption_at_rest_mode"_sr) {
encryptionAtRestMode = EncryptionAtRestMode::fromValue(value);
} else {
return false;

View File

@ -90,7 +90,7 @@ std::string secondsToTimeFormat(int64_t seconds) {
return format("%lld second(s)", seconds);
}
const Key FileBackupAgent::keyLastRestorable = LiteralStringRef("last_restorable");
const Key FileBackupAgent::keyLastRestorable = "last_restorable"_sr;
// For convenience
typedef FileBackupAgent::ERestoreState ERestoreState;
@ -98,19 +98,19 @@ typedef FileBackupAgent::ERestoreState ERestoreState;
StringRef FileBackupAgent::restoreStateText(ERestoreState id) {
switch (id) {
case ERestoreState::UNITIALIZED:
return LiteralStringRef("unitialized");
return "unitialized"_sr;
case ERestoreState::QUEUED:
return LiteralStringRef("queued");
return "queued"_sr;
case ERestoreState::STARTING:
return LiteralStringRef("starting");
return "starting"_sr;
case ERestoreState::RUNNING:
return LiteralStringRef("running");
return "running"_sr;
case ERestoreState::COMPLETED:
return LiteralStringRef("completed");
return "completed"_sr;
case ERestoreState::ABORTED:
return LiteralStringRef("aborted");
return "aborted"_sr;
default:
return LiteralStringRef("Unknown");
return "Unknown"_sr;
}
}
@ -162,7 +162,7 @@ public:
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Get the source container as a bare URL, without creating a container instance
KeyBackedProperty<Value> sourceContainerURL() { return configSpace.pack(LiteralStringRef("sourceContainer")); }
KeyBackedProperty<Value> sourceContainerURL() { return configSpace.pack("sourceContainer"_sr); }
// Total bytes written by all log and range restore tasks.
KeyBackedBinaryValue<int64_t> bytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
@ -775,8 +775,7 @@ ACTOR static Future<Void> abortFiveZeroBackup(FileBackupAgent* backupAgent,
state Subspace statusSpace = backupAgent->subspace.get(BackupAgentBase::keyStates).get(uid.toString());
state Subspace globalConfig = backupAgent->subspace.get(BackupAgentBase::keyConfig).get(uid.toString());
state Subspace newConfigSpace =
uidPrefixKey(LiteralStringRef("uid->config/").withPrefix(fileBackupPrefixRange.begin), uid);
state Subspace newConfigSpace = uidPrefixKey("uid->config/"_sr.withPrefix(fileBackupPrefixRange.begin), uid);
Optional<Value> statusStr = wait(tr->get(statusSpace.pack(FileBackupAgent::keyStateStatus)));
state EBackupState status =
@ -845,7 +844,7 @@ struct AbortFiveZeroBackupTask : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef AbortFiveZeroBackupTask::name = LiteralStringRef("abort_legacy_backup");
StringRef AbortFiveZeroBackupTask::name = "abort_legacy_backup"_sr;
REGISTER_TASKFUNC(AbortFiveZeroBackupTask);
REGISTER_TASKFUNC_ALIAS(AbortFiveZeroBackupTask, file_backup_diff_logs);
REGISTER_TASKFUNC_ALIAS(AbortFiveZeroBackupTask, file_backup_log_range);
@ -929,7 +928,7 @@ struct AbortFiveOneBackupTask : TaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef AbortFiveOneBackupTask::name = LiteralStringRef("abort_legacy_backup_5.2");
StringRef AbortFiveOneBackupTask::name = "abort_legacy_backup_5.2"_sr;
REGISTER_TASKFUNC(AbortFiveOneBackupTask);
REGISTER_TASKFUNC_ALIAS(AbortFiveOneBackupTask, file_backup_write_range);
REGISTER_TASKFUNC_ALIAS(AbortFiveOneBackupTask, file_backup_dispatch_ranges);
@ -968,7 +967,7 @@ ACTOR static Future<Key> addBackupTask(StringRef name,
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
// Clears the backup ID from "backupStartedKey" to pause backup workers.
@ -1385,7 +1384,7 @@ struct BackupRangeTaskFunc : BackupTaskFuncBase {
return Void();
}
};
StringRef BackupRangeTaskFunc::name = LiteralStringRef("file_backup_write_range_5.2");
StringRef BackupRangeTaskFunc::name = "file_backup_write_range_5.2"_sr;
REGISTER_TASKFUNC(BackupRangeTaskFunc);
struct BackupSnapshotDispatchTask : BackupTaskFuncBase {
@ -1956,7 +1955,7 @@ struct BackupSnapshotDispatchTask : BackupTaskFuncBase {
return Void();
}
};
StringRef BackupSnapshotDispatchTask::name = LiteralStringRef("file_backup_dispatch_ranges_5.2");
StringRef BackupSnapshotDispatchTask::name = "file_backup_dispatch_ranges_5.2"_sr;
REGISTER_TASKFUNC(BackupSnapshotDispatchTask);
struct BackupLogRangeTaskFunc : BackupTaskFuncBase {
@ -2195,7 +2194,7 @@ struct BackupLogRangeTaskFunc : BackupTaskFuncBase {
}
};
StringRef BackupLogRangeTaskFunc::name = LiteralStringRef("file_backup_write_logs_5.2");
StringRef BackupLogRangeTaskFunc::name = "file_backup_write_logs_5.2"_sr;
REGISTER_TASKFUNC(BackupLogRangeTaskFunc);
// This task stopped being used in 6.2, however the code remains here to handle upgrades.
@ -2270,7 +2269,7 @@ struct EraseLogRangeTaskFunc : BackupTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef EraseLogRangeTaskFunc::name = LiteralStringRef("file_backup_erase_logs_5.2");
StringRef EraseLogRangeTaskFunc::name = "file_backup_erase_logs_5.2"_sr;
REGISTER_TASKFUNC(EraseLogRangeTaskFunc);
struct BackupLogsDispatchTask : BackupTaskFuncBase {
@ -2440,7 +2439,7 @@ struct BackupLogsDispatchTask : BackupTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef BackupLogsDispatchTask::name = LiteralStringRef("file_backup_dispatch_logs_5.2");
StringRef BackupLogsDispatchTask::name = "file_backup_dispatch_logs_5.2"_sr;
REGISTER_TASKFUNC(BackupLogsDispatchTask);
struct FileBackupFinishedTask : BackupTaskFuncBase {
@ -2500,7 +2499,7 @@ struct FileBackupFinishedTask : BackupTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef FileBackupFinishedTask::name = LiteralStringRef("file_backup_finished_5.2");
StringRef FileBackupFinishedTask::name = "file_backup_finished_5.2"_sr;
REGISTER_TASKFUNC(FileBackupFinishedTask);
struct BackupSnapshotManifest : BackupTaskFuncBase {
@ -2689,7 +2688,7 @@ struct BackupSnapshotManifest : BackupTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef BackupSnapshotManifest::name = LiteralStringRef("file_backup_write_snapshot_manifest_5.2");
StringRef BackupSnapshotManifest::name = "file_backup_write_snapshot_manifest_5.2"_sr;
REGISTER_TASKFUNC(BackupSnapshotManifest);
Future<Key> BackupSnapshotDispatchTask::addSnapshotManifestTask(Reference<ReadYourWritesTransaction> tr,
@ -2875,7 +2874,7 @@ struct StartFullBackupTaskFunc : BackupTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef StartFullBackupTaskFunc::name = LiteralStringRef("file_backup_start_5.2");
StringRef StartFullBackupTaskFunc::name = "file_backup_start_5.2"_sr;
REGISTER_TASKFUNC(StartFullBackupTaskFunc);
struct RestoreCompleteTaskFunc : RestoreTaskFuncBase {
@ -2922,7 +2921,7 @@ struct RestoreCompleteTaskFunc : RestoreTaskFuncBase {
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
static StringRef name;
@ -2942,7 +2941,7 @@ struct RestoreCompleteTaskFunc : RestoreTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef RestoreCompleteTaskFunc::name = LiteralStringRef("restore_complete");
StringRef RestoreCompleteTaskFunc::name = "restore_complete"_sr;
REGISTER_TASKFUNC(RestoreCompleteTaskFunc);
struct RestoreFileTaskFuncBase : RestoreTaskFuncBase {
@ -3214,7 +3213,7 @@ struct RestoreRangeTaskFunc : RestoreFileTaskFuncBase {
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
static StringRef name;
@ -3234,7 +3233,7 @@ struct RestoreRangeTaskFunc : RestoreFileTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef RestoreRangeTaskFunc::name = LiteralStringRef("restore_range_data");
StringRef RestoreRangeTaskFunc::name = "restore_range_data"_sr;
REGISTER_TASKFUNC(RestoreRangeTaskFunc);
// Decodes a mutation log key, which contains (hash, commitVersion, chunkNumber) and
@ -3528,7 +3527,7 @@ struct RestoreLogDataTaskFunc : RestoreFileTaskFuncBase {
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
Future<Void> execute(Database cx,
@ -3544,7 +3543,7 @@ struct RestoreLogDataTaskFunc : RestoreFileTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef RestoreLogDataTaskFunc::name = LiteralStringRef("restore_log_data");
StringRef RestoreLogDataTaskFunc::name = "restore_log_data"_sr;
REGISTER_TASKFUNC(RestoreLogDataTaskFunc);
struct RestoreDispatchTaskFunc : RestoreTaskFuncBase {
@ -3912,7 +3911,7 @@ struct RestoreDispatchTaskFunc : RestoreTaskFuncBase {
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
Future<Void> execute(Database cx,
@ -3928,7 +3927,7 @@ struct RestoreDispatchTaskFunc : RestoreTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef RestoreDispatchTaskFunc::name = LiteralStringRef("restore_dispatch");
StringRef RestoreDispatchTaskFunc::name = "restore_dispatch"_sr;
REGISTER_TASKFUNC(RestoreDispatchTaskFunc);
ACTOR Future<std::string> restoreStatus(Reference<ReadYourWritesTransaction> tr, Key tagName) {
@ -4270,7 +4269,7 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
}
wait(waitFor->onSetAddTask(tr, taskBucket, task));
return LiteralStringRef("OnSetAddTask");
return "OnSetAddTask"_sr;
}
StringRef getName() const override { return name; };
@ -4288,7 +4287,7 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
return _finish(tr, tb, fb, task);
};
};
StringRef StartFullRestoreTaskFunc::name = LiteralStringRef("restore_start");
StringRef StartFullRestoreTaskFunc::name = "restore_start"_sr;
REGISTER_TASKFUNC(StartFullRestoreTaskFunc);
} // namespace fileBackup
@ -4881,7 +4880,7 @@ public:
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
try {
tr->set(backupPausedKey, pause ? LiteralStringRef("1") : LiteralStringRef("0"));
tr->set(backupPausedKey, pause ? "1"_sr : "0"_sr);
wait(tr->commit());
break;
} catch (Error& e) {

View File

@ -28,14 +28,14 @@
#include "flow/actorcompiler.h" // This must be the last #include.
const KeyRef fdbClientInfoTxnSampleRate = LiteralStringRef("config/fdb_client_info/client_txn_sample_rate");
const KeyRef fdbClientInfoTxnSizeLimit = LiteralStringRef("config/fdb_client_info/client_txn_size_limit");
const KeyRef fdbClientInfoTxnSampleRate = "config/fdb_client_info/client_txn_sample_rate"_sr;
const KeyRef fdbClientInfoTxnSizeLimit = "config/fdb_client_info/client_txn_size_limit"_sr;
const KeyRef transactionTagSampleRate = LiteralStringRef("config/transaction_tag_sample_rate");
const KeyRef transactionTagSampleCost = LiteralStringRef("config/transaction_tag_sample_cost");
const KeyRef transactionTagSampleRate = "config/transaction_tag_sample_rate"_sr;
const KeyRef transactionTagSampleCost = "config/transaction_tag_sample_cost"_sr;
const KeyRef samplingFrequency = LiteralStringRef("visibility/sampling/frequency");
const KeyRef samplingWindow = LiteralStringRef("visibility/sampling/window");
const KeyRef samplingFrequency = "visibility/sampling/frequency"_sr;
const KeyRef samplingWindow = "visibility/sampling/window"_sr;
GlobalConfig::GlobalConfig(DatabaseContext* cx) : cx(cx), lastUpdate(0) {}
@ -62,7 +62,7 @@ void GlobalConfig::applyChanges(Transaction& tr,
// Write version key to trigger update in cluster controller.
tr.atomicOp(globalConfigVersionKey,
LiteralStringRef("0123456789\x00\x00\x00\x00"), // versionstamp
"0123456789\x00\x00\x00\x00"_sr, // versionstamp
MutationRef::SetVersionstampedValue);
}

View File

@ -246,7 +246,7 @@ static Future<Void> krmSetRangeCoalescing_(Transaction* tr,
// Determine how far to extend this range at the beginning
auto beginRange = keys[0].get();
bool hasBegin = beginRange.size() > 0 && beginRange[0].key.startsWith(mapPrefix);
Value beginValue = hasBegin ? beginRange[0].value : LiteralStringRef("");
Value beginValue = hasBegin ? beginRange[0].value : ""_sr;
state Key beginKey = withPrefix.begin;
if (beginValue == value) {
@ -259,7 +259,7 @@ static Future<Void> krmSetRangeCoalescing_(Transaction* tr,
bool hasEnd = endRange.size() >= 1 && endRange[0].key.startsWith(mapPrefix) && endRange[0].key <= withPrefix.end;
bool hasNext = (endRange.size() == 2 && endRange[1].key.startsWith(mapPrefix)) ||
(endRange.size() == 1 && withPrefix.end < endRange[0].key && endRange[0].key.startsWith(mapPrefix));
Value existingValue = hasEnd ? endRange[0].value : LiteralStringRef("");
Value existingValue = hasEnd ? endRange[0].value : ""_sr;
bool valueMatches = value == existingValue;
KeyRange conflictRange = KeyRangeRef(hasBegin ? beginRange[0].key : mapPrefix, withPrefix.begin);
@ -317,20 +317,20 @@ Future<Void> krmSetRangeCoalescing(Reference<ReadYourWritesTransaction> const& t
TEST_CASE("/keyrangemap/decoderange/aligned") {
Arena arena;
Key prefix = LiteralStringRef("/prefix/");
StringRef fullKeyA = StringRef(arena, LiteralStringRef("/prefix/a"));
StringRef fullKeyB = StringRef(arena, LiteralStringRef("/prefix/b"));
StringRef fullKeyC = StringRef(arena, LiteralStringRef("/prefix/c"));
StringRef fullKeyD = StringRef(arena, LiteralStringRef("/prefix/d"));
Key prefix = "/prefix/"_sr;
StringRef fullKeyA = StringRef(arena, "/prefix/a"_sr);
StringRef fullKeyB = StringRef(arena, "/prefix/b"_sr);
StringRef fullKeyC = StringRef(arena, "/prefix/c"_sr);
StringRef fullKeyD = StringRef(arena, "/prefix/d"_sr);
StringRef keyA = StringRef(arena, LiteralStringRef("a"));
StringRef keyB = StringRef(arena, LiteralStringRef("b"));
StringRef keyC = StringRef(arena, LiteralStringRef("c"));
StringRef keyD = StringRef(arena, LiteralStringRef("d"));
StringRef keyE = StringRef(arena, LiteralStringRef("e"));
StringRef keyAB = StringRef(arena, LiteralStringRef("ab"));
StringRef keyAC = StringRef(arena, LiteralStringRef("ac"));
StringRef keyCD = StringRef(arena, LiteralStringRef("cd"));
StringRef keyA = StringRef(arena, "a"_sr);
StringRef keyB = StringRef(arena, "b"_sr);
StringRef keyC = StringRef(arena, "c"_sr);
StringRef keyD = StringRef(arena, "d"_sr);
StringRef keyE = StringRef(arena, "e"_sr);
StringRef keyAB = StringRef(arena, "ab"_sr);
StringRef keyAC = StringRef(arena, "ac"_sr);
StringRef keyCD = StringRef(arena, "cd"_sr);
// Fake getRange() call.
RangeResult kv;
@ -369,20 +369,20 @@ TEST_CASE("/keyrangemap/decoderange/aligned") {
TEST_CASE("/keyrangemap/decoderange/unaligned") {
Arena arena;
Key prefix = LiteralStringRef("/prefix/");
StringRef fullKeyA = StringRef(arena, LiteralStringRef("/prefix/a"));
StringRef fullKeyB = StringRef(arena, LiteralStringRef("/prefix/b"));
StringRef fullKeyC = StringRef(arena, LiteralStringRef("/prefix/c"));
StringRef fullKeyD = StringRef(arena, LiteralStringRef("/prefix/d"));
Key prefix = "/prefix/"_sr;
StringRef fullKeyA = StringRef(arena, "/prefix/a"_sr);
StringRef fullKeyB = StringRef(arena, "/prefix/b"_sr);
StringRef fullKeyC = StringRef(arena, "/prefix/c"_sr);
StringRef fullKeyD = StringRef(arena, "/prefix/d"_sr);
StringRef keyA = StringRef(arena, LiteralStringRef("a"));
StringRef keyB = StringRef(arena, LiteralStringRef("b"));
StringRef keyC = StringRef(arena, LiteralStringRef("c"));
StringRef keyD = StringRef(arena, LiteralStringRef("d"));
StringRef keyE = StringRef(arena, LiteralStringRef("e"));
StringRef keyAB = StringRef(arena, LiteralStringRef("ab"));
StringRef keyAC = StringRef(arena, LiteralStringRef("ac"));
StringRef keyCD = StringRef(arena, LiteralStringRef("cd"));
StringRef keyA = StringRef(arena, "a"_sr);
StringRef keyB = StringRef(arena, "b"_sr);
StringRef keyC = StringRef(arena, "c"_sr);
StringRef keyD = StringRef(arena, "d"_sr);
StringRef keyE = StringRef(arena, "e"_sr);
StringRef keyAB = StringRef(arena, "ab"_sr);
StringRef keyAC = StringRef(arena, "ac"_sr);
StringRef keyCD = StringRef(arena, "cd"_sr);
// Fake getRange() call.
RangeResult kv;

View File

@ -1156,10 +1156,8 @@ struct AutoQuorumChange final : IQuorumChange {
}
ACTOR static Future<int> getRedundancy(AutoQuorumChange* self, Transaction* tr) {
state Future<Optional<Value>> fStorageReplicas =
tr->get(LiteralStringRef("storage_replicas").withPrefix(configKeysPrefix));
state Future<Optional<Value>> fLogReplicas =
tr->get(LiteralStringRef("log_replicas").withPrefix(configKeysPrefix));
state Future<Optional<Value>> fStorageReplicas = tr->get("storage_replicas"_sr.withPrefix(configKeysPrefix));
state Future<Optional<Value>> fLogReplicas = tr->get("log_replicas"_sr.withPrefix(configKeysPrefix));
wait(success(fStorageReplicas) && success(fLogReplicas));
int redundancy = std::min(atoi(fStorageReplicas.get().get().toString().c_str()),
atoi(fLogReplicas.get().get().toString().c_str()));
@ -1321,10 +1319,7 @@ struct AutoQuorumChange final : IQuorumChange {
std::map<StringRef, std::map<StringRef, int>> currentCounts;
std::map<StringRef, int> hardLimits;
std::vector<StringRef> fields({ LiteralStringRef("dcid"),
LiteralStringRef("data_hall"),
LiteralStringRef("zoneid"),
LiteralStringRef("machineid") });
std::vector<StringRef> fields({ "dcid"_sr, "data_hall"_sr, "zoneid"_sr, "machineid"_sr });
for (auto field = fields.begin(); field != fields.end(); field++) {
if (field->toString() == "zoneid") {
@ -1350,7 +1345,7 @@ struct AutoQuorumChange final : IQuorumChange {
if (maxCounts[*field] == 0) {
maxCounts[*field] = 1;
}
auto value = worker->locality.get(*field).orDefault(LiteralStringRef(""));
auto value = worker->locality.get(*field).orDefault(""_sr);
auto currentCount = currentCounts[*field][value];
if (currentCount >= maxCounts[*field]) {
valid = false;
@ -1359,7 +1354,7 @@ struct AutoQuorumChange final : IQuorumChange {
}
if (valid) {
for (auto field = fields.begin(); field != fields.end(); field++) {
auto value = worker->locality.get(*field).orDefault(LiteralStringRef(""));
auto value = worker->locality.get(*field).orDefault(""_sr);
currentCounts[*field][value] += 1;
}
chosen.push_back(worker->address);
@ -1541,8 +1536,7 @@ ACTOR Future<Void> includeServers(Database cx, std::vector<AddressExclusion> ser
// This is why we now make two clears: first only of the ip
// address, the second will delete all ports.
if (s.isWholeMachine())
ryw.clear(KeyRangeRef(addr.withSuffix(LiteralStringRef(":")),
addr.withSuffix(LiteralStringRef(";"))));
ryw.clear(KeyRangeRef(addr.withSuffix(":"_sr), addr.withSuffix(";"_sr)));
}
}
TraceEvent("IncludeServersCommit").detail("Servers", describe(servers)).detail("Failed", failed);
@ -2122,9 +2116,7 @@ ACTOR Future<Void> lockDatabase(Transaction* tr, UID id) {
}
tr->atomicOp(databaseLockedKey,
BinaryWriter::toValue(id, Unversioned())
.withPrefix(LiteralStringRef("0123456789"))
.withSuffix(LiteralStringRef("\x00\x00\x00\x00")),
BinaryWriter::toValue(id, Unversioned()).withPrefix("0123456789"_sr).withSuffix("\x00\x00\x00\x00"_sr),
MutationRef::SetVersionstampedValue);
tr->addWriteConflictRange(normalKeys);
return Void();
@ -2145,9 +2137,7 @@ ACTOR Future<Void> lockDatabase(Reference<ReadYourWritesTransaction> tr, UID id)
}
tr->atomicOp(databaseLockedKey,
BinaryWriter::toValue(id, Unversioned())
.withPrefix(LiteralStringRef("0123456789"))
.withSuffix(LiteralStringRef("\x00\x00\x00\x00")),
BinaryWriter::toValue(id, Unversioned()).withPrefix("0123456789"_sr).withSuffix("\x00\x00\x00\x00"_sr),
MutationRef::SetVersionstampedValue);
tr->addWriteConflictRange(normalKeys);
return Void();
@ -2617,11 +2607,11 @@ TEST_CASE("/ManagementAPI/AutoQuorumChange/checkLocality") {
auto dataHall = dataCenter + std::to_string(i / 2 % 2);
auto rack = dataHall + std::to_string(i % 2);
auto machineId = rack + std::to_string(i);
data.locality.set(LiteralStringRef("dcid"), StringRef(dataCenter));
data.locality.set(LiteralStringRef("data_hall"), StringRef(dataHall));
data.locality.set(LiteralStringRef("rack"), StringRef(rack));
data.locality.set(LiteralStringRef("zoneid"), StringRef(rack));
data.locality.set(LiteralStringRef("machineid"), StringRef(machineId));
data.locality.set("dcid"_sr, StringRef(dataCenter));
data.locality.set("data_hall"_sr, StringRef(dataHall));
data.locality.set("rack"_sr, StringRef(rack));
data.locality.set("zoneid"_sr, StringRef(rack));
data.locality.set("machineid"_sr, StringRef(machineId));
data.address.ip = IPAddress(i);
if (g_network->isSimulated()) {
@ -2647,10 +2637,7 @@ TEST_CASE("/ManagementAPI/AutoQuorumChange/checkLocality") {
std::map<StringRef, std::set<StringRef>> chosenValues;
ASSERT(chosen.size() == 5);
std::vector<StringRef> fields({ LiteralStringRef("dcid"),
LiteralStringRef("data_hall"),
LiteralStringRef("zoneid"),
LiteralStringRef("machineid") });
std::vector<StringRef> fields({ "dcid"_sr, "data_hall"_sr, "zoneid"_sr, "machineid"_sr });
for (auto worker = chosen.begin(); worker != chosen.end(); worker++) {
ASSERT(worker->ip.toV4() < workers.size());
LocalityData data = workers[worker->ip.toV4()].locality;
@ -2659,10 +2646,10 @@ TEST_CASE("/ManagementAPI/AutoQuorumChange/checkLocality") {
}
}
ASSERT(chosenValues[LiteralStringRef("dcid")].size() == 2);
ASSERT(chosenValues[LiteralStringRef("data_hall")].size() == 4);
ASSERT(chosenValues[LiteralStringRef("zoneid")].size() == 5);
ASSERT(chosenValues[LiteralStringRef("machineid")].size() == 5);
ASSERT(chosenValues["dcid"_sr].size() == 2);
ASSERT(chosenValues["data_hall"_sr].size() == 4);
ASSERT(chosenValues["zoneid"_sr].size() == 5);
ASSERT(chosenValues["machineid"_sr].size() == 5);
ASSERT(std::find(chosen.begin(), chosen.end(), workers[noAssignIndex].address) != chosen.end());
return Void();

View File

@ -248,7 +248,7 @@ TEST_CASE("/fdbclient/MonitorLeader/ConnectionString/hostname") {
hostnames.push_back(Hostname::parse(hn1 + ":" + port1));
hostnames.push_back(Hostname::parse(hn2 + ":" + port2));
ClusterConnectionString cs(hostnames, LiteralStringRef("TestCluster:0"));
ClusterConnectionString cs(hostnames, "TestCluster:0"_sr);
ASSERT(cs.hostnames.size() == 2);
ASSERT(cs.coords.size() == 0);
ASSERT(cs.toString() == connectionString);
@ -259,7 +259,7 @@ TEST_CASE("/fdbclient/MonitorLeader/ConnectionString/hostname") {
hostnames.push_back(Hostname::parse(hn1 + ":" + port1));
hostnames.push_back(Hostname::parse(hn1 + ":" + port1));
try {
ClusterConnectionString cs(hostnames, LiteralStringRef("TestCluster:0"));
ClusterConnectionString cs(hostnames, "TestCluster:0"_sr);
} catch (Error& e) {
ASSERT(e.code() == error_code_connection_string_invalid);
}
@ -367,7 +367,7 @@ TEST_CASE("/fdbclient/MonitorLeader/parseConnectionString/fuzz") {
auto c = connectionString.begin();
while (c != connectionString.end()) {
if (deterministicRandom()->random01() < 0.1) // Add whitespace character
output += deterministicRandom()->randomChoice(LiteralStringRef(" \t\n\r"));
output += deterministicRandom()->randomChoice(" \t\n\r"_sr);
if (deterministicRandom()->random01() < 0.5) { // Add one of the input characters
output += *c;
++c;
@ -378,7 +378,7 @@ TEST_CASE("/fdbclient/MonitorLeader/parseConnectionString/fuzz") {
for (int i = 0; i < charCount; i++) {
output += deterministicRandom()->randomChoice(LiteralStringRef("asdfzxcv123345:!@#$#$&()<\"\' \t"));
}
output += deterministicRandom()->randomChoice(LiteralStringRef("\n\r"));
output += deterministicRandom()->randomChoice("\n\r"_sr);
}
}
@ -896,7 +896,7 @@ ACTOR Future<MonitorLeaderInfo> monitorProxiesOneGeneration(
info.intermediateConnRecord = connRecord;
return info;
} else {
req.issues.push_back_deep(req.issues.arena(), LiteralStringRef("incorrect_cluster_file_contents"));
req.issues.push_back_deep(req.issues.arena(), "incorrect_cluster_file_contents"_sr);
std::string connectionString = connRecord->getConnectionString().toString();
if (!incorrectTime.present()) {
incorrectTime = now();

View File

@ -179,7 +179,7 @@ ACTOR Future<Standalone<RangeResultRef>> MutationLogReader::getNext_impl(Mutatio
namespace {
// UNIT TESTS
TEST_CASE("/fdbclient/mutationlogreader/VersionKeyRefConversion") {
Key prefix = LiteralStringRef("foos");
Key prefix = "foos"_sr;
ASSERT(keyRefToVersion(versionToKey(0, prefix), prefix.size()) == 0);
ASSERT(keyRefToVersion(versionToKey(1, prefix), prefix.size()) == 1);

View File

@ -155,8 +155,8 @@ NetworkOptions::NetworkOptions()
supportedVersions(new ReferencedObject<Standalone<VectorRef<ClientVersionRef>>>()), runLoopProfilingEnabled(false),
primaryClient(true) {}
static const Key CLIENT_LATENCY_INFO_PREFIX = LiteralStringRef("client_latency/");
static const Key CLIENT_LATENCY_INFO_CTR_PREFIX = LiteralStringRef("client_latency_counter/");
static const Key CLIENT_LATENCY_INFO_PREFIX = "client_latency/"_sr;
static const Key CLIENT_LATENCY_INFO_CTR_PREFIX = "client_latency_counter/"_sr;
void DatabaseContext::addTssMapping(StorageServerInterface const& ssi, StorageServerInterface const& tssi) {
auto result = tssMapping.find(ssi.id());
@ -1153,7 +1153,7 @@ ACTOR static Future<Void> handleTssMismatches(DatabaseContext* cx) {
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
if (quarantine) {
tr->set(tssQuarantineKeyFor(data.first), LiteralStringRef(""));
tr->set(tssQuarantineKeyFor(data.first), ""_sr);
} else {
tr->clear(serverTagKeyFor(data.first));
}
@ -1329,7 +1329,7 @@ static RangeResult healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRange
RangeResult result;
if (CLIENT_BUGGIFY)
return result;
if (kr.contains(LiteralStringRef("\xff\xff/metrics/health/aggregate")) && metrics.worstStorageDurabilityLag != 0) {
if (kr.contains("\xff\xff/metrics/health/aggregate"_sr) && metrics.worstStorageDurabilityLag != 0) {
json_spirit::mObject statsObj;
statsObj["batch_limited"] = metrics.batchLimited;
statsObj["tps_limit"] = metrics.tpsLimit;
@ -1341,15 +1341,13 @@ static RangeResult healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRange
std::string statsString =
json_spirit::write_string(json_spirit::mValue(statsObj), json_spirit::Output_options::raw_utf8);
ValueRef bytes(result.arena(), statsString);
result.push_back(result.arena(), KeyValueRef(LiteralStringRef("\xff\xff/metrics/health/aggregate"), bytes));
result.push_back(result.arena(), KeyValueRef("\xff\xff/metrics/health/aggregate"_sr, bytes));
}
// tlog stats
{
int phase = 0; // Avoid comparing twice per loop iteration
for (const auto& [uid, logStats] : metrics.tLogQueue) {
StringRef k{
StringRef(uid.toString()).withPrefix(LiteralStringRef("\xff\xff/metrics/health/log/"), result.arena())
};
StringRef k{ StringRef(uid.toString()).withPrefix("\xff\xff/metrics/health/log/"_sr, result.arena()) };
if (phase == 0 && k >= kr.begin) {
phase = 1;
}
@ -1371,8 +1369,7 @@ static RangeResult healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRange
{
int phase = 0; // Avoid comparing twice per loop iteration
for (const auto& [uid, storageStats] : metrics.storageStats) {
StringRef k{ StringRef(uid.toString())
.withPrefix(LiteralStringRef("\xff\xff/metrics/health/storage/"), result.arena()) };
StringRef k{ StringRef(uid.toString()).withPrefix("\xff\xff/metrics/health/storage/"_sr, result.arena()) };
if (phase == 0 && k >= kr.begin) {
phase = 1;
}
@ -1398,10 +1395,9 @@ static RangeResult healthMetricsToKVPairs(const HealthMetrics& metrics, KeyRange
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"))) ||
kr.intersects(KeyRangeRef(LiteralStringRef("\xff\xff/metrics/health/log/"),
LiteralStringRef("\xff\xff/metrics/health/log0")))));
/*detailed ("per process")*/ kr.intersects(
KeyRangeRef("\xff\xff/metrics/health/storage/"_sr, "\xff\xff/metrics/health/storage0"_sr)) ||
kr.intersects(KeyRangeRef("\xff\xff/metrics/health/log/"_sr, "\xff\xff/metrics/health/log0"_sr))));
return healthMetricsToKVPairs(metrics, kr);
}
@ -1507,8 +1503,8 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
tenantCacheSize = g_network->isSimulated() ? CLIENT_KNOBS->TENANT_CACHE_EVICTION_SIZE_SIM
: CLIENT_KNOBS->TENANT_CACHE_EVICTION_SIZE;
getValueSubmitted.init(LiteralStringRef("NativeAPI.GetValueSubmitted"));
getValueCompleted.init(LiteralStringRef("NativeAPI.GetValueCompleted"));
getValueSubmitted.init("NativeAPI.GetValueSubmitted"_sr);
getValueCompleted.init("NativeAPI.GetValueCompleted"_sr);
clientDBInfoMonitor = monitorClientDBInfoChange(this, clientInfo, &proxiesChangeTrigger);
tssMismatchHandler = handleTssMismatches(this);
@ -1534,7 +1530,7 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<ManagementCommandsOptionsImpl>(
KeyRangeRef(LiteralStringRef("options/"), LiteralStringRef("options0"))
KeyRangeRef("options/"_sr, "options0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
@ -1556,31 +1552,31 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<ExclusionInProgressRangeImpl>(
KeyRangeRef(LiteralStringRef("in_progress_exclusion/"), LiteralStringRef("in_progress_exclusion0"))
KeyRangeRef("in_progress_exclusion/"_sr, "in_progress_exclusion0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::CONFIGURATION,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<ProcessClassRangeImpl>(
KeyRangeRef(LiteralStringRef("process/class_type/"), LiteralStringRef("process/class_type0"))
KeyRangeRef("process/class_type/"_sr, "process/class_type0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::CONFIGURATION,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<ProcessClassSourceRangeImpl>(
KeyRangeRef(LiteralStringRef("process/class_source/"), LiteralStringRef("process/class_source0"))
KeyRangeRef("process/class_source/"_sr, "process/class_source0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<LockDatabaseImpl>(
singleKeyRange(LiteralStringRef("db_locked"))
singleKeyRange("db_locked"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<ConsistencyCheckImpl>(
singleKeyRange(LiteralStringRef("consistency_check_suspended"))
singleKeyRange("consistency_check_suspended"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::GLOBALCONFIG,
@ -1594,44 +1590,44 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
SpecialKeySpace::MODULE::CONFIGURATION,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<CoordinatorsImpl>(
KeyRangeRef(LiteralStringRef("coordinators/"), LiteralStringRef("coordinators0"))
KeyRangeRef("coordinators/"_sr, "coordinators0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<CoordinatorsAutoImpl>(
singleKeyRange(LiteralStringRef("auto_coordinators"))
singleKeyRange("auto_coordinators"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<AdvanceVersionImpl>(
singleKeyRange(LiteralStringRef("min_required_commit_version"))
singleKeyRange("min_required_commit_version"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<VersionEpochImpl>(
singleKeyRange(LiteralStringRef("version_epoch"))
singleKeyRange("version_epoch"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<ClientProfilingImpl>(
KeyRangeRef(LiteralStringRef("profiling/"), LiteralStringRef("profiling0"))
KeyRangeRef("profiling/"_sr, "profiling0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)),
/* deprecated */ 720);
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<MaintenanceImpl>(
KeyRangeRef(LiteralStringRef("maintenance/"), LiteralStringRef("maintenance0"))
KeyRangeRef("maintenance/"_sr, "maintenance0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::MANAGEMENT,
SpecialKeySpace::IMPLTYPE::READWRITE,
std::make_unique<DataDistributionImpl>(
KeyRangeRef(LiteralStringRef("data_distribution/"), LiteralStringRef("data_distribution0"))
KeyRangeRef("data_distribution/"_sr, "data_distribution0"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::ACTORLINEAGE,
@ -1655,20 +1651,18 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
registerSpecialKeysImpl(SpecialKeySpace::MODULE::METRICS,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<DDStatsRangeImpl>(ddStatsRange));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::METRICS,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<HealthMetricsRangeImpl>(KeyRangeRef(LiteralStringRef("\xff\xff/metrics/health/"),
LiteralStringRef("\xff\xff/metrics/health0"))));
registerSpecialKeysImpl(
SpecialKeySpace::MODULE::WORKERINTERFACE,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<WorkerInterfacesSpecialKeyImpl>(KeyRangeRef(
LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0"))));
registerSpecialKeysImpl(SpecialKeySpace::MODULE::METRICS,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<HealthMetricsRangeImpl>(
KeyRangeRef("\xff\xff/metrics/health/"_sr, "\xff\xff/metrics/health0"_sr)));
registerSpecialKeysImpl(SpecialKeySpace::MODULE::WORKERINTERFACE,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<WorkerInterfacesSpecialKeyImpl>(
KeyRangeRef("\xff\xff/worker_interfaces/"_sr, "\xff\xff/worker_interfaces0"_sr)));
registerSpecialKeysImpl(SpecialKeySpace::MODULE::STATUSJSON,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<SingleSpecialKeyImpl>(
LiteralStringRef("\xff\xff/status/json"),
"\xff\xff/status/json"_sr,
[](ReadYourWritesTransaction* ryw) -> Future<Optional<Value>> {
if (ryw->getDatabase().getPtr() && ryw->getDatabase()->getConnectionRecord()) {
++ryw->getDatabase()->transactionStatusRequests;
@ -1681,7 +1675,7 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
registerSpecialKeysImpl(SpecialKeySpace::MODULE::CLUSTERFILEPATH,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<SingleSpecialKeyImpl>(
LiteralStringRef("\xff\xff/cluster_file_path"),
"\xff\xff/cluster_file_path"_sr,
[](ReadYourWritesTransaction* ryw) -> Future<Optional<Value>> {
try {
if (ryw->getDatabase().getPtr() &&
@ -1701,7 +1695,7 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
SpecialKeySpace::MODULE::CONNECTIONSTRING,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<SingleSpecialKeyImpl>(
LiteralStringRef("\xff\xff/connection_string"),
"\xff\xff/connection_string"_sr,
[](ReadYourWritesTransaction* ryw) -> Future<Optional<Value>> {
try {
if (ryw->getDatabase().getPtr() && ryw->getDatabase()->getConnectionRecord()) {
@ -1718,7 +1712,7 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
registerSpecialKeysImpl(SpecialKeySpace::MODULE::CLUSTERID,
SpecialKeySpace::IMPLTYPE::READONLY,
std::make_unique<SingleSpecialKeyImpl>(
LiteralStringRef("\xff\xff/cluster_id"),
"\xff\xff/cluster_id"_sr,
[](ReadYourWritesTransaction* ryw) -> Future<Optional<Value>> {
try {
if (ryw->getDatabase().getPtr()) {
@ -2485,7 +2479,7 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional<StringRef> valu
ASSERT(value.present());
Standalone<VectorRef<ClientVersionRef>> supportedVersions;
std::vector<StringRef> supportedVersionsStrings = value.get().splitAny(LiteralStringRef(";"));
std::vector<StringRef> supportedVersionsStrings = value.get().splitAny(";"_sr);
for (StringRef versionString : supportedVersionsStrings) {
#ifdef ADDRESS_SANITIZER
__lsan_disable();
@ -5637,7 +5631,7 @@ void Transaction::addReadConflictRange(KeyRangeRef const& keys) {
void Transaction::makeSelfConflicting() {
BinaryWriter wr(Unversioned());
wr.serializeBytes(LiteralStringRef("\xFF/SC/"));
wr.serializeBytes("\xFF/SC/"_sr);
wr << deterministicRandom()->randomUniqueID();
auto r = singleKeyRange(wr.toValue(), tr.arena);
tr.transaction.read_conflict_ranges.push_back(tr.arena, r);
@ -6835,19 +6829,16 @@ ACTOR Future<Void> readVersionBatcher(DatabaseContext* cx,
state Future<Void> timeout;
state Optional<UID> debugID;
state bool send_batch;
state Reference<Histogram> batchSizeDist = Histogram::getHistogram(LiteralStringRef("GrvBatcher"),
LiteralStringRef("ClientGrvBatchSize"),
Histogram::Unit::countLinear,
0,
CLIENT_KNOBS->MAX_BATCH_SIZE * 2);
state Reference<Histogram> batchSizeDist = Histogram::getHistogram(
"GrvBatcher"_sr, "ClientGrvBatchSize"_sr, Histogram::Unit::countLinear, 0, CLIENT_KNOBS->MAX_BATCH_SIZE * 2);
state Reference<Histogram> batchIntervalDist =
Histogram::getHistogram(LiteralStringRef("GrvBatcher"),
LiteralStringRef("ClientGrvBatchInterval"),
Histogram::getHistogram("GrvBatcher"_sr,
"ClientGrvBatchInterval"_sr,
Histogram::Unit::microseconds,
0,
CLIENT_KNOBS->GRV_BATCH_TIMEOUT * 1000000 * 2);
state Reference<Histogram> grvReplyLatencyDist = Histogram::getHistogram(
LiteralStringRef("GrvBatcher"), LiteralStringRef("ClientGrvReplyLatency"), Histogram::Unit::microseconds);
state Reference<Histogram> grvReplyLatencyDist =
Histogram::getHistogram("GrvBatcher"_sr, "ClientGrvReplyLatency"_sr, Histogram::Unit::microseconds);
state double lastRequestTime = now();
state TransactionTagMap<uint32_t> tags;
@ -8737,16 +8728,13 @@ ACTOR static Future<int64_t> rebootWorkerActor(DatabaseContext* cx, ValueRef add
for (const auto& it : kvs) {
ClientWorkerInterface workerInterf =
BinaryReader::fromStringRef<ClientWorkerInterface>(it.value, IncludeVersion());
Key primaryAddress =
it.key.endsWith(LiteralStringRef(":tls")) ? it.key.removeSuffix(LiteralStringRef(":tls")) : it.key;
Key primaryAddress = it.key.endsWith(":tls"_sr) ? it.key.removeSuffix(":tls"_sr) : it.key;
workerInterfaces[primaryAddress] = workerInterf;
// Also add mapping from a worker's second address(if present) to its interface
if (workerInterf.reboot.getEndpoint().addresses.secondaryAddress.present()) {
Key secondAddress =
StringRef(workerInterf.reboot.getEndpoint().addresses.secondaryAddress.get().toString());
secondAddress = secondAddress.endsWith(LiteralStringRef(":tls"))
? secondAddress.removeSuffix(LiteralStringRef(":tls"))
: secondAddress;
secondAddress = secondAddress.endsWith(":tls"_sr) ? secondAddress.removeSuffix(":tls"_sr) : secondAddress;
workerInterfaces[secondAddress] = workerInterf;
}
}

View File

@ -231,28 +231,28 @@ void testSnapshotCache() {
WriteMap writes(&arena);
Standalone<VectorRef<KeyValueRef>> keys;
keys.push_back_deep(keys.arena(), KeyValueRef(LiteralStringRef("d"), LiteralStringRef("doo")));
keys.push_back_deep(keys.arena(), KeyValueRef(LiteralStringRef("e"), LiteralStringRef("eoo")));
keys.push_back_deep(keys.arena(), KeyValueRef(LiteralStringRef("e\x00"), LiteralStringRef("zoo")));
keys.push_back_deep(keys.arena(), KeyValueRef(LiteralStringRef("f"), LiteralStringRef("foo")));
cache.insert(KeyRangeRef(LiteralStringRef("d"), LiteralStringRef("f\x00")), keys);
keys.push_back_deep(keys.arena(), KeyValueRef("d"_sr, "doo"_sr));
keys.push_back_deep(keys.arena(), KeyValueRef("e"_sr, "eoo"_sr));
keys.push_back_deep(keys.arena(), KeyValueRef("e\x00"_sr, "zoo"_sr));
keys.push_back_deep(keys.arena(), KeyValueRef("f"_sr, "foo"_sr));
cache.insert(KeyRangeRef("d"_sr, "f\x00"_sr), keys);
cache.insert(KeyRangeRef(LiteralStringRef("g"), LiteralStringRef("h")), Standalone<VectorRef<KeyValueRef>>());
cache.insert(KeyRangeRef("g"_sr, "h"_sr), Standalone<VectorRef<KeyValueRef>>());
Standalone<VectorRef<KeyValueRef>> keys2;
keys2.push_back_deep(keys2.arena(), KeyValueRef(LiteralStringRef("k"), LiteralStringRef("koo")));
keys2.push_back_deep(keys2.arena(), KeyValueRef(LiteralStringRef("l"), LiteralStringRef("loo")));
cache.insert(KeyRangeRef(LiteralStringRef("j"), LiteralStringRef("m")), keys2);
keys2.push_back_deep(keys2.arena(), KeyValueRef("k"_sr, "koo"_sr));
keys2.push_back_deep(keys2.arena(), KeyValueRef("l"_sr, "loo"_sr));
cache.insert(KeyRangeRef("j"_sr, "m"_sr), keys2);
writes.mutate(LiteralStringRef("c"), MutationRef::SetValue, LiteralStringRef("c--"), true);
writes.clear(KeyRangeRef(LiteralStringRef("c\x00"), LiteralStringRef("e")), true);
writes.mutate(LiteralStringRef("c\x00"), MutationRef::SetValue, LiteralStringRef("c00--"), true);
writes.mutate("c"_sr, MutationRef::SetValue, "c--"_sr, true);
writes.clear(KeyRangeRef("c\x00"_sr, "e"_sr), true);
writes.mutate("c\x00"_sr, MutationRef::SetValue, "c00--"_sr, true);
WriteMap::iterator it3(&writes);
writes.mutate(LiteralStringRef("d"), MutationRef::SetValue, LiteralStringRef("d--"), true);
writes.mutate(LiteralStringRef("e"), MutationRef::SetValue, LiteralStringRef("e++"), true);
writes.mutate(LiteralStringRef("i"), MutationRef::SetValue, LiteralStringRef("i--"), true);
writes.mutate("d"_sr, MutationRef::SetValue, "d--"_sr, true);
writes.mutate("e"_sr, MutationRef::SetValue, "e++"_sr, true);
writes.mutate("i"_sr, MutationRef::SetValue, "i--"_sr, true);
KeyRange searchKeys = KeyRangeRef(LiteralStringRef("a"), LiteralStringRef("z"));
KeyRange searchKeys = KeyRangeRef("a"_sr, "z"_sr);
RYWIterator it(&cache, &writes);
it.skip(searchKeys.begin);
@ -425,7 +425,7 @@ TEST_CASE("/fdbclient/WriteMap/emptiness") {
Arena arena = Arena();
WriteMap writes = WriteMap(&arena);
ASSERT(writes.empty());
writes.mutate(LiteralStringRef("apple"), MutationRef::SetValue, LiteralStringRef("red"), true);
writes.mutate("apple"_sr, MutationRef::SetValue, "red"_sr, true);
ASSERT(!writes.empty());
return Void();
}
@ -457,11 +457,11 @@ TEST_CASE("/fdbclient/WriteMap/clear") {
ASSERT(writes.empty());
ASSERT(getWriteMapCount(&writes) == 1);
writes.mutate(LiteralStringRef("apple"), MutationRef::SetValue, LiteralStringRef("red"), true);
writes.mutate("apple"_sr, MutationRef::SetValue, "red"_sr, true);
ASSERT(!writes.empty());
ASSERT(getWriteMapCount(&writes) == 3);
KeyRangeRef range = KeyRangeRef(LiteralStringRef("a"), LiteralStringRef("j"));
KeyRangeRef range = KeyRangeRef("a"_sr, "j"_sr);
writes.clear(range, true);
ASSERT(getWriteMapCount(&writes) == 3);
@ -474,22 +474,19 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedKey") {
ASSERT(writes.empty());
ASSERT(getWriteMapCount(&writes) == 1);
writes.mutate(LiteralStringRef("stamp:XXXXXXXX\x06\x00\x00\x00"),
MutationRef::SetVersionstampedKey,
LiteralStringRef("1"),
true);
writes.mutate("stamp:XXXXXXXX\x06\x00\x00\x00"_sr, MutationRef::SetVersionstampedKey, "1"_sr, true);
ASSERT(!writes.empty());
ASSERT(getWriteMapCount(&writes) == 3);
writes.mutate(LiteralStringRef("stamp:ZZZZZZZZZZ"), MutationRef::AddValue, LiteralStringRef("2"), true);
writes.mutate("stamp:ZZZZZZZZZZ"_sr, MutationRef::AddValue, "2"_sr, true);
ASSERT(getWriteMapCount(&writes) == 5);
WriteMap::iterator it(&writes);
it.skip(allKeys.begin);
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp:XXXXXXXX\x06\x00\x00\x00")) == 0);
ASSERT(it.beginKey().compare(""_sr) == 0);
ASSERT(it.endKey().compare("stamp:XXXXXXXX\x06\x00\x00\x00"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -498,8 +495,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedKey") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp:XXXXXXXX\x06\x00\x00\x00")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp:XXXXXXXX\x06\x00\x00\x00\x00")) == 0);
ASSERT(it.beginKey().compare("stamp:XXXXXXXX\x06\x00\x00\x00"_sr) == 0);
ASSERT(it.endKey().compare("stamp:XXXXXXXX\x06\x00\x00\x00\x00"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(it.is_conflict_range());
ASSERT(it.is_operation());
@ -509,8 +506,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedKey") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp:XXXXXXXX\x06\x00\x00\x00\x00")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp:ZZZZZZZZZZ")) == 0);
ASSERT(it.beginKey().compare("stamp:XXXXXXXX\x06\x00\x00\x00\x00"_sr) == 0);
ASSERT(it.endKey().compare("stamp:ZZZZZZZZZZ"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -519,8 +516,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedKey") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp:ZZZZZZZZZZ")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp:ZZZZZZZZZZ\x00")) == 0);
ASSERT(it.beginKey().compare("stamp:ZZZZZZZZZZ"_sr) == 0);
ASSERT(it.endKey().compare("stamp:ZZZZZZZZZZ\x00"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(it.is_conflict_range());
ASSERT(it.is_operation());
@ -530,8 +527,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedKey") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp:ZZZZZZZZZZ\x00")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("\xff\xff")) == 0);
ASSERT(it.beginKey().compare("stamp:ZZZZZZZZZZ\x00"_sr) == 0);
ASSERT(it.endKey().compare("\xff\xff"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -550,22 +547,19 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedValue") {
ASSERT(writes.empty());
ASSERT(getWriteMapCount(&writes) == 1);
writes.mutate(LiteralStringRef("stamp"),
MutationRef::SetVersionstampedValue,
LiteralStringRef("XXXXXXXX\x00\x00\x00\x00\x00\x00"),
true);
writes.mutate("stamp"_sr, MutationRef::SetVersionstampedValue, "XXXXXXXX\x00\x00\x00\x00\x00\x00"_sr, true);
ASSERT(!writes.empty());
ASSERT(getWriteMapCount(&writes) == 3);
writes.mutate(LiteralStringRef("stamp123"), MutationRef::AddValue, LiteralStringRef("1"), true);
writes.mutate("stamp123"_sr, MutationRef::AddValue, "1"_sr, true);
ASSERT(getWriteMapCount(&writes) == 5);
WriteMap::iterator it(&writes);
it.skip(allKeys.begin);
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp")) == 0);
ASSERT(it.beginKey().compare(""_sr) == 0);
ASSERT(it.endKey().compare("stamp"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -574,8 +568,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedValue") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp\x00")) == 0);
ASSERT(it.beginKey().compare("stamp"_sr) == 0);
ASSERT(it.endKey().compare("stamp\x00"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(it.is_conflict_range());
ASSERT(it.is_operation());
@ -585,8 +579,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedValue") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp\x00")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp123")) == 0);
ASSERT(it.beginKey().compare("stamp\x00"_sr) == 0);
ASSERT(it.endKey().compare("stamp123"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -595,8 +589,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedValue") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp123")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("stamp123\x00")) == 0);
ASSERT(it.beginKey().compare("stamp123"_sr) == 0);
ASSERT(it.endKey().compare("stamp123\x00"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(it.is_conflict_range());
ASSERT(it.is_operation());
@ -606,8 +600,8 @@ TEST_CASE("/fdbclient/WriteMap/setVersionstampedValue") {
++it;
ASSERT(it.beginKey() < allKeys.end);
ASSERT(it.beginKey().compare(LiteralStringRef("stamp123\x00")) == 0);
ASSERT(it.endKey().compare(LiteralStringRef("\xff\xff")) == 0);
ASSERT(it.beginKey().compare("stamp123\x00"_sr) == 0);
ASSERT(it.endKey().compare("\xff\xff"_sr) == 0);
ASSERT(!it.is_cleared_range());
ASSERT(!it.is_conflict_range());
ASSERT(!it.is_operation());
@ -626,10 +620,10 @@ TEST_CASE("/fdbclient/WriteMap/addValue") {
ASSERT(writes.empty());
ASSERT(getWriteMapCount(&writes) == 1);
writes.mutate(LiteralStringRef("apple123"), MutationRef::SetValue, LiteralStringRef("17"), true);
writes.mutate("apple123"_sr, MutationRef::SetValue, "17"_sr, true);
ASSERT(getWriteMapCount(&writes) == 3);
writes.mutate(LiteralStringRef("apple123"), MutationRef::AddValue, LiteralStringRef("1"), true);
writes.mutate("apple123"_sr, MutationRef::AddValue, "1"_sr, true);
ASSERT(getWriteMapCount(&writes) == 3);
return Void();

View File

@ -1544,7 +1544,7 @@ Future<Optional<Value>> ReadYourWritesTransaction::get(const Key& key, Snapshot
return getDatabase()->specialKeySpace->get(this, key);
}
} else {
if (key == LiteralStringRef("\xff\xff/status/json")) {
if (key == "\xff\xff/status/json"_sr) {
if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionRecord()) {
++tr.getDatabase()->transactionStatusRequests;
return getJSON(tr.getDatabase());
@ -1553,7 +1553,7 @@ Future<Optional<Value>> ReadYourWritesTransaction::get(const Key& key, Snapshot
}
}
if (key == LiteralStringRef("\xff\xff/cluster_file_path")) {
if (key == "\xff\xff/cluster_file_path"_sr) {
try {
if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionRecord()) {
Optional<Value> output = StringRef(tr.getDatabase()->getConnectionRecord()->getLocation());
@ -1565,7 +1565,7 @@ Future<Optional<Value>> ReadYourWritesTransaction::get(const Key& key, Snapshot
return Optional<Value>();
}
if (key == LiteralStringRef("\xff\xff/connection_string")) {
if (key == "\xff\xff/connection_string"_sr) {
try {
if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionRecord()) {
Reference<IClusterConnectionRecord> f = tr.getDatabase()->getConnectionRecord();
@ -1627,7 +1627,7 @@ Future<RangeResult> ReadYourWritesTransaction::getRange(KeySelector begin,
return getDatabase()->specialKeySpace->getRange(this, begin, end, limits, reverse);
}
} else {
if (begin.getKey() == LiteralStringRef("\xff\xff/worker_interfaces")) {
if (begin.getKey() == "\xff\xff/worker_interfaces"_sr) {
if (tr.getDatabase().getPtr() && tr.getDatabase()->getConnectionRecord()) {
return getWorkerInterfaces(tr.getDatabase()->getConnectionRecord());
} else {
@ -1697,7 +1697,7 @@ Future<MappedRangeResult> ReadYourWritesTransaction::getMappedRange(KeySelector
throw client_invalid_operation(); // Not support special keys.
}
} else {
if (begin.getKey() == LiteralStringRef("\xff\xff/worker_interfaces")) {
if (begin.getKey() == "\xff\xff/worker_interfaces"_sr) {
throw client_invalid_operation(); // Not support special keys.
}
}
@ -2033,22 +2033,20 @@ RangeResult ReadYourWritesTransaction::getReadConflictRangeIntersecting(KeyRange
if (kr.begin <= iter->begin() && iter->begin() < kr.end) {
result.push_back(result.arena(),
KeyValueRef(iter->begin().withPrefix(readConflictRangeKeysRange.begin, result.arena()),
iter->value() ? LiteralStringRef("1") : LiteralStringRef("0")));
iter->value() ? "1"_sr : "0"_sr));
}
}
} else {
CoalescedKeyRefRangeMap<ValueRef> readConflicts{ LiteralStringRef("0"), specialKeys.end };
CoalescedKeyRefRangeMap<ValueRef> readConflicts{ "0"_sr, specialKeys.end };
for (const auto& range : tr.readConflictRanges())
readConflicts.insert(range.withPrefix(readConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
readConflicts.insert(range.withPrefix(readConflictRangeKeysRange.begin, result.arena()), "1"_sr);
for (const auto& range : nativeReadRanges)
readConflicts.insert(range.withPrefix(readConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
readConflicts.insert(range.withPrefix(readConflictRangeKeysRange.begin, result.arena()), "1"_sr);
for (const auto& f : tr.getExtraReadConflictRanges()) {
if (f.isReady() && f.get().first < f.get().second)
readConflicts.insert(KeyRangeRef(f.get().first, f.get().second)
.withPrefix(readConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
"1"_sr);
}
auto beginIter = readConflicts.rangeContaining(kr.begin);
if (beginIter->begin() != kr.begin)
@ -2066,7 +2064,7 @@ RangeResult ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRang
RangeResult result;
// Memory owned by result
CoalescedKeyRefRangeMap<ValueRef> writeConflicts{ LiteralStringRef("0"), specialKeys.end };
CoalescedKeyRefRangeMap<ValueRef> writeConflicts{ "0"_sr, specialKeys.end };
if (!options.readYourWritesDisabled) {
KeyRangeRef strippedWriteRangePrefix = kr.removePrefix(writeConflictRangeKeysRange.begin);
@ -2079,15 +2077,13 @@ RangeResult ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRang
writeConflicts.insert(
KeyRangeRef(it.beginKey().toArena(result.arena()), it.endKey().toArena(result.arena()))
.withPrefix(writeConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
"1"_sr);
}
} else {
for (const auto& range : tr.writeConflictRanges())
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()), "1"_sr);
for (const auto& range : nativeWriteRanges)
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()), "1"_sr);
}
for (const auto& k : versionStampKeys) {
@ -2107,8 +2103,7 @@ RangeResult ReadYourWritesTransaction::getWriteConflictRangeIntersecting(KeyRang
} else {
range = getVersionstampKeyRange(result.arena(), k, tr.getCachedReadVersion().orDefault(0), getMaxReadKey());
}
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()),
LiteralStringRef("1"));
writeConflicts.insert(range.withPrefix(writeConflictRangeKeysRange.begin, result.arena()), "1"_sr);
}
auto beginIter = writeConflicts.rangeContaining(kr.begin);
@ -2154,13 +2149,13 @@ void ReadYourWritesTransaction::atomicOp(const KeyRef& key, const ValueRef& oper
KeyRef k;
if (!tr.apiVersionAtLeast(520) && operationType == MutationRef::SetVersionstampedKey) {
k = key.withSuffix(LiteralStringRef("\x00\x00"), arena);
k = key.withSuffix("\x00\x00"_sr, arena);
} else {
k = KeyRef(arena, key);
}
ValueRef v;
if (!tr.apiVersionAtLeast(520) && operationType == MutationRef::SetVersionstampedValue) {
v = operand.withSuffix(LiteralStringRef("\x00\x00\x00\x00"), arena);
v = operand.withSuffix("\x00\x00\x00\x00"_sr, arena);
} else {
v = ValueRef(arena, operand);
}
@ -2212,17 +2207,17 @@ void ReadYourWritesTransaction::set(const KeyRef& key, const ValueRef& value) {
} else {
// These three special keys are deprecated in 7.0 and an alternative C API is added
// TODO : Rewrite related code using C api
if (key == LiteralStringRef("\xff\xff/reboot_worker")) {
if (key == "\xff\xff/reboot_worker"_sr) {
BinaryReader::fromStringRef<ClientWorkerInterface>(value, IncludeVersion())
.reboot.send(RebootRequest());
return;
}
if (key == LiteralStringRef("\xff\xff/suspend_worker")) {
if (key == "\xff\xff/suspend_worker"_sr) {
BinaryReader::fromStringRef<ClientWorkerInterface>(value, IncludeVersion())
.reboot.send(RebootRequest(false, false, options.timeoutInSeconds));
return;
}
if (key == LiteralStringRef("\xff\xff/reboot_and_check_worker")) {
if (key == "\xff\xff/reboot_and_check_worker"_sr) {
BinaryReader::fromStringRef<ClientWorkerInterface>(value, IncludeVersion())
.reboot.send(RebootRequest(false, true));
return;

View File

@ -109,7 +109,7 @@ bool S3BlobStoreEndpoint::BlobKnobs::set(StringRef name, int value) {
TRY_PARAM(request_tries, rt);
TRY_PARAM(request_timeout_min, rtom);
// TODO: For backward compatibility because request_timeout was renamed to request_timeout_min
if (name == LiteralStringRef("request_timeout") || name == LiteralStringRef("rto")) {
if (name == "request_timeout"_sr || name == "rto"_sr) {
request_timeout_min = value;
return true;
}
@ -187,7 +187,7 @@ std::string guessRegionFromDomain(std::string domain) {
StringRef h(domain.c_str() + p);
if (!h.startsWith(LiteralStringRef("oss-"))) {
if (!h.startsWith("oss-"_sr)) {
h.eat(service); // ignore s3 service
}
@ -208,7 +208,7 @@ Reference<S3BlobStoreEndpoint> S3BlobStoreEndpoint::fromString(const std::string
try {
StringRef t(url);
StringRef prefix = t.eat("://");
if (prefix != LiteralStringRef("blobstore"))
if (prefix != "blobstore"_sr)
throw format("Invalid blobstore URL prefix '%s'", prefix.toString().c_str());
Optional<std::string> proxyHost, proxyPort;
@ -261,7 +261,7 @@ Reference<S3BlobStoreEndpoint> S3BlobStoreEndpoint::fromString(const std::string
StringRef value = t.eat("&");
// Special case for header
if (name == LiteralStringRef("header")) {
if (name == "header"_sr) {
StringRef originalValue = value;
StringRef headerFieldName = value.eat(":");
StringRef headerFieldValue = value;
@ -282,7 +282,7 @@ Reference<S3BlobStoreEndpoint> S3BlobStoreEndpoint::fromString(const std::string
}
// overwrite s3 region from parameter
if (name == LiteralStringRef("region")) {
if (name == "region"_sr) {
region = value.toString();
continue;
}
@ -1428,7 +1428,7 @@ void S3BlobStoreEndpoint::setV4AuthHeaders(std::string const& verb,
if (headers.find("Content-MD5") != headers.end())
headersList.push_back({ "content-md5", trim_copy(headers["Content-MD5"]) + "\n" });
for (auto h : headers) {
if (StringRef(h.first).startsWith(LiteralStringRef("x-amz")))
if (StringRef(h.first).startsWith("x-amz"_sr))
headersList.push_back({ to_lower_copy(h.first), trim_copy(h.second) + "\n" });
}
std::sort(headersList.begin(), headersList.end());
@ -1489,7 +1489,7 @@ void S3BlobStoreEndpoint::setAuthHeaders(std::string const& verb, std::string co
msg.append("\n");
for (auto h : headers) {
StringRef name = h.first;
if (name.startsWith(LiteralStringRef("x-amz")) || name.startsWith(LiteralStringRef("x-icloud"))) {
if (name.startsWith("x-amz"_sr) || name.startsWith("x-icloud"_sr)) {
msg.append(h.first);
msg.append(":");
msg.append(h.second);

View File

@ -56,65 +56,46 @@ static bool isAlphaNumeric(const std::string& key) {
} // namespace
std::unordered_map<SpecialKeySpace::MODULE, KeyRange> SpecialKeySpace::moduleToBoundary = {
{ SpecialKeySpace::MODULE::TRANSACTION,
KeyRangeRef(LiteralStringRef("\xff\xff/transaction/"), LiteralStringRef("\xff\xff/transaction0")) },
{ SpecialKeySpace::MODULE::TRANSACTION, KeyRangeRef("\xff\xff/transaction/"_sr, "\xff\xff/transaction0"_sr) },
{ SpecialKeySpace::MODULE::WORKERINTERFACE,
KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces/"), LiteralStringRef("\xff\xff/worker_interfaces0")) },
{ SpecialKeySpace::MODULE::STATUSJSON, singleKeyRange(LiteralStringRef("\xff\xff/status/json")) },
{ SpecialKeySpace::MODULE::CONNECTIONSTRING, singleKeyRange(LiteralStringRef("\xff\xff/connection_string")) },
{ SpecialKeySpace::MODULE::CLUSTERFILEPATH, singleKeyRange(LiteralStringRef("\xff\xff/cluster_file_path")) },
{ SpecialKeySpace::MODULE::METRICS,
KeyRangeRef(LiteralStringRef("\xff\xff/metrics/"), LiteralStringRef("\xff\xff/metrics0")) },
{ SpecialKeySpace::MODULE::MANAGEMENT,
KeyRangeRef(LiteralStringRef("\xff\xff/management/"), LiteralStringRef("\xff\xff/management0")) },
{ SpecialKeySpace::MODULE::ERRORMSG, singleKeyRange(LiteralStringRef("\xff\xff/error_message")) },
{ SpecialKeySpace::MODULE::CONFIGURATION,
KeyRangeRef(LiteralStringRef("\xff\xff/configuration/"), LiteralStringRef("\xff\xff/configuration0")) },
{ SpecialKeySpace::MODULE::GLOBALCONFIG,
KeyRangeRef(LiteralStringRef("\xff\xff/global_config/"), LiteralStringRef("\xff\xff/global_config0")) },
{ SpecialKeySpace::MODULE::TRACING,
KeyRangeRef(LiteralStringRef("\xff\xff/tracing/"), LiteralStringRef("\xff\xff/tracing0")) },
{ SpecialKeySpace::MODULE::ACTORLINEAGE,
KeyRangeRef(LiteralStringRef("\xff\xff/actor_lineage/"), LiteralStringRef("\xff\xff/actor_lineage0")) },
KeyRangeRef("\xff\xff/worker_interfaces/"_sr, "\xff\xff/worker_interfaces0"_sr) },
{ SpecialKeySpace::MODULE::STATUSJSON, singleKeyRange("\xff\xff/status/json"_sr) },
{ SpecialKeySpace::MODULE::CONNECTIONSTRING, singleKeyRange("\xff\xff/connection_string"_sr) },
{ SpecialKeySpace::MODULE::CLUSTERFILEPATH, singleKeyRange("\xff\xff/cluster_file_path"_sr) },
{ SpecialKeySpace::MODULE::METRICS, KeyRangeRef("\xff\xff/metrics/"_sr, "\xff\xff/metrics0"_sr) },
{ SpecialKeySpace::MODULE::MANAGEMENT, KeyRangeRef("\xff\xff/management/"_sr, "\xff\xff/management0"_sr) },
{ SpecialKeySpace::MODULE::ERRORMSG, singleKeyRange("\xff\xff/error_message"_sr) },
{ SpecialKeySpace::MODULE::CONFIGURATION, KeyRangeRef("\xff\xff/configuration/"_sr, "\xff\xff/configuration0"_sr) },
{ SpecialKeySpace::MODULE::GLOBALCONFIG, KeyRangeRef("\xff\xff/global_config/"_sr, "\xff\xff/global_config0"_sr) },
{ SpecialKeySpace::MODULE::TRACING, KeyRangeRef("\xff\xff/tracing/"_sr, "\xff\xff/tracing0"_sr) },
{ SpecialKeySpace::MODULE::ACTORLINEAGE, KeyRangeRef("\xff\xff/actor_lineage/"_sr, "\xff\xff/actor_lineage0"_sr) },
{ SpecialKeySpace::MODULE::ACTOR_PROFILER_CONF,
KeyRangeRef(LiteralStringRef("\xff\xff/actor_profiler_conf/"),
LiteralStringRef("\xff\xff/actor_profiler_conf0")) },
{ SpecialKeySpace::MODULE::CLUSTERID, singleKeyRange(LiteralStringRef("\xff\xff/cluster_id")) },
KeyRangeRef("\xff\xff/actor_profiler_conf/"_sr, "\xff\xff/actor_profiler_conf0"_sr) },
{ SpecialKeySpace::MODULE::CLUSTERID, singleKeyRange("\xff\xff/cluster_id"_sr) },
};
std::unordered_map<std::string, KeyRange> SpecialKeySpace::managementApiCommandToRange = {
{ "exclude",
KeyRangeRef(LiteralStringRef("excluded/"), LiteralStringRef("excluded0"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "failed",
KeyRangeRef(LiteralStringRef("failed/"), LiteralStringRef("failed0"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "exclude", KeyRangeRef("excluded/"_sr, "excluded0"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "failed", KeyRangeRef("failed/"_sr, "failed0"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "excludedlocality",
KeyRangeRef(LiteralStringRef("excluded_locality/"), LiteralStringRef("excluded_locality0"))
KeyRangeRef("excluded_locality/"_sr, "excluded_locality0"_sr)
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "failedlocality",
KeyRangeRef(LiteralStringRef("failed_locality/"), LiteralStringRef("failed_locality0"))
KeyRangeRef("failed_locality/"_sr, "failed_locality0"_sr)
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "lock", singleKeyRange(LiteralStringRef("db_locked")).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "lock", singleKeyRange("db_locked"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "consistencycheck",
singleKeyRange(LiteralStringRef("consistency_check_suspended"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
singleKeyRange("consistency_check_suspended"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "coordinators",
KeyRangeRef(LiteralStringRef("coordinators/"), LiteralStringRef("coordinators0"))
.withPrefix(moduleToBoundary[MODULE::CONFIGURATION].begin) },
KeyRangeRef("coordinators/"_sr, "coordinators0"_sr).withPrefix(moduleToBoundary[MODULE::CONFIGURATION].begin) },
{ "advanceversion",
singleKeyRange(LiteralStringRef("min_required_commit_version"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "versionepoch",
singleKeyRange(LiteralStringRef("version_epoch")).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "profile",
KeyRangeRef(LiteralStringRef("profiling/"), LiteralStringRef("profiling0"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
singleKeyRange("min_required_commit_version"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "versionepoch", singleKeyRange("version_epoch"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "profile", KeyRangeRef("profiling/"_sr, "profiling0"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "maintenance",
KeyRangeRef(LiteralStringRef("maintenance/"), LiteralStringRef("maintenance0"))
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
KeyRangeRef("maintenance/"_sr, "maintenance0"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "datadistribution",
KeyRangeRef(LiteralStringRef("data_distribution/"), LiteralStringRef("data_distribution0"))
KeyRangeRef("data_distribution/"_sr, "data_distribution0"_sr)
.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "tenant", KeyRangeRef("tenant/"_sr, "tenant0"_sr).withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin) },
{ "tenantmap",
@ -122,12 +103,8 @@ std::unordered_map<std::string, KeyRange> SpecialKeySpace::managementApiCommandT
};
std::unordered_map<std::string, KeyRange> SpecialKeySpace::actorLineageApiCommandToRange = {
{ "state",
KeyRangeRef(LiteralStringRef("state/"), LiteralStringRef("state0"))
.withPrefix(moduleToBoundary[MODULE::ACTORLINEAGE].begin) },
{ "time",
KeyRangeRef(LiteralStringRef("time/"), LiteralStringRef("time0"))
.withPrefix(moduleToBoundary[MODULE::ACTORLINEAGE].begin) }
{ "state", KeyRangeRef("state/"_sr, "state0"_sr).withPrefix(moduleToBoundary[MODULE::ACTORLINEAGE].begin) },
{ "time", KeyRangeRef("time/"_sr, "time0"_sr).withPrefix(moduleToBoundary[MODULE::ACTORLINEAGE].begin) }
};
std::set<std::string> SpecialKeySpace::options = { "excluded/force",
@ -567,8 +544,8 @@ bool validateSnakeCaseNaming(const KeyRef& k) {
// Suffix can be \xff\xff or \x00 in single key range
if (key.endsWith(specialKeys.begin))
key = key.removeSuffix(specialKeys.end);
else if (key.endsWith(LiteralStringRef("\x00")))
key = key.removeSuffix(LiteralStringRef("\x00"));
else if (key.endsWith("\x00"_sr))
key = key.removeSuffix("\x00"_sr);
for (const char& c : key.toString()) {
// only small letters, numbers, '/', '_' is allowed
ASSERT((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '/' || c == '_');
@ -788,7 +765,7 @@ Future<RangeResult> DDStatsRangeImpl::getRange(ReadYourWritesTransaction* ryw,
}
Key SpecialKeySpace::getManagementApiCommandOptionSpecialKey(const std::string& command, const std::string& option) {
Key prefix = LiteralStringRef("options/").withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin);
Key prefix = "options/"_sr.withPrefix(moduleToBoundary[MODULE::MANAGEMENT].begin);
auto pair = command + "/" + option;
ASSERT(options.find(pair) != options.end());
return prefix.withSuffix(pair);
@ -919,11 +896,11 @@ void ExcludeServersRangeImpl::set(ReadYourWritesTransaction* ryw, const KeyRef&
Key ExcludeServersRangeImpl::decode(const KeyRef& key) const {
return key.removePrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)
.withPrefix(LiteralStringRef("\xff/conf/"));
.withPrefix("\xff/conf/"_sr);
}
Key ExcludeServersRangeImpl::encode(const KeyRef& key) const {
return key.removePrefix(LiteralStringRef("\xff/conf/"))
return key.removePrefix("\xff/conf/"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin);
}
@ -1162,11 +1139,11 @@ void FailedServersRangeImpl::set(ReadYourWritesTransaction* ryw, const KeyRef& k
Key FailedServersRangeImpl::decode(const KeyRef& key) const {
return key.removePrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)
.withPrefix(LiteralStringRef("\xff/conf/"));
.withPrefix("\xff/conf/"_sr);
}
Key FailedServersRangeImpl::encode(const KeyRef& key) const {
return key.removePrefix(LiteralStringRef("\xff/conf/"))
return key.removePrefix("\xff/conf/"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin);
}
@ -1328,8 +1305,7 @@ Future<Optional<std::string>> ProcessClassRangeImpl::commit(ReadYourWritesTransa
// validate class type
ValueRef processClassType = entry.second.get();
ProcessClass processClass(processClassType.toString(), ProcessClass::DBSource);
if (processClass.classType() == ProcessClass::InvalidClass &&
processClassType != LiteralStringRef("default")) {
if (processClass.classType() == ProcessClass::InvalidClass && processClassType != "default"_sr) {
std::string error = "ERROR: \'" + processClassType.toString() + "\' is not a valid process class\n";
errorMsg = ManagementAPIError::toJsonString(false, "setclass", error);
return errorMsg;
@ -1429,11 +1405,10 @@ ACTOR Future<Optional<std::string>> lockDatabaseCommitActor(ReadYourWritesTransa
throw database_locked();
} else if (!val.present()) {
// lock database
ryw->getTransaction().atomicOp(databaseLockedKey,
BinaryWriter::toValue(uid, Unversioned())
.withPrefix(LiteralStringRef("0123456789"))
.withSuffix(LiteralStringRef("\x00\x00\x00\x00")),
MutationRef::SetVersionstampedValue);
ryw->getTransaction().atomicOp(
databaseLockedKey,
BinaryWriter::toValue(uid, Unversioned()).withPrefix("0123456789"_sr).withSuffix("\x00\x00\x00\x00"_sr),
MutationRef::SetVersionstampedValue);
ryw->getTransaction().addWriteConflictRange(normalKeys);
}
@ -1687,7 +1662,7 @@ ACTOR Future<RangeResult> coordinatorsGetRangeActor(ReadYourWritesTransaction* r
state ClusterConnectionString cs = ryw->getDatabase()->getConnectionRecord()->getConnectionString();
state std::vector<NetworkAddress> coordinator_processes = wait(cs.tryResolveHostnames());
RangeResult result;
Key cluster_decription_key = prefix.withSuffix(LiteralStringRef("cluster_description"));
Key cluster_decription_key = prefix.withSuffix("cluster_description"_sr);
if (kr.contains(cluster_decription_key)) {
result.push_back_deep(result.arena(), KeyValueRef(cluster_decription_key, cs.clusterKeyName()));
}
@ -1702,7 +1677,7 @@ ACTOR Future<RangeResult> coordinatorsGetRangeActor(ReadYourWritesTransaction* r
processes_str += ",";
processes_str += w.toString();
}
Key processes_key = prefix.withSuffix(LiteralStringRef("processes"));
Key processes_key = prefix.withSuffix("processes"_sr);
if (kr.contains(processes_key)) {
result.push_back_deep(result.arena(), KeyValueRef(processes_key, Value(processes_str)));
}
@ -1724,7 +1699,7 @@ ACTOR static Future<Optional<std::string>> coordinatorsCommitActor(ReadYourWrite
state bool parse_error = false;
// check update for coordinators
Key processes_key = LiteralStringRef("processes").withPrefix(kr.begin);
Key processes_key = "processes"_sr.withPrefix(kr.begin);
auto processes_entry = ryw->getSpecialKeySpaceWriteMap()[processes_key];
if (processes_entry.first) {
ASSERT(processes_entry.second.present()); // no clear should be seen here
@ -1764,7 +1739,7 @@ ACTOR static Future<Optional<std::string>> coordinatorsCommitActor(ReadYourWrite
std::string newName;
// check update for cluster_description
Key cluster_decription_key = LiteralStringRef("cluster_description").withPrefix(kr.begin);
Key cluster_decription_key = "cluster_description"_sr.withPrefix(kr.begin);
auto entry = ryw->getSpecialKeySpaceWriteMap()[cluster_decription_key];
if (entry.first) {
// check valid description [a-zA-Z0-9_]+
@ -1778,7 +1753,7 @@ ACTOR static Future<Optional<std::string>> coordinatorsCommitActor(ReadYourWrite
}
}
auto configDBEntry = ryw->getSpecialKeySpaceWriteMap()[LiteralStringRef("config_db").withPrefix(kr.begin)];
auto configDBEntry = ryw->getSpecialKeySpaceWriteMap()["config_db"_sr.withPrefix(kr.begin)];
TraceEvent(SevDebug, "SKSChangeCoordinatorsStart")
.detail("NewConnectionString", conn.toString())
@ -2009,7 +1984,7 @@ Future<RangeResult> ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw
KeyRef prefix = getKeyRange().begin;
RangeResult result = RangeResult();
// client_txn_sample_rate
Key sampleRateKey = LiteralStringRef("client_txn_sample_rate").withPrefix(prefix);
Key sampleRateKey = "client_txn_sample_rate"_sr.withPrefix(prefix);
ryw->getTransaction().setOption(FDBTransactionOptions::RAW_ACCESS);
@ -2030,7 +2005,7 @@ Future<RangeResult> ClientProfilingImpl::getRange(ReadYourWritesTransaction* ryw
}
}
// client_txn_size_limit
Key txnSizeLimitKey = LiteralStringRef("client_txn_size_limit").withPrefix(prefix);
Key txnSizeLimitKey = "client_txn_size_limit"_sr.withPrefix(prefix);
if (kr.contains(txnSizeLimitKey)) {
auto entry = ryw->getSpecialKeySpaceWriteMap()[txnSizeLimitKey];
if (!ryw->readYourWritesDisabled() && entry.first) {
@ -2056,7 +2031,7 @@ Future<Optional<std::string>> ClientProfilingImpl::commit(ReadYourWritesTransact
Standalone<VectorRef<KeyRangeRef>> clears;
// client_txn_sample_rate
Key sampleRateKey = LiteralStringRef("client_txn_sample_rate").withPrefix(getKeyRange().begin);
Key sampleRateKey = "client_txn_sample_rate"_sr.withPrefix(getKeyRange().begin);
auto rateEntry = ryw->getSpecialKeySpaceWriteMap()[sampleRateKey];
if (rateEntry.first && rateEntry.second.present()) {
@ -2076,7 +2051,7 @@ Future<Optional<std::string>> ClientProfilingImpl::commit(ReadYourWritesTransact
}
}
// client_txn_size_limit
Key txnSizeLimitKey = LiteralStringRef("client_txn_size_limit").withPrefix(getKeyRange().begin);
Key txnSizeLimitKey = "client_txn_size_limit"_sr.withPrefix(getKeyRange().begin);
auto sizeLimitEntry = ryw->getSpecialKeySpaceWriteMap()[txnSizeLimitKey];
if (sizeLimitEntry.first && sizeLimitEntry.second.present()) {
std::string sizeLimitStr = sizeLimitEntry.second.get().toString();
@ -2121,11 +2096,11 @@ void parse(StringRef& val, double& d) {
}
void parse(StringRef& val, WaitState& w) {
if (val == LiteralStringRef("disk") || val == LiteralStringRef("Disk")) {
if (val == "disk"_sr || val == "Disk"_sr) {
w = WaitState::Disk;
} else if (val == LiteralStringRef("network") || val == LiteralStringRef("Network")) {
} else if (val == "network"_sr || val == "Network"_sr) {
w = WaitState::Network;
} else if (val == LiteralStringRef("running") || val == LiteralStringRef("Running")) {
} else if (val == "running"_sr || val == "Running"_sr) {
w = WaitState::Running;
} else {
throw std::range_error("failed to parse run state");
@ -2525,7 +2500,7 @@ ACTOR static Future<RangeResult> DataDistributionGetRangeActor(ReadYourWritesTra
KeyRangeRef kr) {
state RangeResult result;
// dataDistributionModeKey
state Key modeKey = LiteralStringRef("mode").withPrefix(prefix);
state Key modeKey = "mode"_sr.withPrefix(prefix);
ryw->getTransaction().setOption(FDBTransactionOptions::RAW_ACCESS);
@ -2541,7 +2516,7 @@ ACTOR static Future<RangeResult> DataDistributionGetRangeActor(ReadYourWritesTra
}
}
// rebalanceDDIgnoreKey
state Key rebalanceIgnoredKey = LiteralStringRef("rebalance_ignored").withPrefix(prefix);
state Key rebalanceIgnoredKey = "rebalance_ignored"_sr.withPrefix(prefix);
if (kr.contains(rebalanceIgnoredKey)) {
auto entry = ryw->getSpecialKeySpaceWriteMap()[rebalanceIgnoredKey];
if (ryw->readYourWritesDisabled() || !entry.first) {
@ -2568,8 +2543,8 @@ Future<Optional<std::string>> DataDistributionImpl::commit(ReadYourWritesTransac
Optional<std::string> msg;
KeyRangeRef kr = getKeyRange();
Key modeKey = LiteralStringRef("mode").withPrefix(kr.begin);
Key rebalanceIgnoredKey = LiteralStringRef("rebalance_ignored").withPrefix(kr.begin);
Key modeKey = "mode"_sr.withPrefix(kr.begin);
Key rebalanceIgnoredKey = "rebalance_ignored"_sr.withPrefix(kr.begin);
auto ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(kr);
for (auto iter = ranges.begin(); iter != ranges.end(); ++iter) {
if (!iter->value().first)
@ -2756,11 +2731,11 @@ void ExcludedLocalitiesRangeImpl::set(ReadYourWritesTransaction* ryw, const KeyR
Key ExcludedLocalitiesRangeImpl::decode(const KeyRef& key) const {
return key.removePrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)
.withPrefix(LiteralStringRef("\xff/conf/"));
.withPrefix("\xff/conf/"_sr);
}
Key ExcludedLocalitiesRangeImpl::encode(const KeyRef& key) const {
return key.removePrefix(LiteralStringRef("\xff/conf/"))
return key.removePrefix("\xff/conf/"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin);
}
@ -2785,11 +2760,11 @@ void FailedLocalitiesRangeImpl::set(ReadYourWritesTransaction* ryw, const KeyRef
Key FailedLocalitiesRangeImpl::decode(const KeyRef& key) const {
return key.removePrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin)
.withPrefix(LiteralStringRef("\xff/conf/"));
.withPrefix("\xff/conf/"_sr);
}
Key FailedLocalitiesRangeImpl::encode(const KeyRef& key) const {
return key.removePrefix(LiteralStringRef("\xff/conf/"))
return key.removePrefix("\xff/conf/"_sr)
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::MANAGEMENT).begin);
}

View File

@ -31,20 +31,20 @@
FDB_DEFINE_BOOLEAN_PARAM(AssignEmptyRange);
FDB_DEFINE_BOOLEAN_PARAM(UnassignShard);
const KeyRef systemKeysPrefix = LiteralStringRef("\xff");
const KeyRef systemKeysPrefix = "\xff"_sr;
const KeyRangeRef normalKeys(KeyRef(), systemKeysPrefix);
const KeyRangeRef systemKeys(systemKeysPrefix, LiteralStringRef("\xff\xff"));
const KeyRangeRef nonMetadataSystemKeys(LiteralStringRef("\xff\x02"), LiteralStringRef("\xff\x03"));
const KeyRangeRef systemKeys(systemKeysPrefix, "\xff\xff"_sr);
const KeyRangeRef nonMetadataSystemKeys("\xff\x02"_sr, "\xff\x03"_sr);
const KeyRangeRef allKeys = KeyRangeRef(normalKeys.begin, systemKeys.end);
const KeyRef afterAllKeys = LiteralStringRef("\xff\xff\x00");
const KeyRangeRef specialKeys = KeyRangeRef(LiteralStringRef("\xff\xff"), LiteralStringRef("\xff\xff\xff"));
const KeyRef afterAllKeys = "\xff\xff\x00"_sr;
const KeyRangeRef specialKeys = KeyRangeRef("\xff\xff"_sr, "\xff\xff\xff"_sr);
// keyServersKeys.contains(k) iff k.startsWith(keyServersPrefix)
const KeyRangeRef keyServersKeys(LiteralStringRef("\xff/keyServers/"), LiteralStringRef("\xff/keyServers0"));
const KeyRangeRef keyServersKeys("\xff/keyServers/"_sr, "\xff/keyServers0"_sr);
const KeyRef keyServersPrefix = keyServersKeys.begin;
const KeyRef keyServersEnd = keyServersKeys.end;
const KeyRangeRef keyServersKeyServersKeys(LiteralStringRef("\xff/keyServers/\xff/keyServers/"),
LiteralStringRef("\xff/keyServers/\xff/keyServers0"));
const KeyRangeRef keyServersKeyServersKeys("\xff/keyServers/\xff/keyServers/"_sr,
"\xff/keyServers/\xff/keyServers0"_sr);
const KeyRef keyServersKeyServersKey = keyServersKeyServersKeys.begin;
// These constants are selected to be easily recognized during debugging.
@ -274,20 +274,17 @@ void decodeKeyServersValue(std::map<Tag, UID> const& tag_uid,
}
const KeyRangeRef conflictingKeysRange =
KeyRangeRef(LiteralStringRef("\xff\xff/transaction/conflicting_keys/"),
LiteralStringRef("\xff\xff/transaction/conflicting_keys/\xff\xff"));
const ValueRef conflictingKeysTrue = LiteralStringRef("1");
const ValueRef conflictingKeysFalse = LiteralStringRef("0");
KeyRangeRef("\xff\xff/transaction/conflicting_keys/"_sr, "\xff\xff/transaction/conflicting_keys/\xff\xff"_sr);
const ValueRef conflictingKeysTrue = "1"_sr;
const ValueRef conflictingKeysFalse = "0"_sr;
const KeyRangeRef readConflictRangeKeysRange =
KeyRangeRef(LiteralStringRef("\xff\xff/transaction/read_conflict_range/"),
LiteralStringRef("\xff\xff/transaction/read_conflict_range/\xff\xff"));
KeyRangeRef("\xff\xff/transaction/read_conflict_range/"_sr, "\xff\xff/transaction/read_conflict_range/\xff\xff"_sr);
const KeyRangeRef writeConflictRangeKeysRange =
KeyRangeRef(LiteralStringRef("\xff\xff/transaction/write_conflict_range/"),
LiteralStringRef("\xff\xff/transaction/write_conflict_range/\xff\xff"));
const KeyRangeRef writeConflictRangeKeysRange = KeyRangeRef("\xff\xff/transaction/write_conflict_range/"_sr,
"\xff\xff/transaction/write_conflict_range/\xff\xff"_sr);
const KeyRef clusterIdKey = LiteralStringRef("\xff/clusterId");
const KeyRef clusterIdKey = "\xff/clusterId"_sr;
const KeyRef checkpointPrefix = "\xff/checkpoint/"_sr;
@ -344,7 +341,7 @@ DataMoveMetaData decodeDataMoveValue(const ValueRef& value) {
}
// "\xff/cacheServer/[[UID]] := StorageServerInterface"
const KeyRangeRef storageCacheServerKeys(LiteralStringRef("\xff/cacheServer/"), LiteralStringRef("\xff/cacheServer0"));
const KeyRangeRef storageCacheServerKeys("\xff/cacheServer/"_sr, "\xff/cacheServer0"_sr);
const KeyRef storageCacheServersPrefix = storageCacheServerKeys.begin;
const KeyRef storageCacheServersEnd = storageCacheServerKeys.end;
@ -361,11 +358,11 @@ const Value storageCacheServerValue(const StorageServerInterface& ssi) {
return ObjectWriter::toValue(ssi, IncludeVersion(protocolVersion));
}
const KeyRangeRef ddStatsRange = KeyRangeRef(LiteralStringRef("\xff\xff/metrics/data_distribution_stats/"),
LiteralStringRef("\xff\xff/metrics/data_distribution_stats/\xff\xff"));
const KeyRangeRef ddStatsRange =
KeyRangeRef("\xff\xff/metrics/data_distribution_stats/"_sr, "\xff\xff/metrics/data_distribution_stats/\xff\xff"_sr);
// "\xff/storageCache/[[begin]]" := "[[vector<uint16_t>]]"
const KeyRangeRef storageCacheKeys(LiteralStringRef("\xff/storageCache/"), LiteralStringRef("\xff/storageCache0"));
const KeyRangeRef storageCacheKeys("\xff/storageCache/"_sr, "\xff/storageCache0"_sr);
const KeyRef storageCachePrefix = storageCacheKeys.begin;
const Key storageCacheKey(const KeyRef& k) {
@ -427,7 +424,7 @@ const Key serverKeysKey(UID serverID, const KeyRef& key) {
BinaryWriter wr(Unversioned());
wr.serializeBytes(serverKeysPrefix);
wr << serverID;
wr.serializeBytes(LiteralStringRef("/"));
wr.serializeBytes("/"_sr);
wr.serializeBytes(key);
return wr.toValue();
}
@ -435,7 +432,7 @@ const Key serverKeysPrefixFor(UID serverID) {
BinaryWriter wr(Unversioned());
wr.serializeBytes(serverKeysPrefix);
wr << serverID;
wr.serializeBytes(LiteralStringRef("/"));
wr.serializeBytes("/"_sr);
return wr.toValue();
}
UID serverKeysDecodeServer(const KeyRef& key) {
@ -499,13 +496,13 @@ void decodeServerKeysValue(const ValueRef& value, bool& assigned, bool& emptyRan
}
}
const KeyRef cacheKeysPrefix = LiteralStringRef("\xff\x02/cacheKeys/");
const KeyRef cacheKeysPrefix = "\xff\x02/cacheKeys/"_sr;
const Key cacheKeysKey(uint16_t idx, const KeyRef& key) {
BinaryWriter wr(Unversioned());
wr.serializeBytes(cacheKeysPrefix);
wr << idx;
wr.serializeBytes(LiteralStringRef("/"));
wr.serializeBytes("/"_sr);
wr.serializeBytes(key);
return wr.toValue();
}
@ -513,7 +510,7 @@ const Key cacheKeysPrefixFor(uint16_t idx) {
BinaryWriter wr(Unversioned());
wr.serializeBytes(cacheKeysPrefix);
wr << idx;
wr.serializeBytes(LiteralStringRef("/"));
wr.serializeBytes("/"_sr);
return wr.toValue();
}
uint16_t cacheKeysDecodeIndex(const KeyRef& key) {
@ -526,9 +523,8 @@ KeyRef cacheKeysDecodeKey(const KeyRef& key) {
return key.substr(cacheKeysPrefix.size() + sizeof(uint16_t) + 1);
}
const KeyRef cacheChangeKey = LiteralStringRef("\xff\x02/cacheChangeKey");
const KeyRangeRef cacheChangeKeys(LiteralStringRef("\xff\x02/cacheChangeKeys/"),
LiteralStringRef("\xff\x02/cacheChangeKeys0"));
const KeyRef cacheChangeKey = "\xff\x02/cacheChangeKey"_sr;
const KeyRangeRef cacheChangeKeys("\xff\x02/cacheChangeKeys/"_sr, "\xff\x02/cacheChangeKeys0"_sr);
const KeyRef cacheChangePrefix = cacheChangeKeys.begin;
const Key cacheChangeKeyFor(uint16_t idx) {
BinaryWriter wr(Unversioned());
@ -543,9 +539,9 @@ uint16_t cacheChangeKeyDecodeIndex(const KeyRef& key) {
return idx;
}
const KeyRangeRef tssMappingKeys(LiteralStringRef("\xff/tss/"), LiteralStringRef("\xff/tss0"));
const KeyRangeRef tssMappingKeys("\xff/tss/"_sr, "\xff/tss0"_sr);
const KeyRangeRef tssQuarantineKeys(LiteralStringRef("\xff/tssQ/"), LiteralStringRef("\xff/tssQ0"));
const KeyRangeRef tssQuarantineKeys("\xff/tssQ/"_sr, "\xff/tssQ0"_sr);
const Key tssQuarantineKeyFor(UID serverID) {
BinaryWriter wr(Unversioned());
@ -561,22 +557,19 @@ UID decodeTssQuarantineKey(KeyRef const& key) {
return serverID;
}
const KeyRangeRef tssMismatchKeys(LiteralStringRef("\xff/tssMismatch/"), LiteralStringRef("\xff/tssMismatch0"));
const KeyRangeRef tssMismatchKeys("\xff/tssMismatch/"_sr, "\xff/tssMismatch0"_sr);
const KeyRangeRef serverMetadataKeys(LiteralStringRef("\xff/serverMetadata/"),
LiteralStringRef("\xff/serverMetadata0"));
const KeyRangeRef serverMetadataKeys("\xff/serverMetadata/"_sr, "\xff/serverMetadata0"_sr);
const KeyRangeRef serverTagKeys(LiteralStringRef("\xff/serverTag/"), LiteralStringRef("\xff/serverTag0"));
const KeyRangeRef serverTagKeys("\xff/serverTag/"_sr, "\xff/serverTag0"_sr);
const KeyRef serverTagPrefix = serverTagKeys.begin;
const KeyRangeRef serverTagConflictKeys(LiteralStringRef("\xff/serverTagConflict/"),
LiteralStringRef("\xff/serverTagConflict0"));
const KeyRangeRef serverTagConflictKeys("\xff/serverTagConflict/"_sr, "\xff/serverTagConflict0"_sr);
const KeyRef serverTagConflictPrefix = serverTagConflictKeys.begin;
// serverTagHistoryKeys is the old tag a storage server uses before it is migrated to a different location.
// For example, we can copy a SS file to a remote DC and start the SS there;
// The new SS will need to consume the last bits of data from the old tag it is responsible for.
const KeyRangeRef serverTagHistoryKeys(LiteralStringRef("\xff/serverTagHistory/"),
LiteralStringRef("\xff/serverTagHistory0"));
const KeyRangeRef serverTagHistoryKeys("\xff/serverTagHistory/"_sr, "\xff/serverTagHistory0"_sr);
const KeyRef serverTagHistoryPrefix = serverTagHistoryKeys.begin;
const Key serverTagKeyFor(UID serverID) {
@ -661,8 +654,7 @@ const Key serverTagConflictKeyFor(Tag tag) {
return wr.toValue();
}
const KeyRangeRef tagLocalityListKeys(LiteralStringRef("\xff/tagLocalityList/"),
LiteralStringRef("\xff/tagLocalityList0"));
const KeyRangeRef tagLocalityListKeys("\xff/tagLocalityList/"_sr, "\xff/tagLocalityList0"_sr);
const KeyRef tagLocalityListPrefix = tagLocalityListKeys.begin;
const Key tagLocalityListKeyFor(Optional<Value> dcID) {
@ -690,8 +682,7 @@ int8_t decodeTagLocalityListValue(ValueRef const& value) {
return s;
}
const KeyRangeRef datacenterReplicasKeys(LiteralStringRef("\xff\x02/datacenterReplicas/"),
LiteralStringRef("\xff\x02/datacenterReplicas0"));
const KeyRangeRef datacenterReplicasKeys("\xff\x02/datacenterReplicas/"_sr, "\xff\x02/datacenterReplicas0"_sr);
const KeyRef datacenterReplicasPrefix = datacenterReplicasKeys.begin;
const Key datacenterReplicasKeyFor(Optional<Value> dcID) {
@ -724,8 +715,7 @@ extern const KeyRangeRef tLogDatacentersKeys;
extern const KeyRef tLogDatacentersPrefix;
const Key tLogDatacentersKeyFor(Optional<Value> dcID);
const KeyRangeRef tLogDatacentersKeys(LiteralStringRef("\xff\x02/tLogDatacenters/"),
LiteralStringRef("\xff\x02/tLogDatacenters0"));
const KeyRangeRef tLogDatacentersKeys("\xff\x02/tLogDatacenters/"_sr, "\xff\x02/tLogDatacenters0"_sr);
const KeyRef tLogDatacentersPrefix = tLogDatacentersKeys.begin;
const Key tLogDatacentersKeyFor(Optional<Value> dcID) {
@ -741,10 +731,10 @@ Optional<Value> decodeTLogDatacentersKey(KeyRef const& key) {
return dcID;
}
const KeyRef primaryDatacenterKey = LiteralStringRef("\xff/primaryDatacenter");
const KeyRef primaryDatacenterKey = "\xff/primaryDatacenter"_sr;
// serverListKeys.contains(k) iff k.startsWith( serverListKeys.begin ) because '/'+1 == '0'
const KeyRangeRef serverListKeys(LiteralStringRef("\xff/serverList/"), LiteralStringRef("\xff/serverList0"));
const KeyRangeRef serverListKeys("\xff/serverList/"_sr, "\xff/serverList0"_sr);
const KeyRef serverListPrefix = serverListKeys.begin;
const Key serverListKeyFor(UID serverID) {
@ -800,11 +790,11 @@ SWVersion decodeSWVersionValue(ValueRef const& value) {
}
// processClassKeys.contains(k) iff k.startsWith( processClassKeys.begin ) because '/'+1 == '0'
const KeyRangeRef processClassKeys(LiteralStringRef("\xff/processClass/"), LiteralStringRef("\xff/processClass0"));
const KeyRangeRef processClassKeys("\xff/processClass/"_sr, "\xff/processClass0"_sr);
const KeyRef processClassPrefix = processClassKeys.begin;
const KeyRef processClassChangeKey = LiteralStringRef("\xff/processClassChanges");
const KeyRef processClassVersionKey = LiteralStringRef("\xff/processClassChangesVersion");
const ValueRef processClassVersionValue = LiteralStringRef("1");
const KeyRef processClassChangeKey = "\xff/processClassChanges"_sr;
const KeyRef processClassVersionKey = "\xff/processClassChangesVersion"_sr;
const ValueRef processClassVersionValue = "1"_sr;
const Key processClassKeyFor(StringRef processID) {
BinaryWriter wr(Unversioned());
@ -840,25 +830,23 @@ ProcessClass decodeProcessClassValue(ValueRef const& value) {
return s;
}
const KeyRangeRef configKeys(LiteralStringRef("\xff/conf/"), LiteralStringRef("\xff/conf0"));
const KeyRangeRef configKeys("\xff/conf/"_sr, "\xff/conf0"_sr);
const KeyRef configKeysPrefix = configKeys.begin;
const KeyRef perpetualStorageWiggleKey(LiteralStringRef("\xff/conf/perpetual_storage_wiggle"));
const KeyRef perpetualStorageWiggleLocalityKey(LiteralStringRef("\xff/conf/perpetual_storage_wiggle_locality"));
const KeyRef perpetualStorageWiggleIDPrefix(
LiteralStringRef("\xff/storageWiggleID/")); // withSuffix /primary or /remote
const KeyRef perpetualStorageWiggleStatsPrefix(
LiteralStringRef("\xff/storageWiggleStats/")); // withSuffix /primary or /remote
const KeyRef perpetualStorageWiggleKey("\xff/conf/perpetual_storage_wiggle"_sr);
const KeyRef perpetualStorageWiggleLocalityKey("\xff/conf/perpetual_storage_wiggle_locality"_sr);
const KeyRef perpetualStorageWiggleIDPrefix("\xff/storageWiggleID/"_sr); // withSuffix /primary or /remote
const KeyRef perpetualStorageWiggleStatsPrefix("\xff/storageWiggleStats/"_sr); // withSuffix /primary or /remote
const KeyRef triggerDDTeamInfoPrintKey(LiteralStringRef("\xff/triggerDDTeamInfoPrint"));
const KeyRef triggerDDTeamInfoPrintKey("\xff/triggerDDTeamInfoPrint"_sr);
const KeyRef consistencyScanInfoKey = "\xff/consistencyScanInfo"_sr;
const KeyRef encryptionAtRestModeConfKey(LiteralStringRef("\xff/conf/encryption_at_rest_mode"));
const KeyRef encryptionAtRestModeConfKey("\xff/conf/encryption_at_rest_mode"_sr);
const KeyRangeRef excludedServersKeys(LiteralStringRef("\xff/conf/excluded/"), LiteralStringRef("\xff/conf/excluded0"));
const KeyRangeRef excludedServersKeys("\xff/conf/excluded/"_sr, "\xff/conf/excluded0"_sr);
const KeyRef excludedServersPrefix = excludedServersKeys.begin;
const KeyRef excludedServersVersionKey = LiteralStringRef("\xff/conf/excluded");
const KeyRef excludedServersVersionKey = "\xff/conf/excluded"_sr;
AddressExclusion decodeExcludedServersKey(KeyRef const& key) {
ASSERT(key.startsWith(excludedServersPrefix));
// Returns an invalid NetworkAddress if given an invalid key (within the prefix)
@ -873,10 +861,9 @@ std::string encodeExcludedServersKey(AddressExclusion const& addr) {
return excludedServersPrefix.toString() + addr.toString();
}
const KeyRangeRef excludedLocalityKeys(LiteralStringRef("\xff/conf/excluded_locality/"),
LiteralStringRef("\xff/conf/excluded_locality0"));
const KeyRangeRef excludedLocalityKeys("\xff/conf/excluded_locality/"_sr, "\xff/conf/excluded_locality0"_sr);
const KeyRef excludedLocalityPrefix = excludedLocalityKeys.begin;
const KeyRef excludedLocalityVersionKey = LiteralStringRef("\xff/conf/excluded_locality");
const KeyRef excludedLocalityVersionKey = "\xff/conf/excluded_locality"_sr;
std::string decodeExcludedLocalityKey(KeyRef const& key) {
ASSERT(key.startsWith(excludedLocalityPrefix));
return key.removePrefix(excludedLocalityPrefix).toString();
@ -885,9 +872,9 @@ std::string encodeExcludedLocalityKey(std::string const& locality) {
return excludedLocalityPrefix.toString() + locality;
}
const KeyRangeRef failedServersKeys(LiteralStringRef("\xff/conf/failed/"), LiteralStringRef("\xff/conf/failed0"));
const KeyRangeRef failedServersKeys("\xff/conf/failed/"_sr, "\xff/conf/failed0"_sr);
const KeyRef failedServersPrefix = failedServersKeys.begin;
const KeyRef failedServersVersionKey = LiteralStringRef("\xff/conf/failed");
const KeyRef failedServersVersionKey = "\xff/conf/failed"_sr;
AddressExclusion decodeFailedServersKey(KeyRef const& key) {
ASSERT(key.startsWith(failedServersPrefix));
// Returns an invalid NetworkAddress if given an invalid key (within the prefix)
@ -902,10 +889,9 @@ std::string encodeFailedServersKey(AddressExclusion const& addr) {
return failedServersPrefix.toString() + addr.toString();
}
const KeyRangeRef failedLocalityKeys(LiteralStringRef("\xff/conf/failed_locality/"),
LiteralStringRef("\xff/conf/failed_locality0"));
const KeyRangeRef failedLocalityKeys("\xff/conf/failed_locality/"_sr, "\xff/conf/failed_locality0"_sr);
const KeyRef failedLocalityPrefix = failedLocalityKeys.begin;
const KeyRef failedLocalityVersionKey = LiteralStringRef("\xff/conf/failed_locality");
const KeyRef failedLocalityVersionKey = "\xff/conf/failed_locality"_sr;
std::string decodeFailedLocalityKey(KeyRef const& key) {
ASSERT(key.startsWith(failedLocalityPrefix));
return key.removePrefix(failedLocalityPrefix).toString();
@ -914,20 +900,18 @@ std::string encodeFailedLocalityKey(std::string const& locality) {
return failedLocalityPrefix.toString() + locality;
}
// const KeyRangeRef globalConfigKeys( LiteralStringRef("\xff/globalConfig/"), LiteralStringRef("\xff/globalConfig0") );
// const KeyRangeRef globalConfigKeys( "\xff/globalConfig/"_sr, "\xff/globalConfig0"_sr );
// const KeyRef globalConfigPrefix = globalConfigKeys.begin;
const KeyRangeRef globalConfigDataKeys(LiteralStringRef("\xff/globalConfig/k/"),
LiteralStringRef("\xff/globalConfig/k0"));
const KeyRangeRef globalConfigDataKeys("\xff/globalConfig/k/"_sr, "\xff/globalConfig/k0"_sr);
const KeyRef globalConfigKeysPrefix = globalConfigDataKeys.begin;
const KeyRangeRef globalConfigHistoryKeys(LiteralStringRef("\xff/globalConfig/h/"),
LiteralStringRef("\xff/globalConfig/h0"));
const KeyRangeRef globalConfigHistoryKeys("\xff/globalConfig/h/"_sr, "\xff/globalConfig/h0"_sr);
const KeyRef globalConfigHistoryPrefix = globalConfigHistoryKeys.begin;
const KeyRef globalConfigVersionKey = LiteralStringRef("\xff/globalConfig/v");
const KeyRef globalConfigVersionKey = "\xff/globalConfig/v"_sr;
const KeyRangeRef workerListKeys(LiteralStringRef("\xff/worker/"), LiteralStringRef("\xff/worker0"));
const KeyRangeRef workerListKeys("\xff/worker/"_sr, "\xff/worker0"_sr);
const KeyRef workerListPrefix = workerListKeys.begin;
const Key workerListKeyFor(StringRef processID) {
@ -957,11 +941,10 @@ ProcessData decodeWorkerListValue(ValueRef const& value) {
return s;
}
const KeyRangeRef backupProgressKeys(LiteralStringRef("\xff\x02/backupProgress/"),
LiteralStringRef("\xff\x02/backupProgress0"));
const KeyRangeRef backupProgressKeys("\xff\x02/backupProgress/"_sr, "\xff\x02/backupProgress0"_sr);
const KeyRef backupProgressPrefix = backupProgressKeys.begin;
const KeyRef backupStartedKey = LiteralStringRef("\xff\x02/backupStarted");
extern const KeyRef backupPausedKey = LiteralStringRef("\xff\x02/backupPaused");
const KeyRef backupStartedKey = "\xff\x02/backupStarted"_sr;
extern const KeyRef backupPausedKey = "\xff\x02/backupPaused"_sr;
const Key backupProgressKeyFor(UID workerID) {
BinaryWriter wr(Unversioned());
@ -1004,99 +987,91 @@ std::vector<std::pair<UID, Version>> decodeBackupStartedValue(const ValueRef& va
return ids;
}
const KeyRef previousCoordinatorsKey = LiteralStringRef("\xff/previousCoordinators");
const KeyRef coordinatorsKey = LiteralStringRef("\xff/coordinators");
const KeyRef logsKey = LiteralStringRef("\xff/logs");
const KeyRef minRequiredCommitVersionKey = LiteralStringRef("\xff/minRequiredCommitVersion");
const KeyRef versionEpochKey = LiteralStringRef("\xff/versionEpoch");
const KeyRef previousCoordinatorsKey = "\xff/previousCoordinators"_sr;
const KeyRef coordinatorsKey = "\xff/coordinators"_sr;
const KeyRef logsKey = "\xff/logs"_sr;
const KeyRef minRequiredCommitVersionKey = "\xff/minRequiredCommitVersion"_sr;
const KeyRef versionEpochKey = "\xff/versionEpoch"_sr;
const KeyRef globalKeysPrefix = LiteralStringRef("\xff/globals");
const KeyRef lastEpochEndKey = LiteralStringRef("\xff/globals/lastEpochEnd");
const KeyRef lastEpochEndPrivateKey = LiteralStringRef("\xff\xff/globals/lastEpochEnd");
const KeyRef killStorageKey = LiteralStringRef("\xff/globals/killStorage");
const KeyRef killStoragePrivateKey = LiteralStringRef("\xff\xff/globals/killStorage");
const KeyRef rebootWhenDurableKey = LiteralStringRef("\xff/globals/rebootWhenDurable");
const KeyRef rebootWhenDurablePrivateKey = LiteralStringRef("\xff\xff/globals/rebootWhenDurable");
const KeyRef primaryLocalityKey = LiteralStringRef("\xff/globals/primaryLocality");
const KeyRef primaryLocalityPrivateKey = LiteralStringRef("\xff\xff/globals/primaryLocality");
const KeyRef fastLoggingEnabled = LiteralStringRef("\xff/globals/fastLoggingEnabled");
const KeyRef fastLoggingEnabledPrivateKey = LiteralStringRef("\xff\xff/globals/fastLoggingEnabled");
const KeyRef globalKeysPrefix = "\xff/globals"_sr;
const KeyRef lastEpochEndKey = "\xff/globals/lastEpochEnd"_sr;
const KeyRef lastEpochEndPrivateKey = "\xff\xff/globals/lastEpochEnd"_sr;
const KeyRef killStorageKey = "\xff/globals/killStorage"_sr;
const KeyRef killStoragePrivateKey = "\xff\xff/globals/killStorage"_sr;
const KeyRef rebootWhenDurableKey = "\xff/globals/rebootWhenDurable"_sr;
const KeyRef rebootWhenDurablePrivateKey = "\xff\xff/globals/rebootWhenDurable"_sr;
const KeyRef primaryLocalityKey = "\xff/globals/primaryLocality"_sr;
const KeyRef primaryLocalityPrivateKey = "\xff\xff/globals/primaryLocality"_sr;
const KeyRef fastLoggingEnabled = "\xff/globals/fastLoggingEnabled"_sr;
const KeyRef fastLoggingEnabledPrivateKey = "\xff\xff/globals/fastLoggingEnabled"_sr;
// Whenever configuration changes or DD related system keyspace is changed(e.g.., serverList),
// actor must grab the moveKeysLockOwnerKey and update moveKeysLockWriteKey.
// This prevents concurrent write to the same system keyspace.
// When the owner of the DD related system keyspace changes, DD will reboot
const KeyRef moveKeysLockOwnerKey = LiteralStringRef("\xff/moveKeysLock/Owner");
const KeyRef moveKeysLockWriteKey = LiteralStringRef("\xff/moveKeysLock/Write");
const KeyRef moveKeysLockOwnerKey = "\xff/moveKeysLock/Owner"_sr;
const KeyRef moveKeysLockWriteKey = "\xff/moveKeysLock/Write"_sr;
const KeyRef dataDistributionModeKey = LiteralStringRef("\xff/dataDistributionMode");
const KeyRef dataDistributionModeKey = "\xff/dataDistributionMode"_sr;
const UID dataDistributionModeLock = UID(6345, 3425);
// Keys to view and control tag throttling
const KeyRangeRef tagThrottleKeys =
KeyRangeRef(LiteralStringRef("\xff\x02/throttledTags/tag/"), LiteralStringRef("\xff\x02/throttledTags/tag0"));
const KeyRangeRef tagThrottleKeys = KeyRangeRef("\xff\x02/throttledTags/tag/"_sr, "\xff\x02/throttledTags/tag0"_sr);
const KeyRef tagThrottleKeysPrefix = tagThrottleKeys.begin;
const KeyRef tagThrottleAutoKeysPrefix = LiteralStringRef("\xff\x02/throttledTags/tag/\x01");
const KeyRef tagThrottleSignalKey = LiteralStringRef("\xff\x02/throttledTags/signal");
const KeyRef tagThrottleAutoEnabledKey = LiteralStringRef("\xff\x02/throttledTags/autoThrottlingEnabled");
const KeyRef tagThrottleLimitKey = LiteralStringRef("\xff\x02/throttledTags/manualThrottleLimit");
const KeyRef tagThrottleCountKey = LiteralStringRef("\xff\x02/throttledTags/manualThrottleCount");
const KeyRef tagThrottleAutoKeysPrefix = "\xff\x02/throttledTags/tag/\x01"_sr;
const KeyRef tagThrottleSignalKey = "\xff\x02/throttledTags/signal"_sr;
const KeyRef tagThrottleAutoEnabledKey = "\xff\x02/throttledTags/autoThrottlingEnabled"_sr;
const KeyRef tagThrottleLimitKey = "\xff\x02/throttledTags/manualThrottleLimit"_sr;
const KeyRef tagThrottleCountKey = "\xff\x02/throttledTags/manualThrottleCount"_sr;
// Client status info prefix
const KeyRangeRef fdbClientInfoPrefixRange(LiteralStringRef("\xff\x02/fdbClientInfo/"),
LiteralStringRef("\xff\x02/fdbClientInfo0"));
const KeyRangeRef fdbClientInfoPrefixRange("\xff\x02/fdbClientInfo/"_sr, "\xff\x02/fdbClientInfo0"_sr);
// See remaining fields in GlobalConfig.actor.h
// ConsistencyCheck settings
const KeyRef fdbShouldConsistencyCheckBeSuspended = LiteralStringRef("\xff\x02/ConsistencyCheck/Suspend");
const KeyRef fdbShouldConsistencyCheckBeSuspended = "\xff\x02/ConsistencyCheck/Suspend"_sr;
// Request latency measurement key
const KeyRef latencyBandConfigKey = LiteralStringRef("\xff\x02/latencyBandConfig");
const KeyRef latencyBandConfigKey = "\xff\x02/latencyBandConfig"_sr;
// Keyspace to maintain wall clock to version map
const KeyRangeRef timeKeeperPrefixRange(LiteralStringRef("\xff\x02/timeKeeper/map/"),
LiteralStringRef("\xff\x02/timeKeeper/map0"));
const KeyRef timeKeeperVersionKey = LiteralStringRef("\xff\x02/timeKeeper/version");
const KeyRef timeKeeperDisableKey = LiteralStringRef("\xff\x02/timeKeeper/disable");
const KeyRangeRef timeKeeperPrefixRange("\xff\x02/timeKeeper/map/"_sr, "\xff\x02/timeKeeper/map0"_sr);
const KeyRef timeKeeperVersionKey = "\xff\x02/timeKeeper/version"_sr;
const KeyRef timeKeeperDisableKey = "\xff\x02/timeKeeper/disable"_sr;
// Backup Log Mutation constant variables
const KeyRef backupEnabledKey = LiteralStringRef("\xff/backupEnabled");
const KeyRangeRef backupLogKeys(LiteralStringRef("\xff\x02/blog/"), LiteralStringRef("\xff\x02/blog0"));
const KeyRangeRef applyLogKeys(LiteralStringRef("\xff\x02/alog/"), LiteralStringRef("\xff\x02/alog0"));
const KeyRef backupEnabledKey = "\xff/backupEnabled"_sr;
const KeyRangeRef backupLogKeys("\xff\x02/blog/"_sr, "\xff\x02/blog0"_sr);
const KeyRangeRef applyLogKeys("\xff\x02/alog/"_sr, "\xff\x02/alog0"_sr);
// static_assert( backupLogKeys.begin.size() == backupLogPrefixBytes, "backupLogPrefixBytes incorrect" );
const KeyRef backupVersionKey = LiteralStringRef("\xff/backupDataFormat");
const ValueRef backupVersionValue = LiteralStringRef("4");
const KeyRef backupVersionKey = "\xff/backupDataFormat"_sr;
const ValueRef backupVersionValue = "4"_sr;
const int backupVersion = 4;
// Log Range constant variables
// \xff/logRanges/[16-byte UID][begin key] := serialize( make_pair([end key], [destination key prefix]),
// IncludeVersion() )
const KeyRangeRef logRangesRange(LiteralStringRef("\xff/logRanges/"), LiteralStringRef("\xff/logRanges0"));
const KeyRangeRef logRangesRange("\xff/logRanges/"_sr, "\xff/logRanges0"_sr);
// Layer status metadata prefix
const KeyRangeRef layerStatusMetaPrefixRange(LiteralStringRef("\xff\x02/status/"),
LiteralStringRef("\xff\x02/status0"));
const KeyRangeRef layerStatusMetaPrefixRange("\xff\x02/status/"_sr, "\xff\x02/status0"_sr);
// Backup agent status root
const KeyRangeRef backupStatusPrefixRange(LiteralStringRef("\xff\x02/backupstatus/"),
LiteralStringRef("\xff\x02/backupstatus0"));
const KeyRangeRef backupStatusPrefixRange("\xff\x02/backupstatus/"_sr, "\xff\x02/backupstatus0"_sr);
// Restore configuration constant variables
const KeyRangeRef fileRestorePrefixRange(LiteralStringRef("\xff\x02/restore-agent/"),
LiteralStringRef("\xff\x02/restore-agent0"));
const KeyRangeRef fileRestorePrefixRange("\xff\x02/restore-agent/"_sr, "\xff\x02/restore-agent0"_sr);
// Backup Agent configuration constant variables
const KeyRangeRef fileBackupPrefixRange(LiteralStringRef("\xff\x02/backup-agent/"),
LiteralStringRef("\xff\x02/backup-agent0"));
const KeyRangeRef fileBackupPrefixRange("\xff\x02/backup-agent/"_sr, "\xff\x02/backup-agent0"_sr);
// DR Agent configuration constant variables
const KeyRangeRef databaseBackupPrefixRange(LiteralStringRef("\xff\x02/db-backup-agent/"),
LiteralStringRef("\xff\x02/db-backup-agent0"));
const KeyRangeRef databaseBackupPrefixRange("\xff\x02/db-backup-agent/"_sr, "\xff\x02/db-backup-agent0"_sr);
// \xff\x02/sharedLogRangesConfig/destUidLookup/[keyRange]
const KeyRef destUidLookupPrefix = LiteralStringRef("\xff\x02/sharedLogRangesConfig/destUidLookup/");
const KeyRef destUidLookupPrefix = "\xff\x02/sharedLogRangesConfig/destUidLookup/"_sr;
// \xff\x02/sharedLogRangesConfig/backuplatestVersions/[destUid]/[logUid]
const KeyRef backupLatestVersionsPrefix = LiteralStringRef("\xff\x02/sharedLogRangesConfig/backupLatestVersions/");
const KeyRef backupLatestVersionsPrefix = "\xff\x02/sharedLogRangesConfig/backupLatestVersions/"_sr;
// Returns the encoded key comprised of begin key and log uid
Key logRangesEncodeKey(KeyRef keyBegin, UID logUid) {
@ -1151,31 +1126,27 @@ Key uidPrefixKey(KeyRef keyPrefix, UID logUid) {
// Apply mutations constant variables
// \xff/applyMutationsEnd/[16-byte UID] := serialize( endVersion, Unversioned() )
// This indicates what is the highest version the mutation log can be applied
const KeyRangeRef applyMutationsEndRange(LiteralStringRef("\xff/applyMutationsEnd/"),
LiteralStringRef("\xff/applyMutationsEnd0"));
const KeyRangeRef applyMutationsEndRange("\xff/applyMutationsEnd/"_sr, "\xff/applyMutationsEnd0"_sr);
// \xff/applyMutationsBegin/[16-byte UID] := serialize( beginVersion, Unversioned() )
const KeyRangeRef applyMutationsBeginRange(LiteralStringRef("\xff/applyMutationsBegin/"),
LiteralStringRef("\xff/applyMutationsBegin0"));
const KeyRangeRef applyMutationsBeginRange("\xff/applyMutationsBegin/"_sr, "\xff/applyMutationsBegin0"_sr);
// \xff/applyMutationsAddPrefix/[16-byte UID] := addPrefix
const KeyRangeRef applyMutationsAddPrefixRange(LiteralStringRef("\xff/applyMutationsAddPrefix/"),
LiteralStringRef("\xff/applyMutationsAddPrefix0"));
const KeyRangeRef applyMutationsAddPrefixRange("\xff/applyMutationsAddPrefix/"_sr, "\xff/applyMutationsAddPrefix0"_sr);
// \xff/applyMutationsRemovePrefix/[16-byte UID] := removePrefix
const KeyRangeRef applyMutationsRemovePrefixRange(LiteralStringRef("\xff/applyMutationsRemovePrefix/"),
LiteralStringRef("\xff/applyMutationsRemovePrefix0"));
const KeyRangeRef applyMutationsRemovePrefixRange("\xff/applyMutationsRemovePrefix/"_sr,
"\xff/applyMutationsRemovePrefix0"_sr);
const KeyRangeRef applyMutationsKeyVersionMapRange(LiteralStringRef("\xff/applyMutationsKeyVersionMap/"),
LiteralStringRef("\xff/applyMutationsKeyVersionMap0"));
const KeyRangeRef applyMutationsKeyVersionCountRange(LiteralStringRef("\xff\x02/applyMutationsKeyVersionCount/"),
LiteralStringRef("\xff\x02/applyMutationsKeyVersionCount0"));
const KeyRangeRef applyMutationsKeyVersionMapRange("\xff/applyMutationsKeyVersionMap/"_sr,
"\xff/applyMutationsKeyVersionMap0"_sr);
const KeyRangeRef applyMutationsKeyVersionCountRange("\xff\x02/applyMutationsKeyVersionCount/"_sr,
"\xff\x02/applyMutationsKeyVersionCount0"_sr);
const KeyRef systemTuplesPrefix = LiteralStringRef("\xff/a/");
const KeyRef metricConfChangeKey = LiteralStringRef("\x01TDMetricConfChanges\x00");
const KeyRef systemTuplesPrefix = "\xff/a/"_sr;
const KeyRef metricConfChangeKey = "\x01TDMetricConfChanges\x00"_sr;
const KeyRangeRef metricConfKeys(LiteralStringRef("\x01TDMetricConf\x00\x01"),
LiteralStringRef("\x01TDMetricConf\x00\x02"));
const KeyRangeRef metricConfKeys("\x01TDMetricConf\x00\x01"_sr, "\x01TDMetricConf\x00\x02"_sr);
const KeyRef metricConfPrefix = metricConfKeys.begin;
/*
@ -1184,15 +1155,15 @@ const Key metricConfKey( KeyRef const& prefix, MetricNameRef const& name, KeyRef
wr.serializeBytes( prefix );
wr.serializeBytes( metricConfPrefix );
wr.serializeBytes( name.type );
wr.serializeBytes( LiteralStringRef("\x00\x01") );
wr.serializeBytes( "\x00\x01"_sr );
wr.serializeBytes( name.name );
wr.serializeBytes( LiteralStringRef("\x00\x01") );
wr.serializeBytes( "\x00\x01"_sr );
wr.serializeBytes( name.address );
wr.serializeBytes( LiteralStringRef("\x00\x01") );
wr.serializeBytes( "\x00\x01"_sr );
wr.serializeBytes( name.id );
wr.serializeBytes( LiteralStringRef("\x00\x01") );
wr.serializeBytes( "\x00\x01"_sr );
wr.serializeBytes( key );
wr.serializeBytes( LiteralStringRef("\x00") );
wr.serializeBytes( "\x00"_sr );
return wr.toValue();
}
@ -1215,23 +1186,22 @@ std::pair<MetricNameRef, KeyRef> decodeMetricConfKey( KeyRef const& prefix, KeyR
}
*/
const KeyRef maxUIDKey = LiteralStringRef("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
const KeyRef maxUIDKey = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"_sr;
const KeyRef databaseLockedKey = LiteralStringRef("\xff/dbLocked");
const KeyRef databaseLockedKeyEnd = LiteralStringRef("\xff/dbLocked\x00");
const KeyRef metadataVersionKey = LiteralStringRef("\xff/metadataVersion");
const KeyRef metadataVersionKeyEnd = LiteralStringRef("\xff/metadataVersion\x00");
const KeyRef metadataVersionRequiredValue =
LiteralStringRef("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
const KeyRef mustContainSystemMutationsKey = LiteralStringRef("\xff/mustContainSystemMutations");
const KeyRef databaseLockedKey = "\xff/dbLocked"_sr;
const KeyRef databaseLockedKeyEnd = "\xff/dbLocked\x00"_sr;
const KeyRef metadataVersionKey = "\xff/metadataVersion"_sr;
const KeyRef metadataVersionKeyEnd = "\xff/metadataVersion\x00"_sr;
const KeyRef metadataVersionRequiredValue = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"_sr;
const KeyRef mustContainSystemMutationsKey = "\xff/mustContainSystemMutations"_sr;
const KeyRangeRef monitorConfKeys(LiteralStringRef("\xff\x02/monitorConf/"), LiteralStringRef("\xff\x02/monitorConf0"));
const KeyRangeRef monitorConfKeys("\xff\x02/monitorConf/"_sr, "\xff\x02/monitorConf0"_sr);
const KeyRef restoreRequestDoneKey = LiteralStringRef("\xff\x02/restoreRequestDone");
const KeyRef restoreRequestDoneKey = "\xff\x02/restoreRequestDone"_sr;
const KeyRef healthyZoneKey = LiteralStringRef("\xff\x02/healthyZone");
const StringRef ignoreSSFailuresZoneString = LiteralStringRef("IgnoreSSFailures");
const KeyRef rebalanceDDIgnoreKey = LiteralStringRef("\xff\x02/rebalanceDDIgnored");
const KeyRef healthyZoneKey = "\xff\x02/healthyZone"_sr;
const StringRef ignoreSSFailuresZoneString = "IgnoreSSFailures"_sr;
const KeyRef rebalanceDDIgnoreKey = "\xff\x02/rebalanceDDIgnored"_sr;
const Value healthyZoneValue(StringRef const& zoneId, Version version) {
BinaryWriter wr(IncludeVersion(ProtocolVersion::withHealthyZoneValue()));
@ -1248,16 +1218,15 @@ std::pair<Key, Version> decodeHealthyZoneValue(ValueRef const& value) {
return std::make_pair(zoneId, version);
}
const KeyRangeRef testOnlyTxnStateStorePrefixRange(LiteralStringRef("\xff/TESTONLYtxnStateStore/"),
LiteralStringRef("\xff/TESTONLYtxnStateStore0"));
const KeyRangeRef testOnlyTxnStateStorePrefixRange("\xff/TESTONLYtxnStateStore/"_sr, "\xff/TESTONLYtxnStateStore0"_sr);
const KeyRef writeRecoveryKey = LiteralStringRef("\xff/writeRecovery");
const ValueRef writeRecoveryKeyTrue = LiteralStringRef("1");
const KeyRef snapshotEndVersionKey = LiteralStringRef("\xff/snapshotEndVersion");
const KeyRef writeRecoveryKey = "\xff/writeRecovery"_sr;
const ValueRef writeRecoveryKeyTrue = "1"_sr;
const KeyRef snapshotEndVersionKey = "\xff/snapshotEndVersion"_sr;
const KeyRangeRef changeFeedKeys(LiteralStringRef("\xff\x02/feed/"), LiteralStringRef("\xff\x02/feed0"));
const KeyRangeRef changeFeedKeys("\xff\x02/feed/"_sr, "\xff\x02/feed0"_sr);
const KeyRef changeFeedPrefix = changeFeedKeys.begin;
const KeyRef changeFeedPrivatePrefix = LiteralStringRef("\xff\xff\x02/feed/");
const KeyRef changeFeedPrivatePrefix = "\xff\xff\x02/feed/"_sr;
const Value changeFeedValue(KeyRangeRef const& range, Version popVersion, ChangeFeedStatus status) {
BinaryWriter wr(IncludeVersion(ProtocolVersion::withChangeFeed()));
@ -1278,7 +1247,7 @@ std::tuple<KeyRange, Version, ChangeFeedStatus> decodeChangeFeedValue(ValueRef c
return std::make_tuple(range, version, status);
}
const KeyRangeRef changeFeedDurableKeys(LiteralStringRef("\xff\xff/cf/"), LiteralStringRef("\xff\xff/cf0"));
const KeyRangeRef changeFeedDurableKeys("\xff\xff/cf/"_sr, "\xff\xff/cf0"_sr);
const KeyRef changeFeedDurablePrefix = changeFeedDurableKeys.begin;
const Value changeFeedDurableKey(Key const& feed, Version version) {
@ -1318,9 +1287,9 @@ const KeyRangeRef configClassKeys("\xff\xff/configClasses/"_sr, "\xff\xff/config
// key to watch for changes in active blob ranges + KeyRangeMap of active blob ranges
// Blob Manager + Worker stuff is all \xff\x02 to avoid Transaction State Store
const KeyRef blobRangeChangeKey = LiteralStringRef("\xff\x02/blobRangeChange");
const KeyRangeRef blobRangeKeys(LiteralStringRef("\xff\x02/blobRange/"), LiteralStringRef("\xff\x02/blobRange0"));
const KeyRef blobManagerEpochKey = LiteralStringRef("\xff\x02/blobManagerEpoch");
const KeyRef blobRangeChangeKey = "\xff\x02/blobRangeChange"_sr;
const KeyRangeRef blobRangeKeys("\xff\x02/blobRange/"_sr, "\xff\x02/blobRange0"_sr);
const KeyRef blobManagerEpochKey = "\xff\x02/blobManagerEpoch"_sr;
const Value blobManagerEpochValueFor(int64_t epoch) {
BinaryWriter wr(IncludeVersion(ProtocolVersion::withBlobGranule()));
@ -1336,21 +1305,19 @@ int64_t decodeBlobManagerEpochValue(ValueRef const& value) {
}
// blob granule data
const KeyRef blobRangeActive = LiteralStringRef("1");
const KeyRef blobRangeActive = "1"_sr;
const KeyRef blobRangeInactive = StringRef();
const KeyRangeRef blobGranuleFileKeys(LiteralStringRef("\xff\x02/bgf/"), LiteralStringRef("\xff\x02/bgf0"));
const KeyRangeRef blobGranuleMappingKeys(LiteralStringRef("\xff\x02/bgm/"), LiteralStringRef("\xff\x02/bgm0"));
const KeyRangeRef blobGranuleLockKeys(LiteralStringRef("\xff\x02/bgl/"), LiteralStringRef("\xff\x02/bgl0"));
const KeyRangeRef blobGranuleSplitKeys(LiteralStringRef("\xff\x02/bgs/"), LiteralStringRef("\xff\x02/bgs0"));
const KeyRangeRef blobGranuleMergeKeys(LiteralStringRef("\xff\x02/bgmerge/"), LiteralStringRef("\xff\x02/bgmerge0"));
const KeyRangeRef blobGranuleMergeBoundaryKeys(LiteralStringRef("\xff\x02/bgmergebounds/"),
LiteralStringRef("\xff\x02/bgmergebounds0"));
const KeyRangeRef blobGranuleHistoryKeys(LiteralStringRef("\xff\x02/bgh/"), LiteralStringRef("\xff\x02/bgh0"));
const KeyRangeRef blobGranulePurgeKeys(LiteralStringRef("\xff\x02/bgp/"), LiteralStringRef("\xff\x02/bgp0"));
const KeyRangeRef blobGranuleForcePurgedKeys(LiteralStringRef("\xff\x02/bgpforce/"),
LiteralStringRef("\xff\x02/bgpforce0"));
const KeyRef blobGranulePurgeChangeKey = LiteralStringRef("\xff\x02/bgpChange");
const KeyRangeRef blobGranuleFileKeys("\xff\x02/bgf/"_sr, "\xff\x02/bgf0"_sr);
const KeyRangeRef blobGranuleMappingKeys("\xff\x02/bgm/"_sr, "\xff\x02/bgm0"_sr);
const KeyRangeRef blobGranuleLockKeys("\xff\x02/bgl/"_sr, "\xff\x02/bgl0"_sr);
const KeyRangeRef blobGranuleSplitKeys("\xff\x02/bgs/"_sr, "\xff\x02/bgs0"_sr);
const KeyRangeRef blobGranuleMergeKeys("\xff\x02/bgmerge/"_sr, "\xff\x02/bgmerge0"_sr);
const KeyRangeRef blobGranuleMergeBoundaryKeys("\xff\x02/bgmergebounds/"_sr, "\xff\x02/bgmergebounds0"_sr);
const KeyRangeRef blobGranuleHistoryKeys("\xff\x02/bgh/"_sr, "\xff\x02/bgh0"_sr);
const KeyRangeRef blobGranulePurgeKeys("\xff\x02/bgp/"_sr, "\xff\x02/bgp0"_sr);
const KeyRangeRef blobGranuleForcePurgedKeys("\xff\x02/bgpforce/"_sr, "\xff\x02/bgpforce0"_sr);
const KeyRef blobGranulePurgeChangeKey = "\xff\x02/bgpChange"_sr;
const uint8_t BG_FILE_TYPE_DELTA = 'D';
const uint8_t BG_FILE_TYPE_SNAPSHOT = 'S';
@ -1628,7 +1595,7 @@ Standalone<BlobGranuleHistoryValue> decodeBlobGranuleHistoryValue(const ValueRef
return historyValue;
}
const KeyRangeRef blobWorkerListKeys(LiteralStringRef("\xff\x02/bwList/"), LiteralStringRef("\xff\x02/bwList0"));
const KeyRangeRef blobWorkerListKeys("\xff\x02/bwList/"_sr, "\xff\x02/bwList0"_sr);
const Key blobWorkerListKeyFor(UID workerID) {
BinaryWriter wr(AssumeVersion(ProtocolVersion::withBlobGranule()));
@ -1655,7 +1622,7 @@ BlobWorkerInterface decodeBlobWorkerListValue(ValueRef const& value) {
return interf;
}
const KeyRangeRef storageQuotaKeys(LiteralStringRef("\xff/storageQuota/"), LiteralStringRef("\xff/storageQuota0"));
const KeyRangeRef storageQuotaKeys("\xff/storageQuota/"_sr, "\xff/storageQuota0"_sr);
const KeyRef storageQuotaPrefix = storageQuotaKeys.begin;
Key storageQuotaKey(StringRef tenantName) {

View File

@ -66,7 +66,7 @@ struct UnblockFutureTaskFunc : TaskFuncBase {
return Void();
}
};
StringRef UnblockFutureTaskFunc::name = LiteralStringRef("UnblockFuture");
StringRef UnblockFutureTaskFunc::name = "UnblockFuture"_sr;
REGISTER_TASKFUNC(UnblockFutureTaskFunc);
struct AddTaskFunc : TaskFuncBase {
@ -88,7 +88,7 @@ struct AddTaskFunc : TaskFuncBase {
return Void();
};
};
StringRef AddTaskFunc::name = LiteralStringRef("AddTask");
StringRef AddTaskFunc::name = "AddTask"_sr;
REGISTER_TASKFUNC(AddTaskFunc);
struct IdleTaskFunc : TaskFuncBase {
@ -109,18 +109,18 @@ struct IdleTaskFunc : TaskFuncBase {
return tb->finish(tr, task);
};
};
StringRef IdleTaskFunc::name = LiteralStringRef("idle");
StringRef IdleTaskFunc::name = "idle"_sr;
REGISTER_TASKFUNC(IdleTaskFunc);
Key Task::reservedTaskParamKeyType = LiteralStringRef("type");
Key Task::reservedTaskParamKeyAddTask = LiteralStringRef("_add_task");
Key Task::reservedTaskParamKeyDone = LiteralStringRef("done");
Key Task::reservedTaskParamKeyPriority = LiteralStringRef("priority");
Key Task::reservedTaskParamKeyFuture = LiteralStringRef("future");
Key Task::reservedTaskParamKeyBlockID = LiteralStringRef("blockid");
Key Task::reservedTaskParamKeyVersion = LiteralStringRef("version");
Key Task::reservedTaskParamValidKey = LiteralStringRef("_validkey");
Key Task::reservedTaskParamValidValue = LiteralStringRef("_validvalue");
Key Task::reservedTaskParamKeyType = "type"_sr;
Key Task::reservedTaskParamKeyAddTask = "_add_task"_sr;
Key Task::reservedTaskParamKeyDone = "done"_sr;
Key Task::reservedTaskParamKeyPriority = "priority"_sr;
Key Task::reservedTaskParamKeyFuture = "future"_sr;
Key Task::reservedTaskParamKeyBlockID = "blockid"_sr;
Key Task::reservedTaskParamKeyVersion = "version"_sr;
Key Task::reservedTaskParamValidKey = "_validkey"_sr;
Key Task::reservedTaskParamValidValue = "_validvalue"_sr;
// IMPORTANT: Task() must result in an EMPTY parameter set, so params should only
// be set for non-default constructor arguments. To change this behavior look at all
@ -722,7 +722,7 @@ public:
Reference<TaskBucket> taskBucket) {
taskBucket->setOptions(tr);
Optional<Value> val = wait(tr->get(taskBucket->prefix.pack(LiteralStringRef("task_count"))));
Optional<Value> val = wait(tr->get(taskBucket->prefix.pack("task_count"_sr)));
if (!val.present())
return 0;
@ -873,10 +873,10 @@ TaskBucket::TaskBucket(const Subspace& subspace,
: cc("TaskBucket"), dispatchSlotChecksStarted("DispatchSlotChecksStarted", cc), dispatchErrors("DispatchErrors", cc),
dispatchDoTasks("DispatchDoTasks", cc), dispatchEmptyTasks("DispatchEmptyTasks", cc),
dispatchSlotChecksComplete("DispatchSlotChecksComplete", cc), dbgid(deterministicRandom()->randomUniqueID()),
prefix(subspace), active(prefix.get(LiteralStringRef("ac"))), pauseKey(prefix.pack(LiteralStringRef("pause"))),
available(prefix.get(LiteralStringRef("av"))), available_prioritized(prefix.get(LiteralStringRef("avp"))),
timeouts(prefix.get(LiteralStringRef("to"))), timeout(CLIENT_KNOBS->TASKBUCKET_TIMEOUT_VERSIONS),
system_access(sysAccess), priority_batch(priorityBatch), lockAware(lockAware) {}
prefix(subspace), active(prefix.get("ac"_sr)), pauseKey(prefix.pack("pause"_sr)), available(prefix.get("av"_sr)),
available_prioritized(prefix.get("avp"_sr)), timeouts(prefix.get("to"_sr)),
timeout(CLIENT_KNOBS->TASKBUCKET_TIMEOUT_VERSIONS), system_access(sysAccess), priority_batch(priorityBatch),
lockAware(lockAware) {}
TaskBucket::~TaskBucket() {}
@ -919,9 +919,7 @@ Key TaskBucket::addTask(Reference<ReadYourWritesTransaction> tr, Reference<Task>
for (auto& param : task->params)
tr->set(taskSpace.pack(param.key), param.value);
tr->atomicOp(prefix.pack(LiteralStringRef("task_count")),
LiteralStringRef("\x01\x00\x00\x00\x00\x00\x00\x00"),
MutationRef::AddValue);
tr->atomicOp(prefix.pack("task_count"_sr), "\x01\x00\x00\x00\x00\x00\x00\x00"_sr, MutationRef::AddValue);
return key;
}
@ -995,9 +993,7 @@ Future<Void> TaskBucket::finish(Reference<ReadYourWritesTransaction> tr, Referen
Tuple t = Tuple::makeTuple(task->timeoutVersion, task->key);
tr->atomicOp(prefix.pack(LiteralStringRef("task_count")),
LiteralStringRef("\xff\xff\xff\xff\xff\xff\xff\xff"),
MutationRef::AddValue);
tr->atomicOp(prefix.pack("task_count"_sr), "\xff\xff\xff\xff\xff\xff\xff\xff"_sr, MutationRef::AddValue);
tr->clear(timeouts.range(t));
return Void();
@ -1028,7 +1024,7 @@ Future<int64_t> TaskBucket::getTaskCount(Reference<ReadYourWritesTransaction> tr
}
Future<Void> TaskBucket::watchTaskCount(Reference<ReadYourWritesTransaction> tr) {
return tr->watch(prefix.pack(LiteralStringRef("task_count")));
return tr->watch(prefix.pack("task_count"_sr));
}
Future<Void> TaskBucket::debugPrintRange(Reference<ReadYourWritesTransaction> tr, Subspace subspace, Key msg) {
@ -1103,7 +1099,7 @@ public:
Key key = StringRef(deterministicRandom()->randomUniqueID().toString());
taskFuture->addBlock(tr, key);
auto task = makeReference<Task>();
task->params[Task::reservedTaskParamKeyType] = LiteralStringRef("UnblockFuture");
task->params[Task::reservedTaskParamKeyType] = "UnblockFuture"_sr;
task->params[Task::reservedTaskParamKeyFuture] = taskFuture->key;
task->params[Task::reservedTaskParamKeyBlockID] = key;
onSetFutures.push_back(vectorFuture[i]->onSet(tr, taskBucket, task));
@ -1217,7 +1213,7 @@ public:
taskFuture->futureBucket->setOptions(tr);
task->params[Task::reservedTaskParamKeyAddTask] = task->params[Task::reservedTaskParamKeyType];
task->params[Task::reservedTaskParamKeyType] = LiteralStringRef("AddTask");
task->params[Task::reservedTaskParamKeyType] = "AddTask"_sr;
wait(onSet(tr, taskBucket, taskFuture, task));
return Void();
@ -1282,14 +1278,14 @@ TaskFuture::TaskFuture(const Reference<FutureBucket> bucket, Key k) : futureBuck
}
prefix = futureBucket->prefix.get(key);
blocks = prefix.get(LiteralStringRef("bl"));
callbacks = prefix.get(LiteralStringRef("cb"));
blocks = prefix.get("bl"_sr);
callbacks = prefix.get("cb"_sr);
}
TaskFuture::~TaskFuture() {}
void TaskFuture::addBlock(Reference<ReadYourWritesTransaction> tr, StringRef block_id) {
tr->set(blocks.pack(block_id), LiteralStringRef(""));
tr->set(blocks.pack(block_id), ""_sr);
}
Future<Void> TaskFuture::set(Reference<ReadYourWritesTransaction> tr, Reference<TaskBucket> taskBucket) {

View File

@ -497,7 +497,7 @@ TEST_CASE("/flow/Tracing/AddEvents") {
auto arena = span1.arena;
SmallVectorRef<KeyValueRef> attrs;
attrs.push_back(arena, KeyValueRef("foo"_sr, "bar"_sr));
span1.addEvent(LiteralStringRef("read_version"), 1.0, attrs);
span1.addEvent("read_version"_sr, 1.0, attrs);
ASSERT(span1.events[0].name.toString() == "read_version");
ASSERT(span1.events[0].time == 1.0);
ASSERT(span1.events[0].attributes.begin()->key.toString() == "foo");
@ -505,7 +505,7 @@ TEST_CASE("/flow/Tracing/AddEvents") {
// Use helper method to add an OTELEventRef with no attributes to an OTELSpan
Span span2("span_with_event"_loc);
span2.addEvent(StringRef(span2.arena, LiteralStringRef("commit_succeed")), 1234567.100);
span2.addEvent(StringRef(span2.arena, "commit_succeed"_sr), 1234567.100);
ASSERT(span2.events[0].name.toString() == "commit_succeed");
ASSERT(span2.events[0].time == 1234567.100);
ASSERT(span2.events[0].attributes.size() == 0);
@ -537,8 +537,8 @@ TEST_CASE("/flow/Tracing/AddAttributes") {
IKnobCollection::getMutableGlobalKnobCollection().setKnob("tracing_span_attributes_enabled",
KnobValueRef::create(bool{ true }));
auto arena = span1.arena;
span1.addAttribute(StringRef(arena, LiteralStringRef("foo")), StringRef(arena, LiteralStringRef("bar")));
span1.addAttribute(StringRef(arena, LiteralStringRef("operation")), StringRef(arena, LiteralStringRef("grv")));
span1.addAttribute(StringRef(arena, "foo"_sr), StringRef(arena, "bar"_sr));
span1.addAttribute(StringRef(arena, "operation"_sr), StringRef(arena, "grv"_sr));
ASSERT_EQ(span1.attributes.size(), 3); // Includes default attribute of "address"
ASSERT(span1.attributes[1] == KeyValueRef("foo"_sr, "bar"_sr));
ASSERT(span1.attributes[2] == KeyValueRef("operation"_sr, "grv"_sr));
@ -548,9 +548,9 @@ TEST_CASE("/flow/Tracing/AddAttributes") {
deterministicRandom()->randomUInt64(),
TraceFlags::sampled));
auto s2Arena = span2.arena;
span2.addAttribute(StringRef(s2Arena, LiteralStringRef("a")), StringRef(s2Arena, LiteralStringRef("1")))
.addAttribute(StringRef(s2Arena, LiteralStringRef("b")), LiteralStringRef("2"))
.addAttribute(StringRef(s2Arena, LiteralStringRef("c")), LiteralStringRef("3"));
span2.addAttribute(StringRef(s2Arena, "a"_sr), StringRef(s2Arena, "1"_sr))
.addAttribute(StringRef(s2Arena, "b"_sr), "2"_sr)
.addAttribute(StringRef(s2Arena, "c"_sr), "3"_sr);
ASSERT_EQ(span2.attributes.size(), 4); // Includes default attribute of "address"
ASSERT(span2.attributes[1] == KeyValueRef("a"_sr, "1"_sr));
@ -718,7 +718,7 @@ TEST_CASE("/flow/Tracing/FastUDPMessagePackEncoding") {
attrs.push_back(s3Arena, KeyValueRef("foo"_sr, "bar"_sr));
span3.addAttribute("operation"_sr, "grv"_sr)
.addLink(SpanContext(UID(300, 301), 400, TraceFlags::sampled))
.addEvent(StringRef(s3Arena, LiteralStringRef("event1")), 100.101, attrs);
.addEvent(StringRef(s3Arena, "event1"_sr), 100.101, attrs);
tracer.serialize_span(span3, request);
data = request.buffer.get();
ASSERT(data[0] == 0b10011100); // 12 element array.

View File

@ -621,7 +621,7 @@ class TagUidMap : public KeyBackedMap<std::string, UidAndAbortedFlagT> {
Snapshot snapshot);
public:
TagUidMap(const StringRef& prefix) : TagMap(LiteralStringRef("tag->uid/").withPrefix(prefix)), prefix(prefix) {}
TagUidMap(const StringRef& prefix) : TagMap("tag->uid/"_sr.withPrefix(prefix)), prefix(prefix) {}
Future<std::vector<KeyBackedTag>> getAll(Reference<ReadYourWritesTransaction> tr,
Snapshot snapshot = Snapshot::False) {
@ -656,7 +656,7 @@ public:
} TaskParams;
KeyBackedConfig(StringRef prefix, UID uid = UID())
: uid(uid), prefix(prefix), configSpace(uidPrefixKey(LiteralStringRef("uid->config/").withPrefix(prefix), uid)) {}
: uid(uid), prefix(prefix), configSpace(uidPrefixKey("uid->config/"_sr.withPrefix(prefix), uid)) {}
KeyBackedConfig(StringRef prefix, Reference<Task> task) : KeyBackedConfig(prefix, TaskParams.uid().get(task)) {}

View File

@ -37,7 +37,7 @@ struct ClientVersionRef {
ClientVersionRef(StringRef clientVersion, StringRef sourceVersion, StringRef protocolVersion)
: clientVersion(clientVersion), sourceVersion(sourceVersion), protocolVersion(protocolVersion) {}
ClientVersionRef(StringRef versionString) {
std::vector<StringRef> parts = versionString.splitAny(LiteralStringRef(","));
std::vector<StringRef> parts = versionString.splitAny(","_sr);
if (parts.size() != 3) {
initUnknown();
return;
@ -48,9 +48,9 @@ struct ClientVersionRef {
}
void initUnknown() {
clientVersion = LiteralStringRef("Unknown");
sourceVersion = LiteralStringRef("Unknown");
protocolVersion = LiteralStringRef("Unknown");
clientVersion = "Unknown"_sr;
sourceVersion = "Unknown"_sr;
protocolVersion = "Unknown"_sr;
}
template <class Ar>

View File

@ -520,7 +520,7 @@ using MappedRangeResult = Standalone<struct MappedRangeResultRef>;
enum { invalidVersion = -1, latestVersion = -2, MAX_VERSION = std::numeric_limits<int64_t>::max() };
inline Key keyAfter(const KeyRef& key) {
if (key == LiteralStringRef("\xff\xff"))
if (key == "\xff\xff"_sr)
return key;
Standalone<StringRef> r;
@ -533,7 +533,7 @@ inline Key keyAfter(const KeyRef& key) {
return r;
}
inline KeyRef keyAfter(const KeyRef& key, Arena& arena) {
if (key == LiteralStringRef("\xff\xff"))
if (key == "\xff\xff"_sr)
return key;
uint8_t* t = new (arena) uint8_t[key.size() + 1];
memcpy(t, key.begin(), key.size());
@ -948,17 +948,17 @@ struct TLogVersion {
}
static ErrorOr<TLogVersion> FromStringRef(StringRef s) {
if (s == LiteralStringRef("2"))
if (s == "2"_sr)
return V2;
if (s == LiteralStringRef("3"))
if (s == "3"_sr)
return V3;
if (s == LiteralStringRef("4"))
if (s == "4"_sr)
return V4;
if (s == LiteralStringRef("5"))
if (s == "5"_sr)
return V5;
if (s == LiteralStringRef("6"))
if (s == "6"_sr)
return V6;
if (s == LiteralStringRef("7"))
if (s == "7"_sr)
return V7;
return default_error_or();
}
@ -1008,9 +1008,9 @@ struct TLogSpillType {
}
static ErrorOr<TLogSpillType> FromStringRef(StringRef s) {
if (s == LiteralStringRef("1"))
if (s == "1"_sr)
return VALUE;
if (s == LiteralStringRef("2"))
if (s == "2"_sr)
return REFERENCE;
return default_error_or();
}

View File

@ -249,7 +249,7 @@ Future<std::vector<ProcessData>> getWorkers(Reference<Tr> tr,
// Accepts a full configuration in key/value format (from buildConfiguration)
ACTOR template <class DB>
Future<ConfigurationResult> changeConfig(Reference<DB> db, std::map<std::string, std::string> m, bool force) {
state StringRef initIdKey = LiteralStringRef("\xff/init_id");
state StringRef initIdKey = "\xff/init_id"_sr;
state Reference<typename DB::TransactionT> tr = db->createTransaction();
if (!m.size()) {
@ -505,8 +505,8 @@ Future<ConfigurationResult> changeConfig(Reference<DB> db, std::map<std::string,
ASSERT(creating);
tr->atomicOp(databaseLockedKey,
BinaryWriter::toValue(locked.get(), Unversioned())
.withPrefix(LiteralStringRef("0123456789"))
.withSuffix(LiteralStringRef("\x00\x00\x00\x00")),
.withPrefix("0123456789"_sr)
.withSuffix("\x00\x00\x00\x00"_sr),
MutationRef::SetVersionstampedValue);
}
@ -650,7 +650,7 @@ Future<ConfigurationResult> changeConfig(Reference<DB> db,
std::vector<StringRef> const& modes,
Optional<ConfigureAutoResult> const& conf,
bool force) {
if (modes.size() && modes[0] == LiteralStringRef("auto") && conf.present()) {
if (modes.size() && modes[0] == "auto"_sr && conf.present()) {
return autoConfig(db, conf.get());
}

View File

@ -264,9 +264,9 @@ Future<bool> getValidAutoEnabled(Reference<Tr> tr) {
tr->reset();
wait(delay(CLIENT_KNOBS->DEFAULT_BACKOFF));
continue;
} else if (value.get() == LiteralStringRef("1")) {
} else if (value.get() == "1"_sr) {
result = true;
} else if (value.get() == LiteralStringRef("0")) {
} else if (value.get() == "0"_sr) {
result = false;
} else {
TraceEvent(SevWarnAlways, "InvalidAutoTagThrottlingValue").detail("Value", value.get());
@ -331,8 +331,7 @@ getThrottledTags(Reference<DB> db, int limit, ContainsRecommended containsRecomm
template <class Tr>
void signalThrottleChange(Reference<Tr> tr) {
tr->atomicOp(
tagThrottleSignalKey, LiteralStringRef("XXXXXXXXXX\x00\x00\x00\x00"), MutationRef::SetVersionstampedValue);
tr->atomicOp(tagThrottleSignalKey, "XXXXXXXXXX\x00\x00\x00\x00"_sr, MutationRef::SetVersionstampedValue);
}
ACTOR template <class Tr>
@ -583,8 +582,7 @@ Future<Void> enableAuto(Reference<DB> db, bool enabled) {
state typename DB::TransactionT::template FutureT<Optional<Value>> valueF =
tr->get(tagThrottleAutoEnabledKey);
Optional<Value> value = wait(safeThreadFutureToFuture(valueF));
if (!value.present() || (enabled && value.get() != LiteralStringRef("1")) ||
(!enabled && value.get() != LiteralStringRef("0"))) {
if (!value.present() || (enabled && value.get() != "1"_sr) || (!enabled && value.get() != "0"_sr)) {
tr->set(tagThrottleAutoEnabledKey, LiteralStringRef(enabled ? "1" : "0"));
signalThrottleChange<typename DB::TransactionT>(tr);

View File

@ -48,7 +48,7 @@ TEST_CASE("/flow/actorcompiler/lineNumbers") {
}
break;
}
ASSERT(LiteralStringRef(__FILE__).endsWith(LiteralStringRef("FlowTests.actor.cpp")));
ASSERT(LiteralStringRef(__FILE__).endsWith("FlowTests.actor.cpp"_sr));
return Void();
}

View File

@ -299,12 +299,12 @@ public:
~TransportData();
void initMetrics() {
bytesSent.init(LiteralStringRef("Net2.BytesSent"));
countPacketsReceived.init(LiteralStringRef("Net2.CountPacketsReceived"));
countPacketsGenerated.init(LiteralStringRef("Net2.CountPacketsGenerated"));
countConnEstablished.init(LiteralStringRef("Net2.CountConnEstablished"));
countConnClosedWithError.init(LiteralStringRef("Net2.CountConnClosedWithError"));
countConnClosedWithoutError.init(LiteralStringRef("Net2.CountConnClosedWithoutError"));
bytesSent.init("Net2.BytesSent"_sr);
countPacketsReceived.init("Net2.CountPacketsReceived"_sr);
countPacketsGenerated.init("Net2.CountPacketsGenerated"_sr);
countConnEstablished.init("Net2.CountConnEstablished"_sr);
countConnClosedWithError.init("Net2.CountConnClosedWithError"_sr);
countConnClosedWithoutError.init("Net2.CountConnClosedWithoutError"_sr);
}
Reference<struct Peer> getPeer(NetworkAddress const& address);

View File

@ -100,14 +100,14 @@ PacketBuffer* writeRequestHeader(std::string const& verb,
writer.serializeBytes(verb);
writer.serializeBytes(" ", 1);
writer.serializeBytes(resource);
writer.serializeBytes(LiteralStringRef(" HTTP/1.1\r\n"));
writer.serializeBytes(" HTTP/1.1\r\n"_sr);
for (auto h : headers) {
writer.serializeBytes(h.first);
writer.serializeBytes(LiteralStringRef(": "));
writer.serializeBytes(": "_sr);
writer.serializeBytes(h.second);
writer.serializeBytes(LiteralStringRef("\r\n"));
writer.serializeBytes("\r\n"_sr);
}
writer.serializeBytes(LiteralStringRef("\r\n"));
writer.serializeBytes("\r\n"_sr);
return writer.finish();
}

View File

@ -21,13 +21,13 @@
#include "fdbrpc/Locality.h"
const UID LocalityData::UNSET_ID = UID(0x0ccb4e0feddb5583, 0x010f6b77d9d10ece);
const StringRef LocalityData::keyProcessId = LiteralStringRef("processid");
const StringRef LocalityData::keyZoneId = LiteralStringRef("zoneid");
const StringRef LocalityData::keyDcId = LiteralStringRef("dcid");
const StringRef LocalityData::keyMachineId = LiteralStringRef("machineid");
const StringRef LocalityData::keyDataHallId = LiteralStringRef("data_hall");
const StringRef LocalityData::ExcludeLocalityKeyMachineIdPrefix = LiteralStringRef("locality_machineid:");
const StringRef LocalityData::ExcludeLocalityPrefix = LiteralStringRef("locality_");
const StringRef LocalityData::keyProcessId = "processid"_sr;
const StringRef LocalityData::keyZoneId = "zoneid"_sr;
const StringRef LocalityData::keyDcId = "dcid"_sr;
const StringRef LocalityData::keyMachineId = "machineid"_sr;
const StringRef LocalityData::keyDataHallId = "data_hall"_sr;
const StringRef LocalityData::ExcludeLocalityKeyMachineIdPrefix = "locality_machineid:"_sr;
const StringRef LocalityData::ExcludeLocalityPrefix = "locality_"_sr;
ProcessClass::Fitness ProcessClass::machineClassFitness(ClusterRole role) const {
switch (role) {

View File

@ -493,10 +493,10 @@ Reference<LocalitySet> createTestLocalityMap(std::vector<repTestType>& indexes,
serverValue = dcLoop + szLoop * 10 + rackLoop * 100 + slotLoop * 1000;
slotText = format(".%d", slotLoop);
LocalityData data;
data.set(LiteralStringRef("dc"), StringRef(dcText));
data.set(LiteralStringRef("sz"), StringRef(dcText + szText));
data.set(LiteralStringRef("rack"), StringRef(dcText + szText + rackText));
data.set(LiteralStringRef("zoneid"), StringRef(dcText + szText + rackText + slotText));
data.set("dc"_sr, StringRef(dcText));
data.set("sz"_sr, StringRef(dcText + szText));
data.set("rack"_sr, StringRef(dcText + szText + rackText));
data.set("zoneid"_sr, StringRef(dcText + szText + rackText + slotText));
for (int independentLoop = 0; independentLoop < independentItems; independentLoop++) {
independentName = format("indiv%02d", independentLoop + 1);
for (int totalLoop = 0; totalLoop < independentTotal; totalLoop++) {
@ -520,10 +520,10 @@ Reference<LocalitySet> createTestLocalityMap(std::vector<repTestType>& indexes,
serverValue = (dcLoop + 2) + szLoop * 10 + rackLoop * 100 + slotLoop * 1000;
slotText = format(".%d", slotLoop);
LocalityData data;
data.set(LiteralStringRef("dc"), StringRef(dcText));
data.set(LiteralStringRef("az"), StringRef(dcText + szText));
data.set(LiteralStringRef("rack"), StringRef(dcText + szText + rackText));
data.set(LiteralStringRef("zoneid"), StringRef(dcText + szText + rackText + slotText));
data.set("dc"_sr, StringRef(dcText));
data.set("az"_sr, StringRef(dcText + szText));
data.set("rack"_sr, StringRef(dcText + szText + rackText));
data.set("zoneid"_sr, StringRef(dcText + szText + rackText + slotText));
for (int independentLoop = 0; independentLoop < independentItems; independentLoop++) {
independentName = format("indiv%02d", independentLoop);
for (int totalLoop = 0; totalLoop < independentTotal; totalLoop++) {

View File

@ -643,9 +643,9 @@ void arenaTest() {
{
Arena arena;
VectorRef<StringRef> test;
test.push_back(arena, StringRef(arena, LiteralStringRef("Hello")));
test.push_back(arena, StringRef(arena, LiteralStringRef(", ")));
test.push_back(arena, StringRef(arena, LiteralStringRef("World!")));
test.push_back(arena, StringRef(arena, "Hello"_sr));
test.push_back(arena, StringRef(arena, ", "_sr));
test.push_back(arena, StringRef(arena, "World!"_sr));
for (auto i = test.begin(); i != test.end(); ++i)
for (auto j = i->begin(); j != i->end(); ++j)

View File

@ -73,7 +73,7 @@ struct EvictablePageCache : ReferenceCounted<EvictablePageCache> {
explicit EvictablePageCache(int pageSize, int64_t maxSize)
: pageSize(pageSize), maxPages(maxSize / pageSize),
cacheEvictionType(evictionPolicyStringToEnum(FLOW_KNOBS->CACHE_EVICTION_POLICY)) {
cacheEvictions.init(LiteralStringRef("EvictablePageCache.CacheEvictions"));
cacheEvictions.init("EvictablePageCache.CacheEvictions"_sr);
}
void allocate(EvictablePage* page) {
@ -303,25 +303,25 @@ private:
: filename(filename), uncached(uncached), length(length), prevLength(length), pageCache(pageCache),
currentTruncate(Void()), currentTruncateSize(0), rateControl(nullptr) {
if (!g_network->isSimulated()) {
countFileCacheWrites.init(LiteralStringRef("AsyncFile.CountFileCacheWrites"), filename);
countFileCacheReads.init(LiteralStringRef("AsyncFile.CountFileCacheReads"), filename);
countFileCacheWritesBlocked.init(LiteralStringRef("AsyncFile.CountFileCacheWritesBlocked"), filename);
countFileCacheReadsBlocked.init(LiteralStringRef("AsyncFile.CountFileCacheReadsBlocked"), filename);
countFileCachePageReadsHit.init(LiteralStringRef("AsyncFile.CountFileCachePageReadsHit"), filename);
countFileCachePageReadsMissed.init(LiteralStringRef("AsyncFile.CountFileCachePageReadsMissed"), filename);
countFileCachePageReadsMerged.init(LiteralStringRef("AsyncFile.CountFileCachePageReadsMerged"), filename);
countFileCacheFinds.init(LiteralStringRef("AsyncFile.CountFileCacheFinds"), filename);
countFileCacheReadBytes.init(LiteralStringRef("AsyncFile.CountFileCacheReadBytes"), filename);
countFileCacheWrites.init("AsyncFile.CountFileCacheWrites"_sr, filename);
countFileCacheReads.init("AsyncFile.CountFileCacheReads"_sr, filename);
countFileCacheWritesBlocked.init("AsyncFile.CountFileCacheWritesBlocked"_sr, filename);
countFileCacheReadsBlocked.init("AsyncFile.CountFileCacheReadsBlocked"_sr, filename);
countFileCachePageReadsHit.init("AsyncFile.CountFileCachePageReadsHit"_sr, filename);
countFileCachePageReadsMissed.init("AsyncFile.CountFileCachePageReadsMissed"_sr, filename);
countFileCachePageReadsMerged.init("AsyncFile.CountFileCachePageReadsMerged"_sr, filename);
countFileCacheFinds.init("AsyncFile.CountFileCacheFinds"_sr, filename);
countFileCacheReadBytes.init("AsyncFile.CountFileCacheReadBytes"_sr, filename);
countCacheWrites.init(LiteralStringRef("AsyncFile.CountCacheWrites"));
countCacheReads.init(LiteralStringRef("AsyncFile.CountCacheReads"));
countCacheWritesBlocked.init(LiteralStringRef("AsyncFile.CountCacheWritesBlocked"));
countCacheReadsBlocked.init(LiteralStringRef("AsyncFile.CountCacheReadsBlocked"));
countCachePageReadsHit.init(LiteralStringRef("AsyncFile.CountCachePageReadsHit"));
countCachePageReadsMissed.init(LiteralStringRef("AsyncFile.CountCachePageReadsMissed"));
countCachePageReadsMerged.init(LiteralStringRef("AsyncFile.CountCachePageReadsMerged"));
countCacheFinds.init(LiteralStringRef("AsyncFile.CountCacheFinds"));
countCacheReadBytes.init(LiteralStringRef("AsyncFile.CountCacheReadBytes"));
countCacheWrites.init("AsyncFile.CountCacheWrites"_sr);
countCacheReads.init("AsyncFile.CountCacheReads"_sr);
countCacheWritesBlocked.init("AsyncFile.CountCacheWritesBlocked"_sr);
countCacheReadsBlocked.init("AsyncFile.CountCacheReadsBlocked"_sr);
countCachePageReadsHit.init("AsyncFile.CountCachePageReadsHit"_sr);
countCachePageReadsMissed.init("AsyncFile.CountCachePageReadsMissed"_sr);
countCachePageReadsMerged.init("AsyncFile.CountCachePageReadsMerged"_sr);
countCacheFinds.init("AsyncFile.CountCacheFinds"_sr);
countCacheReadBytes.init("AsyncFile.CountCacheReadBytes"_sr);
}
}

View File

@ -279,11 +279,11 @@ private:
AsyncFileEIO(int fd, int flags, std::string const& filename)
: fd(fd), flags(flags), err(new ErrorInfo), filename(filename) {
if (!g_network->isSimulated()) {
countFileLogicalWrites.init(LiteralStringRef("AsyncFile.CountFileLogicalWrites"), filename);
countFileLogicalReads.init(LiteralStringRef("AsyncFile.CountFileLogicalReads"), filename);
countFileLogicalWrites.init("AsyncFile.CountFileLogicalWrites"_sr, filename);
countFileLogicalReads.init("AsyncFile.CountFileLogicalReads"_sr, filename);
countLogicalWrites.init(LiteralStringRef("AsyncFile.CountLogicalWrites"));
countLogicalReads.init(LiteralStringRef("AsyncFile.CountLogicalReads"));
countLogicalWrites.init("AsyncFile.CountLogicalWrites"_sr);
countLogicalReads.init("AsyncFile.CountLogicalReads"_sr);
}
}

View File

@ -191,12 +191,12 @@ public:
static void init(Reference<IEventFD> ev, double ioTimeout) {
ASSERT(!FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO);
if (!g_network->isSimulated()) {
ctx.countAIOSubmit.init(LiteralStringRef("AsyncFile.CountAIOSubmit"));
ctx.countAIOCollect.init(LiteralStringRef("AsyncFile.CountAIOCollect"));
ctx.submitMetric.init(LiteralStringRef("AsyncFile.Submit"));
ctx.countPreSubmitTruncate.init(LiteralStringRef("AsyncFile.CountPreAIOSubmitTruncate"));
ctx.preSubmitTruncateBytes.init(LiteralStringRef("AsyncFile.PreAIOSubmitTruncateBytes"));
ctx.slowAioSubmitMetric.init(LiteralStringRef("AsyncFile.SlowAIOSubmit"));
ctx.countAIOSubmit.init("AsyncFile.CountAIOSubmit"_sr);
ctx.countAIOCollect.init("AsyncFile.CountAIOCollect"_sr);
ctx.submitMetric.init("AsyncFile.Submit"_sr);
ctx.countPreSubmitTruncate.init("AsyncFile.CountPreAIOSubmitTruncate"_sr);
ctx.preSubmitTruncateBytes.init("AsyncFile.PreAIOSubmitTruncateBytes"_sr);
ctx.slowAioSubmitMetric.init("AsyncFile.SlowAIOSubmit"_sr);
}
int rc = io_setup(FLOW_KNOBS->MAX_OUTSTANDING, &ctx.iocx);
@ -648,17 +648,17 @@ private:
: failed(false), fd(fd), flags(flags), filename(filename) {
ASSERT(!FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO);
if (!g_network->isSimulated()) {
countFileLogicalWrites.init(LiteralStringRef("AsyncFile.CountFileLogicalWrites"), filename);
countFileLogicalReads.init(LiteralStringRef("AsyncFile.CountFileLogicalReads"), filename);
countLogicalWrites.init(LiteralStringRef("AsyncFile.CountLogicalWrites"));
countLogicalReads.init(LiteralStringRef("AsyncFile.CountLogicalReads"));
countFileLogicalWrites.init("AsyncFile.CountFileLogicalWrites"_sr, filename);
countFileLogicalReads.init("AsyncFile.CountFileLogicalReads"_sr, filename);
countLogicalWrites.init("AsyncFile.CountLogicalWrites"_sr);
countLogicalReads.init("AsyncFile.CountLogicalReads"_sr);
}
#if KAIO_LOGGING
logFile = nullptr;
// TODO: Don't do this hacky investigation-specific thing
StringRef fname(filename);
if (fname.endsWith(LiteralStringRef(".sqlite")) || fname.endsWith(LiteralStringRef(".sqlite-wal"))) {
if (fname.endsWith(".sqlite"_sr) || fname.endsWith(".sqlite-wal"_sr)) {
std::string logFileName = basename(filename);
while (logFileName.find("/") != std::string::npos)
logFileName = logFileName.substr(logFileName.find("/") + 1);

View File

@ -254,19 +254,19 @@ void serializeReplicationPolicy(Ar& ar, Reference<IReplicationPolicy>& policy) {
StringRef name;
serializer(ar, name);
if (name == LiteralStringRef("One")) {
if (name == "One"_sr) {
PolicyOne* pointer = new PolicyOne();
pointer->serialize(ar);
policy = Reference<IReplicationPolicy>(pointer);
} else if (name == LiteralStringRef("Across")) {
} else if (name == "Across"_sr) {
PolicyAcross* pointer = new PolicyAcross(0, "", Reference<IReplicationPolicy>());
pointer->serialize(ar);
policy = Reference<IReplicationPolicy>(pointer);
} else if (name == LiteralStringRef("And")) {
} else if (name == "And"_sr) {
PolicyAnd* pointer = new PolicyAnd{};
pointer->serialize(ar);
policy = Reference<IReplicationPolicy>(pointer);
} else if (name == LiteralStringRef("None")) {
} else if (name == "None"_sr) {
policy = Reference<IReplicationPolicy>();
} else {
TraceEvent(SevError, "SerializingInvalidPolicyType").detail("PolicyName", name);

View File

@ -2648,8 +2648,8 @@ int sf_open(const char* filename, int flags, int convFlags, int mode) {
Future<Reference<class IAsyncFile>> Sim2FileSystem::open(const std::string& filename, int64_t flags, int64_t mode) {
ASSERT((flags & IAsyncFile::OPEN_ATOMIC_WRITE_AND_CREATE) || !(flags & IAsyncFile::OPEN_CREATE) ||
StringRef(filename).endsWith(
LiteralStringRef(".fdb-lock"))); // We don't use "ordinary" non-atomic file creation right now except for
// folder locking, and we don't have code to simulate its unsafeness.
".fdb-lock"_sr)); // We don't use "ordinary" non-atomic file creation right now except for
// folder locking, and we don't have code to simulate its unsafeness.
if ((flags & IAsyncFile::OPEN_EXCLUSIVE))
ASSERT(flags & IAsyncFile::OPEN_CREATE);

View File

@ -185,7 +185,7 @@ TEST_CASE("/BackupProgress/Unfinished") {
const Tag tag1(tagLocalityLogRouter, 0);
epochInfos.insert({ epoch1, ILogSystem::EpochTagsVersionsInfo(1, begin1, end1) });
BackupProgress progress(UID(0, 0), epochInfos);
progress.setBackupStartedValue(Optional<Value>(LiteralStringRef("1")));
progress.setBackupStartedValue(Optional<Value>("1"_sr));
std::map<std::tuple<LogEpoch, Version, int>, std::map<Tag, Version>> unfinished = progress.getUnfinishedBackup();

View File

@ -1069,7 +1069,7 @@ ACTOR static Future<Void> monitorWorkerPause(BackupData* self) {
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Optional<Value> value = wait(tr->get(backupPausedKey));
bool paused = value.present() && value.get() == LiteralStringRef("1");
bool paused = value.present() && value.get() == "1"_sr;
if (self->paused.get() != paused) {
TraceEvent(paused ? "BackupWorkerPaused" : "BackupWorkerResumed", self->myId).log();
self->paused.set(paused);

View File

@ -131,7 +131,7 @@ ACTOR Future<ForcedPurgeState> getForcePurgedState(Transaction* tr, KeyRange key
ASSERT(values[0].value != values[1].value);
return ForcedPurgeState::SomePurged;
} else {
return values[0].value == LiteralStringRef("1") ? ForcedPurgeState::AllPurged : ForcedPurgeState::NonePurged;
return values[0].value == "1"_sr ? ForcedPurgeState::AllPurged : ForcedPurgeState::NonePurged;
}
}

View File

@ -3290,7 +3290,7 @@ ACTOR Future<Void> loadForcePurgedRanges(Reference<BlobManagerData> bmData) {
// Add the mappings to our in memory key range map
for (int rangeIdx = 0; rangeIdx < results.size() - 1; rangeIdx++) {
if (results[rangeIdx].value == LiteralStringRef("1")) {
if (results[rangeIdx].value == "1"_sr) {
Key rangeStartKey = results[rangeIdx].key.removePrefix(blobGranuleForcePurgedKeys.begin);
Key rangeEndKey = results[rangeIdx + 1].key.removePrefix(blobGranuleForcePurgedKeys.begin);
// note: if the old owner is dead, we handle this in rangeAssigner
@ -3474,7 +3474,7 @@ ACTOR Future<Void> recoverBlobManager(Reference<BlobManagerData> bmData) {
break;
}
wait(checkManagerLock(tr, bmData));
wait(krmSetRange(tr, blobGranuleForcePurgedKeys.begin, normalKeys, LiteralStringRef("0")));
wait(krmSetRange(tr, blobGranuleForcePurgedKeys.begin, normalKeys, "0"_sr));
wait(tr->commit());
tr->reset();
break;
@ -4462,8 +4462,7 @@ ACTOR Future<Void> purgeRange(Reference<BlobManagerData> self, KeyRangeRef range
wait(checkManagerLock(&tr, self));
// FIXME: need to handle this better if range is unaligned. Need to not truncate existing granules, and
// instead cover whole of intersecting granules at begin/end
wait(krmSetRangeCoalescing(
&tr, blobGranuleForcePurgedKeys.begin, range, normalKeys, LiteralStringRef("1")));
wait(krmSetRangeCoalescing(&tr, blobGranuleForcePurgedKeys.begin, range, normalKeys, "1"_sr));
wait(tr.commit());
break;
} catch (Error& e) {
@ -5278,10 +5277,10 @@ TEST_CASE("/blobmanager/updateranges") {
RangeResult dbDataEmpty;
std::vector<std::pair<KeyRangeRef, bool>> kbrRanges;
StringRef keyA = StringRef(ar, LiteralStringRef("A"));
StringRef keyB = StringRef(ar, LiteralStringRef("B"));
StringRef keyC = StringRef(ar, LiteralStringRef("C"));
StringRef keyD = StringRef(ar, LiteralStringRef("D"));
StringRef keyA = StringRef(ar, "A"_sr);
StringRef keyB = StringRef(ar, "B"_sr);
StringRef keyC = StringRef(ar, "C"_sr);
StringRef keyD = StringRef(ar, "D"_sr);
// db data setup
RangeResult dbDataAB;

View File

@ -303,7 +303,7 @@ ACTOR Future<Void> clusterWatchDatabase(ClusterControllerData* cluster,
db->serverInfo->get().masterLifetime,
coordinators,
db->serverInfo->get().clusterInterface,
LiteralStringRef(""),
""_sr,
addActor,
db->forceRecovery);
@ -1355,7 +1355,7 @@ ACTOR Future<Void> registerWorker(RegisterWorkerRequest req,
return Void();
}
#define TIME_KEEPER_VERSION LiteralStringRef("1")
#define TIME_KEEPER_VERSION "1"_sr
ACTOR Future<Void> timeKeeperSetVersion(ClusterControllerData* self) {
state Reference<ReadYourWritesTransaction> tr = makeReference<ReadYourWritesTransaction>(self->cx);
@ -2508,7 +2508,7 @@ ACTOR Future<Void> watchBlobGranulesConfigKey(ClusterControllerData* self) {
Optional<Value> blobConfig = wait(tr->get(blobGranuleConfigKey));
if (blobConfig.present()) {
self->db.blobGranulesEnabled.set(blobConfig.get() == LiteralStringRef("1"));
self->db.blobGranulesEnabled.set(blobConfig.get() == "1"_sr);
}
state Future<Void> watch = tr->watch(blobGranuleConfigKey);

View File

@ -1301,7 +1301,7 @@ void updateConfigForForcedRecovery(Reference<ClusterRecoveryData> self,
Standalone<CommitTransactionRef> regionCommit;
regionCommit.mutations.push_back_deep(
regionCommit.arena(),
MutationRef(MutationRef::SetValue, configKeysPrefix.toString() + "usable_regions", LiteralStringRef("1")));
MutationRef(MutationRef::SetValue, configKeysPrefix.toString() + "usable_regions", "1"_sr));
self->configuration.applyMutation(regionCommit.mutations.back());
if (regionsChanged) {
std::sort(

View File

@ -445,7 +445,7 @@ void createWhitelistBinPathVec(const std::string& binPath, std::vector<Standalon
TraceEvent(SevDebug, "BinPathConverter").detail("Input", binPath);
StringRef input(binPath);
while (input != StringRef()) {
StringRef token = input.eat(LiteralStringRef(","));
StringRef token = input.eat(","_sr);
if (token != StringRef()) {
const uint8_t* ptr = token.begin();
while (ptr != token.end() && *ptr == ' ') {
@ -768,8 +768,8 @@ bool canReject(const std::vector<CommitTransactionRequest>& trs) {
for (const auto& tr : trs) {
if (tr.transaction.mutations.empty())
continue;
if (!tr.tenantInfo.name.present() && (tr.transaction.mutations[0].param1.startsWith(LiteralStringRef("\xff")) ||
tr.transaction.read_conflict_ranges.empty())) {
if (!tr.tenantInfo.name.present() &&
(tr.transaction.mutations[0].param1.startsWith("\xff"_sr) || tr.transaction.read_conflict_ranges.empty())) {
return false;
}
}
@ -2229,9 +2229,7 @@ ACTOR Future<Void> proxySnapCreate(ProxySnapRequest snapReq, ProxyCommitData* co
throw snap_not_fully_recovered_unsupported();
}
auto result =
commitData->txnStateStore->readValue(LiteralStringRef("log_anti_quorum").withPrefix(configKeysPrefix))
.get();
auto result = commitData->txnStateStore->readValue("log_anti_quorum"_sr.withPrefix(configKeysPrefix)).get();
int logAntiQuorum = 0;
if (result.present()) {
logAntiQuorum = atoi(result.get().toString().c_str());
@ -2572,10 +2570,8 @@ ACTOR Future<Void> commitProxyServerCore(CommitProxyInterface proxy,
commitData.localTLogCount = commitData.db->get().logSystemConfig.numLogs();
ASSERT(commitData.resolvers.size() != 0);
for (int i = 0; i < commitData.resolvers.size(); ++i) {
commitData.stats.resolverDist.push_back(
Histogram::getHistogram(LiteralStringRef("CommitProxy"),
"ToResolver_" + commitData.resolvers[i].id().toString(),
Histogram::Unit::microseconds));
commitData.stats.resolverDist.push_back(Histogram::getHistogram(
"CommitProxy"_sr, "ToResolver_" + commitData.resolvers[i].id().toString(), Histogram::Unit::microseconds));
}
// Initialize keyResolvers map

View File

@ -188,8 +188,8 @@ TEST_CASE("/fdbserver/Coordination/localGenerationReg/simple") {
}
{
UniqueGeneration g = wait(
reg.write.getReply(GenerationRegWriteRequest(KeyValueRef(the_key, LiteralStringRef("Value1")), firstGen)));
UniqueGeneration g =
wait(reg.write.getReply(GenerationRegWriteRequest(KeyValueRef(the_key, "Value1"_sr), firstGen)));
// (gen1==gen is considered a "successful" write)
ASSERT(g == firstGen);
}
@ -198,7 +198,7 @@ TEST_CASE("/fdbserver/Coordination/localGenerationReg/simple") {
GenerationRegReadReply r = wait(reg.read.getReply(GenerationRegReadRequest(the_key, UniqueGeneration())));
// read(key,gen2) returns (value,gen,rgen).
// There was some earlier or concurrent write(key,value,gen).
ASSERT(r.value == LiteralStringRef("Value1"));
ASSERT(r.value == "Value1"_sr);
ASSERT(r.gen == firstGen);
// There was some earlier or concurrent read(key,rgen).
ASSERT(r.rgen == firstGen);

View File

@ -5174,9 +5174,9 @@ public:
UID uid(id, 0);
StorageServerInterface interface;
interface.uniqueID = uid;
interface.locality.set(LiteralStringRef("machineid"), Standalone<StringRef>(std::to_string(id)));
interface.locality.set(LiteralStringRef("zoneid"), Standalone<StringRef>(std::to_string(id % 5)));
interface.locality.set(LiteralStringRef("data_hall"), Standalone<StringRef>(std::to_string(id % 3)));
interface.locality.set("machineid"_sr, Standalone<StringRef>(std::to_string(id)));
interface.locality.set("zoneid"_sr, Standalone<StringRef>(std::to_string(id % 5)));
interface.locality.set("data_hall"_sr, Standalone<StringRef>(std::to_string(id % 3)));
collection->server_info[uid] = makeReference<TCServerInfo>(
interface, collection.get(), ProcessClass(), true, collection->storageServerSet);
collection->server_status.set(uid, ServerStatus(false, false, false, interface.locality));
@ -5229,11 +5229,11 @@ public:
zone_id,
machine_id,
interface.address().toString().c_str());
interface.locality.set(LiteralStringRef("processid"), Standalone<StringRef>(std::to_string(process_id)));
interface.locality.set(LiteralStringRef("machineid"), Standalone<StringRef>(std::to_string(machine_id)));
interface.locality.set(LiteralStringRef("zoneid"), Standalone<StringRef>(std::to_string(zone_id)));
interface.locality.set(LiteralStringRef("data_hall"), Standalone<StringRef>(std::to_string(data_hall_id)));
interface.locality.set(LiteralStringRef("dcid"), Standalone<StringRef>(std::to_string(dc_id)));
interface.locality.set("processid"_sr, Standalone<StringRef>(std::to_string(process_id)));
interface.locality.set("machineid"_sr, Standalone<StringRef>(std::to_string(machine_id)));
interface.locality.set("zoneid"_sr, Standalone<StringRef>(std::to_string(zone_id)));
interface.locality.set("data_hall"_sr, Standalone<StringRef>(std::to_string(data_hall_id)));
interface.locality.set("dcid"_sr, Standalone<StringRef>(std::to_string(dc_id)));
collection->server_info[uid] = makeReference<TCServerInfo>(
interface, collection.get(), ProcessClass(), true, collection->storageServerSet);

View File

@ -882,8 +882,7 @@ ACTOR Future<std::map<NetworkAddress, std::pair<WorkerInterface, std::string>>>
workersMap[worker.interf.address()] = worker.interf;
}
Optional<Value> regionsValue =
wait(tr.get(LiteralStringRef("usable_regions").withPrefix(configKeysPrefix)));
Optional<Value> regionsValue = wait(tr.get("usable_regions"_sr.withPrefix(configKeysPrefix)));
int usableRegions = 1;
if (regionsValue.present()) {
usableRegions = atoi(regionsValue.get().toString().c_str());

View File

@ -193,7 +193,7 @@ public:
memset(firstPages[0], 0xFF, sizeof(Page));
firstPages[1] = (Page*)((uintptr_t)firstPages[0] + 4096);
memset(firstPages[1], 0xFF, sizeof(Page));
stallCount.init(LiteralStringRef("RawDiskQueue.StallCount"));
stallCount.init("RawDiskQueue.StallCount"_sr);
}
Future<Void> pushAndCommit(StringRef pageData, StringBuffer* pageMem, uint64_t poppedPages) {

View File

@ -75,7 +75,7 @@ VectorRef<StringRef> ExecCmdValueString::getBinaryArgs() const {
void ExecCmdValueString::parseCmdValue() {
StringRef param = this->cmdValueString;
// get the binary path
this->binaryPath = param.eat(LiteralStringRef(" "));
this->binaryPath = param.eat(" "_sr);
// no arguments provided
if (param == StringRef()) {
@ -84,7 +84,7 @@ void ExecCmdValueString::parseCmdValue() {
// extract the arguments
while (param != StringRef()) {
StringRef token = param.eat(LiteralStringRef(" "));
StringRef token = param.eat(" "_sr);
this->binaryArgs.push_back(this->binaryArgs.arena(), token);
}
return;

View File

@ -130,12 +130,10 @@ struct GrvProxyStats {
SERVER_KNOBS->LATENCY_SAMPLE_SIZE),
recentRequests(0), lastBucketBegin(now()),
bucketInterval(FLOW_KNOBS->BASIC_LOAD_BALANCE_UPDATE_RATE / FLOW_KNOBS->BASIC_LOAD_BALANCE_BUCKETS),
grvConfirmEpochLiveDist(Histogram::getHistogram(LiteralStringRef("GrvProxy"),
LiteralStringRef("GrvConfirmEpochLive"),
Histogram::Unit::microseconds)),
grvGetCommittedVersionRpcDist(Histogram::getHistogram(LiteralStringRef("GrvProxy"),
LiteralStringRef("GrvGetCommittedVersionRpc"),
Histogram::Unit::microseconds)) {
grvConfirmEpochLiveDist(
Histogram::getHistogram("GrvProxy"_sr, "GrvConfirmEpochLive"_sr, Histogram::Unit::microseconds)),
grvGetCommittedVersionRpcDist(
Histogram::getHistogram("GrvProxy"_sr, "GrvGetCommittedVersionRpc"_sr, Histogram::Unit::microseconds)) {
// The rate at which the limit(budget) is allowed to grow.
specialCounter(cc, "SystemGRVQueueSize", [this]() { return this->systemGRVQueueSize; });
specialCounter(cc, "DefaultGRVQueueSize", [this]() { return this->defaultGRVQueueSize; });

View File

@ -119,12 +119,12 @@ private:
// If the value starts with a 0-byte, then we don't compress it
if (c == 0)
return val.withPrefix(LiteralStringRef("\x00"));
return val.withPrefix("\x00"_sr);
for (int i = 1; i < val.size(); i++) {
if (val[i] != c) {
// The value is something other than a single repeated character, so not compressible :-)
return val.withPrefix(LiteralStringRef("\x00"));
return val.withPrefix("\x00"_sr);
}
}

View File

@ -500,7 +500,7 @@ private:
log->push(StringRef((const uint8_t*)&cipherHeader, BlobCipherEncryptHeader::headerSize));
log->push(ciphertext);
}
return log->push(LiteralStringRef("\x01")); // Changes here should be reflected in OP_DISK_OVERHEAD
return log->push("\x01"_sr); // Changes here should be reflected in OP_DISK_OVERHEAD
}
// In case the op data is not encrypted, simply read the operands and the zero fill flag.
@ -830,7 +830,7 @@ private:
auto thisSnapshotEnd = self->log_op(OpSnapshotEnd, StringRef(), StringRef());
//TraceEvent("SnapshotEnd", self->id)
// .detail("LastKey", lastKey.present() ? lastKey.get() : LiteralStringRef("<none>"))
// .detail("LastKey", lastKey.present() ? lastKey.get() : "<none>"_sr)
// .detail("CurrentSnapshotEndLoc", self->currentSnapshotEnd)
// .detail("PreviousSnapshotEndLoc", self->previousSnapshotEnd)
// .detail("ThisSnapshotEnd", thisSnapshotEnd)

View File

@ -259,24 +259,24 @@ using CF = rocksdb::ColumnFamilyHandle*;
#define PERSIST_PREFIX "\xff\xff"
const KeyRef persistVersion = LiteralStringRef(PERSIST_PREFIX "Version");
const StringRef ROCKSDBSTORAGE_HISTOGRAM_GROUP = LiteralStringRef("RocksDBStorage");
const StringRef ROCKSDB_COMMIT_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBCommitLatency");
const StringRef ROCKSDB_COMMIT_ACTION_HISTOGRAM = LiteralStringRef("RocksDBCommitAction");
const StringRef ROCKSDB_COMMIT_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBCommitQueueWait");
const StringRef ROCKSDB_WRITE_HISTOGRAM = LiteralStringRef("RocksDBWrite");
const StringRef ROCKSDB_DELETE_COMPACTRANGE_HISTOGRAM = LiteralStringRef("RocksDBDeleteCompactRange");
const StringRef ROCKSDB_READRANGE_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadRangeLatency");
const StringRef ROCKSDB_READVALUE_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadValueLatency");
const StringRef ROCKSDB_READPREFIX_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixLatency");
const StringRef ROCKSDB_READRANGE_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadRangeAction");
const StringRef ROCKSDB_READVALUE_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadValueAction");
const StringRef ROCKSDB_READPREFIX_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixAction");
const StringRef ROCKSDB_READRANGE_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadRangeQueueWait");
const StringRef ROCKSDB_READVALUE_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadValueQueueWait");
const StringRef ROCKSDB_READPREFIX_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixQueueWait");
const StringRef ROCKSDB_READRANGE_NEWITERATOR_HISTOGRAM = LiteralStringRef("RocksDBReadRangeNewIterator");
const StringRef ROCKSDB_READVALUE_GET_HISTOGRAM = LiteralStringRef("RocksDBReadValueGet");
const StringRef ROCKSDB_READPREFIX_GET_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixGet");
const StringRef ROCKSDBSTORAGE_HISTOGRAM_GROUP = "RocksDBStorage"_sr;
const StringRef ROCKSDB_COMMIT_LATENCY_HISTOGRAM = "RocksDBCommitLatency"_sr;
const StringRef ROCKSDB_COMMIT_ACTION_HISTOGRAM = "RocksDBCommitAction"_sr;
const StringRef ROCKSDB_COMMIT_QUEUEWAIT_HISTOGRAM = "RocksDBCommitQueueWait"_sr;
const StringRef ROCKSDB_WRITE_HISTOGRAM = "RocksDBWrite"_sr;
const StringRef ROCKSDB_DELETE_COMPACTRANGE_HISTOGRAM = "RocksDBDeleteCompactRange"_sr;
const StringRef ROCKSDB_READRANGE_LATENCY_HISTOGRAM = "RocksDBReadRangeLatency"_sr;
const StringRef ROCKSDB_READVALUE_LATENCY_HISTOGRAM = "RocksDBReadValueLatency"_sr;
const StringRef ROCKSDB_READPREFIX_LATENCY_HISTOGRAM = "RocksDBReadPrefixLatency"_sr;
const StringRef ROCKSDB_READRANGE_ACTION_HISTOGRAM = "RocksDBReadRangeAction"_sr;
const StringRef ROCKSDB_READVALUE_ACTION_HISTOGRAM = "RocksDBReadValueAction"_sr;
const StringRef ROCKSDB_READPREFIX_ACTION_HISTOGRAM = "RocksDBReadPrefixAction"_sr;
const StringRef ROCKSDB_READRANGE_QUEUEWAIT_HISTOGRAM = "RocksDBReadRangeQueueWait"_sr;
const StringRef ROCKSDB_READVALUE_QUEUEWAIT_HISTOGRAM = "RocksDBReadValueQueueWait"_sr;
const StringRef ROCKSDB_READPREFIX_QUEUEWAIT_HISTOGRAM = "RocksDBReadPrefixQueueWait"_sr;
const StringRef ROCKSDB_READRANGE_NEWITERATOR_HISTOGRAM = "RocksDBReadRangeNewIterator"_sr;
const StringRef ROCKSDB_READVALUE_GET_HISTOGRAM = "RocksDBReadValueGet"_sr;
const StringRef ROCKSDB_READPREFIX_GET_HISTOGRAM = "RocksDBReadPrefixGet"_sr;
rocksdb::ExportImportFilesMetaData getMetaData(const CheckpointMetaData& checkpoint) {
rocksdb::ExportImportFilesMetaData metaData;
@ -2314,11 +2314,11 @@ TEST_CASE("noSim/fdbserver/KeyValueStoreRocksDB/RocksDBReopen") {
state IKeyValueStore* kvStore = new RocksDBKeyValueStore(rocksDBTestDir, deterministicRandom()->randomUniqueID());
wait(kvStore->init());
kvStore->set({ LiteralStringRef("foo"), LiteralStringRef("bar") });
kvStore->set({ "foo"_sr, "bar"_sr });
wait(kvStore->commit(false));
Optional<Value> val = wait(kvStore->readValue(LiteralStringRef("foo")));
ASSERT(Optional<Value>(LiteralStringRef("bar")) == val);
Optional<Value> val = wait(kvStore->readValue("foo"_sr));
ASSERT(Optional<Value>("bar"_sr) == val);
Future<Void> closed = kvStore->onClosed();
kvStore->close();
@ -2329,8 +2329,8 @@ TEST_CASE("noSim/fdbserver/KeyValueStoreRocksDB/RocksDBReopen") {
// Confirm that `init()` is idempotent.
wait(kvStore->init());
Optional<Value> val = wait(kvStore->readValue(LiteralStringRef("foo")));
ASSERT(Optional<Value>(LiteralStringRef("bar")) == val);
Optional<Value> val = wait(kvStore->readValue("foo"_sr));
ASSERT(Optional<Value>("bar"_sr) == val);
Future<Void> closed = kvStore->onClosed();
kvStore->dispose();
@ -2348,11 +2348,11 @@ TEST_CASE("noSim/fdbserver/KeyValueStoreRocksDB/CheckpointRestoreColumnFamily")
state IKeyValueStore* kvStore = new RocksDBKeyValueStore(rocksDBTestDir, deterministicRandom()->randomUniqueID());
wait(kvStore->init());
kvStore->set({ LiteralStringRef("foo"), LiteralStringRef("bar") });
kvStore->set({ "foo"_sr, "bar"_sr });
wait(kvStore->commit(false));
Optional<Value> val = wait(kvStore->readValue(LiteralStringRef("foo")));
ASSERT(Optional<Value>(LiteralStringRef("bar")) == val);
Optional<Value> val = wait(kvStore->readValue("foo"_sr));
ASSERT(Optional<Value>("bar"_sr) == val);
state std::string rocksDBRestoreDir = "rocksdb-kvstore-br-restore-db";
platform::eraseDirectoryRecursive(rocksDBRestoreDir);
@ -2372,8 +2372,8 @@ TEST_CASE("noSim/fdbserver/KeyValueStoreRocksDB/CheckpointRestoreColumnFamily")
checkpoints.push_back(metaData);
wait(kvStoreCopy->restore(checkpoints));
Optional<Value> val = wait(kvStoreCopy->readValue(LiteralStringRef("foo")));
ASSERT(Optional<Value>(LiteralStringRef("bar")) == val);
Optional<Value> val = wait(kvStoreCopy->readValue("foo"_sr));
ASSERT(Optional<Value>("bar"_sr) == val);
std::vector<Future<Void>> closes;
closes.push_back(kvStore->onClosed());
@ -2395,10 +2395,10 @@ TEST_CASE("noSim/fdbserver/KeyValueStoreRocksDB/CheckpointRestoreKeyValues") {
state IKeyValueStore* kvStore = new RocksDBKeyValueStore(rocksDBTestDir, deterministicRandom()->randomUniqueID());
wait(kvStore->init());
kvStore->set({ LiteralStringRef("foo"), LiteralStringRef("bar") });
kvStore->set({ "foo"_sr, "bar"_sr });
wait(kvStore->commit(false));
Optional<Value> val = wait(kvStore->readValue(LiteralStringRef("foo")));
ASSERT(Optional<Value>(LiteralStringRef("bar")) == val);
Optional<Value> val = wait(kvStore->readValue("foo"_sr));
ASSERT(Optional<Value>("bar"_sr) == val);
platform::eraseDirectoryRecursive("checkpoint");
std::string checkpointDir = cwd + "checkpoint";

View File

@ -1333,7 +1333,7 @@ int SQLiteDB::checkAllPageChecksums() {
// then we could instead open a read cursor for the same effect, as currently tryReadEveryDbPage() requires it.
Statement* jm = new Statement(*this, "PRAGMA journal_mode");
ASSERT(jm->nextRow());
if (jm->column(0) != LiteralStringRef("wal")) {
if (jm->column(0) != "wal"_sr) {
TraceEvent(SevError, "JournalModeError").detail("Filename", filename).detail("Mode", jm->column(0));
ASSERT(false);
}
@ -1502,7 +1502,7 @@ void SQLiteDB::open(bool writable) {
Statement jm(*this, "PRAGMA journal_mode");
ASSERT(jm.nextRow());
if (jm.column(0) != LiteralStringRef("wal")) {
if (jm.column(0) != "wal"_sr) {
TraceEvent(SevError, "JournalModeError").detail("Filename", filename).detail("Mode", jm.column(0));
ASSERT(false);
}
@ -2287,9 +2287,9 @@ ACTOR Future<Void> KVFileCheck(std::string filename, bool integrity) {
StringRef kvFile(filename);
KeyValueStoreType type = KeyValueStoreType::END;
if (kvFile.endsWith(LiteralStringRef(".fdb")))
if (kvFile.endsWith(".fdb"_sr))
type = KeyValueStoreType::SSD_BTREE_V1;
else if (kvFile.endsWith(LiteralStringRef(".sqlite")))
else if (kvFile.endsWith(".sqlite"_sr))
type = KeyValueStoreType::SSD_BTREE_V2;
ASSERT(type != KeyValueStoreType::END);

View File

@ -48,26 +48,26 @@ static_assert((ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 27) ? ROCKSDB_PATCH >= 3 :
"Unsupported rocksdb version. Update the rocksdb to 6.27.3 version");
const std::string rocksDataFolderSuffix = "-data";
const KeyRef shardMappingPrefix(LiteralStringRef("\xff\xff/ShardMapping/"));
const KeyRef shardMappingPrefix("\xff\xff/ShardMapping/"_sr);
// TODO: move constants to a header file.
const StringRef ROCKSDBSTORAGE_HISTOGRAM_GROUP = LiteralStringRef("RocksDBStorage");
const StringRef ROCKSDB_COMMIT_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBCommitLatency");
const StringRef ROCKSDB_COMMIT_ACTION_HISTOGRAM = LiteralStringRef("RocksDBCommitAction");
const StringRef ROCKSDB_COMMIT_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBCommitQueueWait");
const StringRef ROCKSDB_WRITE_HISTOGRAM = LiteralStringRef("RocksDBWrite");
const StringRef ROCKSDB_DELETE_COMPACTRANGE_HISTOGRAM = LiteralStringRef("RocksDBDeleteCompactRange");
const StringRef ROCKSDB_READRANGE_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadRangeLatency");
const StringRef ROCKSDB_READVALUE_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadValueLatency");
const StringRef ROCKSDB_READPREFIX_LATENCY_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixLatency");
const StringRef ROCKSDB_READRANGE_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadRangeAction");
const StringRef ROCKSDB_READVALUE_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadValueAction");
const StringRef ROCKSDB_READPREFIX_ACTION_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixAction");
const StringRef ROCKSDB_READRANGE_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadRangeQueueWait");
const StringRef ROCKSDB_READVALUE_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadValueQueueWait");
const StringRef ROCKSDB_READPREFIX_QUEUEWAIT_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixQueueWait");
const StringRef ROCKSDB_READRANGE_NEWITERATOR_HISTOGRAM = LiteralStringRef("RocksDBReadRangeNewIterator");
const StringRef ROCKSDB_READVALUE_GET_HISTOGRAM = LiteralStringRef("RocksDBReadValueGet");
const StringRef ROCKSDB_READPREFIX_GET_HISTOGRAM = LiteralStringRef("RocksDBReadPrefixGet");
const StringRef ROCKSDBSTORAGE_HISTOGRAM_GROUP = "RocksDBStorage"_sr;
const StringRef ROCKSDB_COMMIT_LATENCY_HISTOGRAM = "RocksDBCommitLatency"_sr;
const StringRef ROCKSDB_COMMIT_ACTION_HISTOGRAM = "RocksDBCommitAction"_sr;
const StringRef ROCKSDB_COMMIT_QUEUEWAIT_HISTOGRAM = "RocksDBCommitQueueWait"_sr;
const StringRef ROCKSDB_WRITE_HISTOGRAM = "RocksDBWrite"_sr;
const StringRef ROCKSDB_DELETE_COMPACTRANGE_HISTOGRAM = "RocksDBDeleteCompactRange"_sr;
const StringRef ROCKSDB_READRANGE_LATENCY_HISTOGRAM = "RocksDBReadRangeLatency"_sr;
const StringRef ROCKSDB_READVALUE_LATENCY_HISTOGRAM = "RocksDBReadValueLatency"_sr;
const StringRef ROCKSDB_READPREFIX_LATENCY_HISTOGRAM = "RocksDBReadPrefixLatency"_sr;
const StringRef ROCKSDB_READRANGE_ACTION_HISTOGRAM = "RocksDBReadRangeAction"_sr;
const StringRef ROCKSDB_READVALUE_ACTION_HISTOGRAM = "RocksDBReadValueAction"_sr;
const StringRef ROCKSDB_READPREFIX_ACTION_HISTOGRAM = "RocksDBReadPrefixAction"_sr;
const StringRef ROCKSDB_READRANGE_QUEUEWAIT_HISTOGRAM = "RocksDBReadRangeQueueWait"_sr;
const StringRef ROCKSDB_READVALUE_QUEUEWAIT_HISTOGRAM = "RocksDBReadValueQueueWait"_sr;
const StringRef ROCKSDB_READPREFIX_QUEUEWAIT_HISTOGRAM = "RocksDBReadPrefixQueueWait"_sr;
const StringRef ROCKSDB_READRANGE_NEWITERATOR_HISTOGRAM = "RocksDBReadRangeNewIterator"_sr;
const StringRef ROCKSDB_READVALUE_GET_HISTOGRAM = "RocksDBReadValueGet"_sr;
const StringRef ROCKSDB_READPREFIX_GET_HISTOGRAM = "RocksDBReadPrefixGet"_sr;
namespace {
struct PhysicalShard;

View File

@ -137,9 +137,7 @@ struct LogRouterData {
: dbgid(dbgid), logSystem(new AsyncVar<Reference<ILogSystem>>()), version(req.startVersion - 1), minPopped(0),
startVersion(req.startVersion), minKnownCommittedVersion(0), poppedVersion(0), routerTag(req.routerTag),
allowPops(false), foundEpochEnd(false), generation(req.recoveryCount),
peekLatencyDist(Histogram::getHistogram(LiteralStringRef("LogRouter"),
LiteralStringRef("PeekTLogLatency"),
Histogram::Unit::microseconds)),
peekLatencyDist(Histogram::getHistogram("LogRouter"_sr, "PeekTLogLatency"_sr, Histogram::Unit::microseconds)),
cc("LogRouter", dbgid.toString()), getMoreCount("GetMoreCount", cc),
getMoreBlockedCount("GetMoreBlockedCount", cc) {
// setup just enough of a logSet to be able to call getPushLocations

View File

@ -90,12 +90,10 @@ struct MetricsRule {
struct MetricsConfig {
MetricsConfig(Key prefix = KeyRef())
: space(prefix), ruleMap(space.get(LiteralStringRef("Rules")).key()),
addressMap(space.get(LiteralStringRef("Enum")).get(LiteralStringRef("Address")).key()),
nameAndTypeMap(space.get(LiteralStringRef("Enum")).get(LiteralStringRef("NameType")).key()),
ruleChangeKey(space.get(LiteralStringRef("RulesChanged")).key()),
enumsChangeKey(space.get(LiteralStringRef("EnumsChanged")).key()),
fieldChangeKey(space.get(LiteralStringRef("FieldsChanged")).key()) {}
: space(prefix), ruleMap(space.get("Rules"_sr).key()), addressMap(space.get("Enum"_sr).get("Address"_sr).key()),
nameAndTypeMap(space.get("Enum"_sr).get("NameType"_sr).key()),
ruleChangeKey(space.get("RulesChanged"_sr).key()), enumsChangeKey(space.get("EnumsChanged"_sr).key()),
fieldChangeKey(space.get("FieldsChanged"_sr).key()) {}
Subspace space;
@ -419,7 +417,7 @@ TEST_CASE("/fdbserver/metrics/TraceEvents") {
fprintf(stdout, "Using environment variables METRICS_CONNFILE and METRICS_PREFIX.\n");
state Database metricsDb = Database::createDatabase(metricsConnFile, ApiVersion::LATEST_VERSION);
TDMetricCollection::getTDMetrics()->address = LiteralStringRef("0.0.0.0:0");
TDMetricCollection::getTDMetrics()->address = "0.0.0.0:0"_sr;
state Future<Void> metrics = runMetrics(metricsDb, KeyRef(metricsPrefix));
state int64_t x = 0;
@ -438,9 +436,9 @@ TEST_CASE("/fdbserver/metrics/TraceEvents") {
fprintf(stdout, " d is always present, is a string, and rotates through the values 'one', 'two', and ''.\n");
fprintf(stdout, " Plotting j on the x axis and k on the y axis should look like x=sin(2t), y=sin(3t)\n");
state Int64MetricHandle intMetric = Int64MetricHandle(LiteralStringRef("DummyInt"));
state BoolMetricHandle boolMetric = BoolMetricHandle(LiteralStringRef("DummyBool"));
state StringMetricHandle stringMetric = StringMetricHandle(LiteralStringRef("DummyString"));
state Int64MetricHandle intMetric = Int64MetricHandle("DummyInt"_sr);
state BoolMetricHandle boolMetric = BoolMetricHandle("DummyBool"_sr);
state StringMetricHandle stringMetric = StringMetricHandle("DummyString"_sr);
static const char* dStrings[] = { "one", "two", "" };
state const char** d = dStrings;

View File

@ -221,17 +221,14 @@ private:
////// Persistence format (for self->persistentData)
// Immutable keys
static const KeyValueRef persistFormat(LiteralStringRef("Format"), LiteralStringRef("FoundationDB/LogServer/2/3"));
static const KeyRangeRef persistFormatReadableRange(LiteralStringRef("FoundationDB/LogServer/2/3"),
LiteralStringRef("FoundationDB/LogServer/2/4"));
static const KeyRangeRef persistRecoveryCountKeys =
KeyRangeRef(LiteralStringRef("DbRecoveryCount/"), LiteralStringRef("DbRecoveryCount0"));
static const KeyValueRef persistFormat("Format"_sr, "FoundationDB/LogServer/2/3"_sr);
static const KeyRangeRef persistFormatReadableRange("FoundationDB/LogServer/2/3"_sr, "FoundationDB/LogServer/2/4"_sr);
static const KeyRangeRef persistRecoveryCountKeys = KeyRangeRef("DbRecoveryCount/"_sr, "DbRecoveryCount0"_sr);
// Updated on updatePersistentData()
static const KeyRangeRef persistCurrentVersionKeys =
KeyRangeRef(LiteralStringRef("version/"), LiteralStringRef("version0"));
static const KeyRange persistTagMessagesKeys = prefixRange(LiteralStringRef("TagMsg/"));
static const KeyRange persistTagPoppedKeys = prefixRange(LiteralStringRef("TagPop/"));
static const KeyRangeRef persistCurrentVersionKeys = KeyRangeRef("version/"_sr, "version0"_sr);
static const KeyRange persistTagMessagesKeys = prefixRange("TagMsg/"_sr);
static const KeyRange persistTagPoppedKeys = prefixRange("TagPop/"_sr);
static Key persistTagMessagesKey(UID id, OldTag tag, Version version) {
BinaryWriter wr(Unversioned());
@ -450,10 +447,10 @@ struct LogData : NonCopyable, public ReferenceCounted<LogData> {
"Restored");
addActor.send(traceRole(Role::TRANSACTION_LOG, interf.id()));
persistentDataVersion.init(LiteralStringRef("TLog.PersistentDataVersion"), cc.id);
persistentDataDurableVersion.init(LiteralStringRef("TLog.PersistentDataDurableVersion"), cc.id);
version.initMetric(LiteralStringRef("TLog.Version"), cc.id);
queueCommittedVersion.initMetric(LiteralStringRef("TLog.QueueCommittedVersion"), cc.id);
persistentDataVersion.init("TLog.PersistentDataVersion"_sr, cc.id);
persistentDataDurableVersion.init("TLog.PersistentDataDurableVersion"_sr, cc.id);
version.initMetric("TLog.Version"_sr, cc.id);
queueCommittedVersion.initMetric("TLog.QueueCommittedVersion"_sr, cc.id);
specialCounter(cc, "Version", [this]() { return this->version.get(); });
specialCounter(cc, "SharedBytesInput", [tLogData]() { return tLogData->bytesInput; });
@ -1463,7 +1460,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self, LocalityData locality)
}
if (!fFormat.get().present()) {
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1));
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), "\xff"_sr), 1));
if (!v.size()) {
CODE_PROBE(true, "The DB is completely empty, so it was never initialized. Delete it.");
throw worker_removed();

View File

@ -187,24 +187,18 @@ private:
////// Persistence format (for self->persistentData)
// Immutable keys
static const KeyValueRef persistFormat(LiteralStringRef("Format"), LiteralStringRef("FoundationDB/LogServer/2/4"));
static const KeyRangeRef persistFormatReadableRange(LiteralStringRef("FoundationDB/LogServer/2/3"),
LiteralStringRef("FoundationDB/LogServer/2/5"));
static const KeyRangeRef persistRecoveryCountKeys =
KeyRangeRef(LiteralStringRef("DbRecoveryCount/"), LiteralStringRef("DbRecoveryCount0"));
static const KeyValueRef persistFormat("Format"_sr, "FoundationDB/LogServer/2/4"_sr);
static const KeyRangeRef persistFormatReadableRange("FoundationDB/LogServer/2/3"_sr, "FoundationDB/LogServer/2/5"_sr);
static const KeyRangeRef persistRecoveryCountKeys = KeyRangeRef("DbRecoveryCount/"_sr, "DbRecoveryCount0"_sr);
// Updated on updatePersistentData()
static const KeyRangeRef persistCurrentVersionKeys =
KeyRangeRef(LiteralStringRef("version/"), LiteralStringRef("version0"));
static const KeyRangeRef persistKnownCommittedVersionKeys =
KeyRangeRef(LiteralStringRef("knownCommitted/"), LiteralStringRef("knownCommitted0"));
static const KeyRangeRef persistLocalityKeys =
KeyRangeRef(LiteralStringRef("Locality/"), LiteralStringRef("Locality0"));
static const KeyRangeRef persistLogRouterTagsKeys =
KeyRangeRef(LiteralStringRef("LogRouterTags/"), LiteralStringRef("LogRouterTags0"));
static const KeyRangeRef persistTxsTagsKeys = KeyRangeRef(LiteralStringRef("TxsTags/"), LiteralStringRef("TxsTags0"));
static const KeyRange persistTagMessagesKeys = prefixRange(LiteralStringRef("TagMsg/"));
static const KeyRange persistTagPoppedKeys = prefixRange(LiteralStringRef("TagPop/"));
static const KeyRangeRef persistCurrentVersionKeys = KeyRangeRef("version/"_sr, "version0"_sr);
static const KeyRangeRef persistKnownCommittedVersionKeys = KeyRangeRef("knownCommitted/"_sr, "knownCommitted0"_sr);
static const KeyRangeRef persistLocalityKeys = KeyRangeRef("Locality/"_sr, "Locality0"_sr);
static const KeyRangeRef persistLogRouterTagsKeys = KeyRangeRef("LogRouterTags/"_sr, "LogRouterTags0"_sr);
static const KeyRangeRef persistTxsTagsKeys = KeyRangeRef("TxsTags/"_sr, "TxsTags0"_sr);
static const KeyRange persistTagMessagesKeys = prefixRange("TagMsg/"_sr);
static const KeyRange persistTagPoppedKeys = prefixRange("TagPop/"_sr);
static Key persistTagMessagesKey(UID id, Tag tag, Version version) {
BinaryWriter wr(Unversioned());
@ -539,10 +533,10 @@ struct LogData : NonCopyable, public ReferenceCounted<LogData> {
context);
addActor.send(traceRole(Role::TRANSACTION_LOG, interf.id()));
persistentDataVersion.init(LiteralStringRef("TLog.PersistentDataVersion"), cc.id);
persistentDataDurableVersion.init(LiteralStringRef("TLog.PersistentDataDurableVersion"), cc.id);
version.initMetric(LiteralStringRef("TLog.Version"), cc.id);
queueCommittedVersion.initMetric(LiteralStringRef("TLog.QueueCommittedVersion"), cc.id);
persistentDataVersion.init("TLog.PersistentDataVersion"_sr, cc.id);
persistentDataDurableVersion.init("TLog.PersistentDataDurableVersion"_sr, cc.id);
version.initMetric("TLog.Version"_sr, cc.id);
queueCommittedVersion.initMetric("TLog.QueueCommittedVersion"_sr, cc.id);
specialCounter(cc, "Version", [this]() { return this->version.get(); });
specialCounter(cc, "QueueCommittedVersion", [this]() { return this->queueCommittedVersion.get(); });
@ -2329,7 +2323,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
}
if (!fFormat.get().present()) {
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1));
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), "\xff"_sr), 1));
if (!v.size()) {
CODE_PROBE(true, "The DB is completely empty, so it was never initialized. Delete it.");
throw worker_removed();
@ -2343,7 +2337,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
state std::vector<Future<ErrorOr<Void>>> removed;
if (fFormat.get().get() == LiteralStringRef("FoundationDB/LogServer/2/3")) {
if (fFormat.get().get() == "FoundationDB/LogServer/2/3"_sr) {
// FIXME: need for upgrades from 5.X to 6.0, remove once this upgrade path is no longer needed
if (recovered.canBeSet())
recovered.send(Void());

View File

@ -199,28 +199,21 @@ private:
// Immutable keys
// persistFormat has been mostly invalidated by TLogVersion, and can probably be removed when
// 4.6's TLog code is removed.
static const KeyValueRef persistFormat(LiteralStringRef("Format"), LiteralStringRef("FoundationDB/LogServer/3/0"));
static const KeyRangeRef persistFormatReadableRange(LiteralStringRef("FoundationDB/LogServer/3/0"),
LiteralStringRef("FoundationDB/LogServer/4/0"));
static const KeyRangeRef persistProtocolVersionKeys(LiteralStringRef("ProtocolVersion/"),
LiteralStringRef("ProtocolVersion0"));
static const KeyRangeRef persistRecoveryCountKeys =
KeyRangeRef(LiteralStringRef("DbRecoveryCount/"), LiteralStringRef("DbRecoveryCount0"));
static const KeyValueRef persistFormat("Format"_sr, "FoundationDB/LogServer/3/0"_sr);
static const KeyRangeRef persistFormatReadableRange("FoundationDB/LogServer/3/0"_sr, "FoundationDB/LogServer/4/0"_sr);
static const KeyRangeRef persistProtocolVersionKeys("ProtocolVersion/"_sr, "ProtocolVersion0"_sr);
static const KeyRangeRef persistRecoveryCountKeys = KeyRangeRef("DbRecoveryCount/"_sr, "DbRecoveryCount0"_sr);
// Updated on updatePersistentData()
static const KeyRangeRef persistCurrentVersionKeys =
KeyRangeRef(LiteralStringRef("version/"), LiteralStringRef("version0"));
static const KeyRangeRef persistKnownCommittedVersionKeys =
KeyRangeRef(LiteralStringRef("knownCommitted/"), LiteralStringRef("knownCommitted0"));
static const KeyRef persistRecoveryLocationKey = KeyRef(LiteralStringRef("recoveryLocation"));
static const KeyRangeRef persistLocalityKeys =
KeyRangeRef(LiteralStringRef("Locality/"), LiteralStringRef("Locality0"));
static const KeyRangeRef persistLogRouterTagsKeys =
KeyRangeRef(LiteralStringRef("LogRouterTags/"), LiteralStringRef("LogRouterTags0"));
static const KeyRangeRef persistTxsTagsKeys = KeyRangeRef(LiteralStringRef("TxsTags/"), LiteralStringRef("TxsTags0"));
static const KeyRange persistTagMessagesKeys = prefixRange(LiteralStringRef("TagMsg/"));
static const KeyRange persistTagMessageRefsKeys = prefixRange(LiteralStringRef("TagMsgRef/"));
static const KeyRange persistTagPoppedKeys = prefixRange(LiteralStringRef("TagPop/"));
static const KeyRangeRef persistCurrentVersionKeys = KeyRangeRef("version/"_sr, "version0"_sr);
static const KeyRangeRef persistKnownCommittedVersionKeys = KeyRangeRef("knownCommitted/"_sr, "knownCommitted0"_sr);
static const KeyRef persistRecoveryLocationKey = KeyRef("recoveryLocation"_sr);
static const KeyRangeRef persistLocalityKeys = KeyRangeRef("Locality/"_sr, "Locality0"_sr);
static const KeyRangeRef persistLogRouterTagsKeys = KeyRangeRef("LogRouterTags/"_sr, "LogRouterTags0"_sr);
static const KeyRangeRef persistTxsTagsKeys = KeyRangeRef("TxsTags/"_sr, "TxsTags0"_sr);
static const KeyRange persistTagMessagesKeys = prefixRange("TagMsg/"_sr);
static const KeyRange persistTagMessageRefsKeys = prefixRange("TagMsgRef/"_sr);
static const KeyRange persistTagPoppedKeys = prefixRange("TagPop/"_sr);
static Key persistTagMessagesKey(UID id, Tag tag, Version version) {
BinaryWriter wr(Unversioned());
@ -623,10 +616,10 @@ struct LogData : NonCopyable, public ReferenceCounted<LogData> {
context);
addActor.send(traceRole(Role::TRANSACTION_LOG, interf.id()));
persistentDataVersion.init(LiteralStringRef("TLog.PersistentDataVersion"), cc.id);
persistentDataDurableVersion.init(LiteralStringRef("TLog.PersistentDataDurableVersion"), cc.id);
version.initMetric(LiteralStringRef("TLog.Version"), cc.id);
queueCommittedVersion.initMetric(LiteralStringRef("TLog.QueueCommittedVersion"), cc.id);
persistentDataVersion.init("TLog.PersistentDataVersion"_sr, cc.id);
persistentDataDurableVersion.init("TLog.PersistentDataDurableVersion"_sr, cc.id);
version.initMetric("TLog.Version"_sr, cc.id);
queueCommittedVersion.initMetric("TLog.QueueCommittedVersion"_sr, cc.id);
specialCounter(cc, "Version", [this]() { return this->version.get(); });
specialCounter(cc, "QueueCommittedVersion", [this]() { return this->queueCommittedVersion.get(); });
@ -2797,7 +2790,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
}
if (!fFormat.get().present()) {
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), LiteralStringRef("\xff")), 1));
RangeResult v = wait(self->persistentData->readRange(KeyRangeRef(StringRef(), "\xff"_sr), 1));
if (!v.size()) {
CODE_PROBE(true, "The DB is completely empty, so it was never initialized. Delete it.");
throw worker_removed();
@ -2811,7 +2804,7 @@ ACTOR Future<Void> restorePersistentState(TLogData* self,
state std::vector<Future<ErrorOr<Void>>> removed;
ASSERT(fFormat.get().get() == LiteralStringRef("FoundationDB/LogServer/3/0"));
ASSERT(fFormat.get().get() == "FoundationDB/LogServer/3/0"_sr);
ASSERT(fVers.get().size() == fRecoverCounts.get().size());

View File

@ -111,8 +111,8 @@ ACTOR Future<WorkerInterface> getDataDistributorWorker(Database cx, Reference<As
ACTOR Future<int64_t> getDataInFlight(Database cx, WorkerInterface distributorWorker) {
try {
TraceEvent("DataInFlight").detail("Stage", "ContactingDataDistributor");
TraceEventFields md = wait(timeoutError(
distributorWorker.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("TotalDataInFlight"))), 1.0));
TraceEventFields md = wait(
timeoutError(distributorWorker.eventLogRequest.getReply(EventLogRequest("TotalDataInFlight"_sr)), 1.0));
int64_t dataInFlight = boost::lexical_cast<int64_t>(md.getValue("TotalBytes"));
return dataInFlight;
} catch (Error& e) {
@ -300,7 +300,7 @@ getStorageWorkers(Database cx, Reference<AsyncVar<ServerDBInfo> const> dbInfo, b
wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Optional<Value>> {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
return tr->get(LiteralStringRef("usable_regions").withPrefix(configKeysPrefix));
return tr->get("usable_regions"_sr.withPrefix(configKeysPrefix));
}));
int usableRegions = 1;
if (regionsValue.present()) {
@ -440,8 +440,8 @@ ACTOR Future<int64_t> getDataDistributionQueueSize(Database cx,
try {
TraceEvent("DataDistributionQueueSize").detail("Stage", "ContactingDataDistributor");
TraceEventFields movingDataMessage = wait(timeoutError(
distributorWorker.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("MovingData"))), 1.0));
TraceEventFields movingDataMessage =
wait(timeoutError(distributorWorker.eventLogRequest.getReply(EventLogRequest("MovingData"_sr)), 1.0));
TraceEvent("DataDistributionQueueSize").detail("Stage", "GotString");
@ -483,8 +483,7 @@ ACTOR Future<bool> getTeamCollectionValid(Database cx, WorkerInterface dataDistr
TraceEvent("GetTeamCollectionValid").detail("Stage", "ContactingMaster");
TraceEventFields teamCollectionInfoMessage = wait(timeoutError(
dataDistributorWorker.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("TeamCollectionInfo"))),
1.0));
dataDistributorWorker.eventLogRequest.getReply(EventLogRequest("TeamCollectionInfo"_sr)), 1.0));
TraceEvent("GetTeamCollectionValid").detail("Stage", "GotString");
@ -591,8 +590,8 @@ ACTOR Future<bool> getDataDistributionActive(Database cx, WorkerInterface distri
try {
TraceEvent("DataDistributionActive").detail("Stage", "ContactingDataDistributor");
TraceEventFields activeMessage = wait(timeoutError(
distributorWorker.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("DDTrackerStarting"))), 1.0));
TraceEventFields activeMessage = wait(
timeoutError(distributorWorker.eventLogRequest.getReply(EventLogRequest("DDTrackerStarting"_sr)), 1.0));
return activeMessage.getValue("State") == "Active";
} catch (Error& e) {

View File

@ -616,17 +616,16 @@ Future<Void> Ratekeeper::run(RatekeeperInterface rkInterf, Reference<AsyncVar<Se
Ratekeeper::Ratekeeper(UID id, Database db)
: id(id), db(db), smoothReleasedTransactions(SERVER_KNOBS->SMOOTHING_AMOUNT),
smoothBatchReleasedTransactions(SERVER_KNOBS->SMOOTHING_AMOUNT),
smoothTotalDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT),
actualTpsMetric(LiteralStringRef("Ratekeeper.ActualTPS")), lastWarning(0), lastSSListFetchedTimestamp(now()),
normalLimits(TransactionPriority::DEFAULT,
"",
SERVER_KNOBS->TARGET_BYTES_PER_STORAGE_SERVER,
SERVER_KNOBS->SPRING_BYTES_STORAGE_SERVER,
SERVER_KNOBS->TARGET_BYTES_PER_TLOG,
SERVER_KNOBS->SPRING_BYTES_TLOG,
SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE,
SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS,
SERVER_KNOBS->TARGET_BW_LAG),
smoothTotalDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT), actualTpsMetric("Ratekeeper.ActualTPS"_sr),
lastWarning(0), lastSSListFetchedTimestamp(now()), normalLimits(TransactionPriority::DEFAULT,
"",
SERVER_KNOBS->TARGET_BYTES_PER_STORAGE_SERVER,
SERVER_KNOBS->SPRING_BYTES_STORAGE_SERVER,
SERVER_KNOBS->TARGET_BYTES_PER_TLOG,
SERVER_KNOBS->SPRING_BYTES_TLOG,
SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE,
SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS,
SERVER_KNOBS->TARGET_BW_LAG),
batchLimits(TransactionPriority::BATCH,
"Batch",
SERVER_KNOBS->TARGET_BYTES_PER_STORAGE_SERVER_BATCH,

View File

@ -286,7 +286,7 @@ ACTOR static Future<Void> getAndComputeStagingKeys(
ASSERT(!g_network->isSimulated());
int i = 0;
for (auto& key : incompleteStagingKeys) {
MutationRef m(MutationRef::SetValue, key.first, LiteralStringRef("0"));
MutationRef m(MutationRef::SetValue, key.first, "0"_sr);
key.second->second.add(m, LogMessageVersion(1));
key.second->second.precomputeResult("GetAndComputeStagingKeys", applierID, batchIndex);
i++;

View File

@ -68,7 +68,7 @@ KeyBackedProperty<Reference<IBackupContainer>> RestoreConfigFR::sourceContainer(
}
// Get the source container as a bare URL, without creating a container instance
KeyBackedProperty<Value> RestoreConfigFR::sourceContainerURL() {
return configSpace.pack(LiteralStringRef("sourceContainer"));
return configSpace.pack("sourceContainer"_sr);
}
// Total bytes written by all log and range restore tasks.

View File

@ -29,7 +29,7 @@ int numRoles = RestoreRoleStr.size();
// Similar to debugMutation(), we use debugFRMutation to track mutations for fast restore systems only.
#if CENABLED(0, NOT_IN_CLEAN)
StringRef debugFRKey = LiteralStringRef("\xff\xff\xff\xff");
StringRef debugFRKey = "\xff\xff\xff\xff"_sr;
// Track any mutation in fast restore that has overlap with debugFRKey
bool debugFRMutation(const char* context, Version version, MutationRef const& mutation) {

View File

@ -1046,32 +1046,32 @@ void miniConflictSetTest() {
void operatorLessThanTest() {
{ // Longer strings before shorter strings.
KeyInfo a(LiteralStringRef("hello"), /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b(LiteralStringRef("hello\0"), /*begin=*/false, /*write=*/false, 0, nullptr);
KeyInfo a("hello"_sr, /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b("hello\0"_sr, /*begin=*/false, /*write=*/false, 0, nullptr);
ASSERT(a < b);
ASSERT(!(b < a));
ASSERT(!(a == b));
}
{ // Reads before writes.
KeyInfo a(LiteralStringRef("hello"), /*begin=*/false, /*write=*/false, 0, nullptr);
KeyInfo b(LiteralStringRef("hello"), /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo a("hello"_sr, /*begin=*/false, /*write=*/false, 0, nullptr);
KeyInfo b("hello"_sr, /*begin=*/false, /*write=*/true, 0, nullptr);
ASSERT(a < b);
ASSERT(!(b < a));
ASSERT(!(a == b));
}
{ // Begin reads after writes.
KeyInfo a(LiteralStringRef("hello"), /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b(LiteralStringRef("hello"), /*begin=*/true, /*write=*/false, 0, nullptr);
KeyInfo a("hello"_sr, /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b("hello"_sr, /*begin=*/true, /*write=*/false, 0, nullptr);
ASSERT(a < b);
ASSERT(!(b < a));
ASSERT(!(a == b));
}
{ // Begin writes after writes.
KeyInfo a(LiteralStringRef("hello"), /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b(LiteralStringRef("hello"), /*begin=*/true, /*write=*/true, 0, nullptr);
KeyInfo a("hello"_sr, /*begin=*/false, /*write=*/true, 0, nullptr);
KeyInfo b("hello"_sr, /*begin=*/true, /*write=*/true, 0, nullptr);
ASSERT(a < b);
ASSERT(!(b < a));
ASSERT(!(a == b));

View File

@ -1269,7 +1269,7 @@ ACTOR static Future<double> doReadProbe(Future<double> grvProbe, Transaction* tr
loop {
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
try {
Optional<Standalone<StringRef>> _ = wait(tr->get(LiteralStringRef("\xff/StatusJsonTestKey62793")));
Optional<Standalone<StringRef>> _ = wait(tr->get("\xff/StatusJsonTestKey62793"_sr));
return g_network->timer_monotonic() - start;
} catch (Error& e) {
wait(tr->onError(e));
@ -1702,17 +1702,16 @@ ACTOR static Future<JsonBuilderObject> dataStatusFetcher(WorkerDetails ddWorker,
std::vector<Future<TraceEventFields>> futures;
// TODO: Should this be serial?
futures.push_back(timeoutError(
ddWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("DDTrackerStarting"))), 1.0));
futures.push_back(timeoutError(
ddWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("DDTrackerStats"))), 1.0));
futures.push_back(timeoutError(
ddWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("MovingData"))), 1.0));
futures.push_back(timeoutError(
ddWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("TotalDataInFlight"))), 1.0));
futures.push_back(timeoutError(
ddWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("TotalDataInFlightRemote"))),
1.0));
futures.push_back(
timeoutError(ddWorker.interf.eventLogRequest.getReply(EventLogRequest("DDTrackerStarting"_sr)), 1.0));
futures.push_back(
timeoutError(ddWorker.interf.eventLogRequest.getReply(EventLogRequest("DDTrackerStats"_sr)), 1.0));
futures.push_back(
timeoutError(ddWorker.interf.eventLogRequest.getReply(EventLogRequest("MovingData"_sr)), 1.0));
futures.push_back(
timeoutError(ddWorker.interf.eventLogRequest.getReply(EventLogRequest("TotalDataInFlight"_sr)), 1.0));
futures.push_back(
timeoutError(ddWorker.interf.eventLogRequest.getReply(EventLogRequest("TotalDataInFlightRemote"_sr)), 1.0));
std::vector<TraceEventFields> dataInfo = wait(getAll(futures));
@ -2084,8 +2083,7 @@ ACTOR static Future<JsonBuilderObject> workloadStatusFetcher(
auto worker = getWorker(workersMap, p.address());
if (worker.present())
commitProxyStatFutures.push_back(timeoutError(
worker.get().interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("ProxyMetrics"))),
1.0));
worker.get().interf.eventLogRequest.getReply(EventLogRequest("ProxyMetrics"_sr)), 1.0));
else
throw all_alternatives_failed(); // We need data from all proxies for this result to be trustworthy
}
@ -2093,8 +2091,7 @@ ACTOR static Future<JsonBuilderObject> workloadStatusFetcher(
auto worker = getWorker(workersMap, p.address());
if (worker.present())
grvProxyStatFutures.push_back(timeoutError(
worker.get().interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("GrvProxyMetrics"))),
1.0));
worker.get().interf.eventLogRequest.getReply(EventLogRequest("GrvProxyMetrics"_sr)), 1.0));
else
throw all_alternatives_failed(); // We need data from all proxies for this result to be trustworthy
}
@ -2161,9 +2158,9 @@ ACTOR static Future<JsonBuilderObject> workloadStatusFetcher(
// Transactions
try {
state Future<TraceEventFields> f1 =
timeoutError(rkWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("RkUpdate"))), 1.0);
state Future<TraceEventFields> f2 = timeoutError(
rkWorker.interf.eventLogRequest.getReply(EventLogRequest(LiteralStringRef("RkUpdateBatch"))), 1.0);
timeoutError(rkWorker.interf.eventLogRequest.getReply(EventLogRequest("RkUpdate"_sr)), 1.0);
state Future<TraceEventFields> f2 =
timeoutError(rkWorker.interf.eventLogRequest.getReply(EventLogRequest("RkUpdateBatch"_sr)), 1.0);
wait(success(f1) && success(f2));
TraceEventFields ratekeeper = f1.get();
TraceEventFields batchRatekeeper = f2.get();
@ -2544,7 +2541,7 @@ static JsonBuilderObject faultToleranceStatusFetcher(DatabaseConfiguration confi
std::map<NetworkAddress, StringRef> workerZones;
for (const auto& worker : workers) {
workerZones[worker.interf.address()] = worker.interf.locality.zoneId().orDefault(LiteralStringRef(""));
workerZones[worker.interf.address()] = worker.interf.locality.zoneId().orDefault(""_sr);
}
std::map<StringRef, int> coordinatorZoneCounts;
for (const auto& coordinator : coordinatorAddresses) {

View File

@ -248,9 +248,9 @@ public:
lastTLogVersion(0), lastVersionWithData(0), peekVersion(0), compactionInProgress(Void()),
fetchKeysParallelismLock(SERVER_KNOBS->FETCH_KEYS_PARALLELISM_BYTES), debug_inApplyUpdate(false),
debug_lastValidateTime(0), versionLag(0), behind(false), counters(this) {
version.initMetric(LiteralStringRef("StorageCacheData.Version"), counters.cc.id);
desiredOldestVersion.initMetric(LiteralStringRef("StorageCacheData.DesriedOldestVersion"), counters.cc.id);
oldestVersion.initMetric(LiteralStringRef("StorageCacheData.OldestVersion"), counters.cc.id);
version.initMetric("StorageCacheData.Version"_sr, counters.cc.id);
desiredOldestVersion.initMetric("StorageCacheData.DesriedOldestVersion"_sr, counters.cc.id);
oldestVersion.initMetric("StorageCacheData.OldestVersion"_sr, counters.cc.id);
newestAvailableVersion.insert(allKeys, invalidVersion);
newestDirtyVersion.insert(allKeys, invalidVersion);
@ -517,9 +517,9 @@ ACTOR Future<Void> getValueQ(StorageCacheData* data, GetValueRequest req) {
}
// DEBUG_MUTATION("CacheGetValue", version, MutationRef(MutationRef::DebugKey, req.key,
// v.present()?v.get():LiteralStringRef("<null>"))); DEBUG_MUTATION("CacheGetPath", version,
// v.present()?v.get():"<null>"_sr)); DEBUG_MUTATION("CacheGetPath", version,
// MutationRef(MutationRef::DebugKey, req.key,
// path==0?LiteralStringRef("0"):path==1?LiteralStringRef("1"):LiteralStringRef("2")));
// path==0?"0"_sr:path==1?"1"_sr:"2"_sr));
if (v.present()) {
++data->counters.rowsQueried;

View File

@ -555,18 +555,18 @@ int64_t TransientStorageMetricSample::add(KeyRef key, int64_t metric) {
TEST_CASE("/fdbserver/StorageMetricSample/simple") {
StorageMetricSample s(1000);
s.sample.insert(LiteralStringRef("Apple"), 1000);
s.sample.insert(LiteralStringRef("Banana"), 2000);
s.sample.insert(LiteralStringRef("Cat"), 1000);
s.sample.insert(LiteralStringRef("Cathode"), 1000);
s.sample.insert(LiteralStringRef("Dog"), 1000);
s.sample.insert("Apple"_sr, 1000);
s.sample.insert("Banana"_sr, 2000);
s.sample.insert("Cat"_sr, 1000);
s.sample.insert("Cathode"_sr, 1000);
s.sample.insert("Dog"_sr, 1000);
ASSERT(s.getEstimate(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("D"))) == 5000);
ASSERT(s.getEstimate(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("E"))) == 6000);
ASSERT(s.getEstimate(KeyRangeRef(LiteralStringRef("B"), LiteralStringRef("C"))) == 2000);
ASSERT(s.getEstimate(KeyRangeRef("A"_sr, "D"_sr)) == 5000);
ASSERT(s.getEstimate(KeyRangeRef("A"_sr, "E"_sr)) == 6000);
ASSERT(s.getEstimate(KeyRangeRef("B"_sr, "C"_sr)) == 2000);
// ASSERT(s.splitEstimate(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("D")), 3500) ==
// LiteralStringRef("Cat"));
// ASSERT(s.splitEstimate(KeyRangeRef("A"_sr, "D"_sr), 3500) ==
// "Cat"_sr);
return Void();
}
@ -576,19 +576,18 @@ TEST_CASE("/fdbserver/StorageMetricSample/rangeSplitPoints/simple") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.byteSample.sample.insert(LiteralStringRef("A"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 800 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 800 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
std::vector<KeyRef> t = ssm.getSplitPoints(
KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("C")), 2000 * sampleUnit, Optional<Key>());
std::vector<KeyRef> t = ssm.getSplitPoints(KeyRangeRef("A"_sr, "C"_sr), 2000 * sampleUnit, Optional<Key>());
ASSERT(t.size() == 1 && t[0] == LiteralStringRef("Bah"));
ASSERT(t.size() == 1 && t[0] == "Bah"_sr);
return Void();
}
@ -598,20 +597,18 @@ TEST_CASE("/fdbserver/StorageMetricSample/rangeSplitPoints/multipleReturnedPoint
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.byteSample.sample.insert(LiteralStringRef("A"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 800 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 800 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
std::vector<KeyRef> t = ssm.getSplitPoints(
KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("C")), 600 * sampleUnit, Optional<Key>());
std::vector<KeyRef> t = ssm.getSplitPoints(KeyRangeRef("A"_sr, "C"_sr), 600 * sampleUnit, Optional<Key>());
ASSERT(t.size() == 3 && t[0] == LiteralStringRef("Absolute") && t[1] == LiteralStringRef("Apple") &&
t[2] == LiteralStringRef("Bah"));
ASSERT(t.size() == 3 && t[0] == "Absolute"_sr && t[1] == "Apple"_sr && t[2] == "Bah"_sr);
return Void();
}
@ -621,17 +618,16 @@ TEST_CASE("/fdbserver/StorageMetricSample/rangeSplitPoints/noneSplitable") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.byteSample.sample.insert(LiteralStringRef("A"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 800 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 800 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
std::vector<KeyRef> t = ssm.getSplitPoints(
KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("C")), 10000 * sampleUnit, Optional<Key>());
std::vector<KeyRef> t = ssm.getSplitPoints(KeyRangeRef("A"_sr, "C"_sr), 10000 * sampleUnit, Optional<Key>());
ASSERT(t.size() == 0);
@ -643,17 +639,16 @@ TEST_CASE("/fdbserver/StorageMetricSample/rangeSplitPoints/chunkTooLarge") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.byteSample.sample.insert(LiteralStringRef("A"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 10 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 10 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 30 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 10 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 10 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 30 * sampleUnit);
std::vector<KeyRef> t = ssm.getSplitPoints(
KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("C")), 1000 * sampleUnit, Optional<Key>());
std::vector<KeyRef> t = ssm.getSplitPoints(KeyRangeRef("A"_sr, "C"_sr), 1000 * sampleUnit, Optional<Key>());
ASSERT(t.size() == 0);
@ -665,26 +660,25 @@ TEST_CASE("/fdbserver/StorageMetricSample/readHotDetect/simple") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.bytesReadSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Banana"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cat"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cathode"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Dog"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Banana"_sr, 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cat"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cathode"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Dog"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("A"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
std::vector<ReadHotRangeWithMetrics> t =
ssm.getReadHotRanges(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("C")), 2.0, 200 * sampleUnit, 0);
ssm.getReadHotRanges(KeyRangeRef("A"_sr, "C"_sr), 2.0, 200 * sampleUnit, 0);
ASSERT(t.size() == 1 && (*t.begin()).keys.begin == LiteralStringRef("Bah") &&
(*t.begin()).keys.end == LiteralStringRef("Bob"));
ASSERT(t.size() == 1 && (*t.begin()).keys.begin == "Bah"_sr && (*t.begin()).keys.end == "Bob"_sr);
return Void();
}
@ -694,29 +688,28 @@ TEST_CASE("/fdbserver/StorageMetricSample/readHotDetect/moreThanOneRange") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.bytesReadSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Banana"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cat"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cathode"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Dog"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Final"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Banana"_sr, 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cat"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cathode"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Dog"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Final"_sr, 2000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("A"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Dah"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
ssm.byteSample.sample.insert("Dah"_sr, 300 * sampleUnit);
std::vector<ReadHotRangeWithMetrics> t =
ssm.getReadHotRanges(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("D")), 2.0, 200 * sampleUnit, 0);
ssm.getReadHotRanges(KeyRangeRef("A"_sr, "D"_sr), 2.0, 200 * sampleUnit, 0);
ASSERT(t.size() == 2 && (*t.begin()).keys.begin == LiteralStringRef("Bah") &&
(*t.begin()).keys.end == LiteralStringRef("Bob"));
ASSERT(t.at(1).keys.begin == LiteralStringRef("Cat") && t.at(1).keys.end == LiteralStringRef("Dah"));
ASSERT(t.size() == 2 && (*t.begin()).keys.begin == "Bah"_sr && (*t.begin()).keys.end == "Bob"_sr);
ASSERT(t.at(1).keys.begin == "Cat"_sr && t.at(1).keys.end == "Dah"_sr);
return Void();
}
@ -726,30 +719,29 @@ TEST_CASE("/fdbserver/StorageMetricSample/readHotDetect/consecutiveRanges") {
int64_t sampleUnit = SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
StorageServerMetrics ssm;
ssm.bytesReadSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Banana"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Bucket"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cat"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Cathode"), 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Dog"), 5000 * sampleUnit);
ssm.bytesReadSample.sample.insert(LiteralStringRef("Final"), 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Banana"_sr, 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Bucket"_sr, 2000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cat"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Cathode"_sr, 1000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Dog"_sr, 5000 * sampleUnit);
ssm.bytesReadSample.sample.insert("Final"_sr, 2000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("A"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Absolute"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Apple"), 1000 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bah"), 20 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Banana"), 80 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Bob"), 200 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("But"), 100 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Cat"), 300 * sampleUnit);
ssm.byteSample.sample.insert(LiteralStringRef("Dah"), 300 * sampleUnit);
ssm.byteSample.sample.insert("A"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Absolute"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Apple"_sr, 1000 * sampleUnit);
ssm.byteSample.sample.insert("Bah"_sr, 20 * sampleUnit);
ssm.byteSample.sample.insert("Banana"_sr, 80 * sampleUnit);
ssm.byteSample.sample.insert("Bob"_sr, 200 * sampleUnit);
ssm.byteSample.sample.insert("But"_sr, 100 * sampleUnit);
ssm.byteSample.sample.insert("Cat"_sr, 300 * sampleUnit);
ssm.byteSample.sample.insert("Dah"_sr, 300 * sampleUnit);
std::vector<ReadHotRangeWithMetrics> t =
ssm.getReadHotRanges(KeyRangeRef(LiteralStringRef("A"), LiteralStringRef("D")), 2.0, 200 * sampleUnit, 0);
ssm.getReadHotRanges(KeyRangeRef("A"_sr, "D"_sr), 2.0, 200 * sampleUnit, 0);
ASSERT(t.size() == 2 && (*t.begin()).keys.begin == LiteralStringRef("Bah") &&
(*t.begin()).keys.end == LiteralStringRef("But"));
ASSERT(t.at(1).keys.begin == LiteralStringRef("Cat") && t.at(1).keys.end == LiteralStringRef("Dah"));
ASSERT(t.size() == 2 && (*t.begin()).keys.begin == "Bah"_sr && (*t.begin()).keys.end == "But"_sr);
ASSERT(t.at(1).keys.begin == "Cat"_sr && t.at(1).keys.end == "Dah"_sr);
return Void();
}

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