diff --git a/bindings/c/test/mako/mako.cpp b/bindings/c/test/mako/mako.cpp index 96040d66e72..03a51561b63 100644 --- a/bindings/c/test/mako/mako.cpp +++ b/bindings/c/test/mako/mako.cpp @@ -970,6 +970,9 @@ int parseTransaction(Arguments& args, char const* optarg) { } else if (strncmp(ptr, "g", 1) == 0) { op = OP_GET; ptr++; + } else if (strncmp(ptr, "sj", 2) == 0) { + op = OP_STATUSJSON; + ptr += 2; } else if (strncmp(ptr, "sgr", 3) == 0) { op = OP_SGETRANGE; rangeop = 1; diff --git a/bindings/c/test/mako/mako.hpp b/bindings/c/test/mako/mako.hpp index 6474c0710c8..a6f997275c0 100644 --- a/bindings/c/test/mako/mako.hpp +++ b/bindings/c/test/mako/mako.hpp @@ -102,6 +102,7 @@ enum OpKind { OP_GETRANGE, OP_SGET, OP_SGETRANGE, + OP_STATUSJSON, OP_UPDATE, OP_INSERT, OP_INSERTRANGE, diff --git a/bindings/c/test/mako/mako.rst b/bindings/c/test/mako/mako.rst index cb9fd3c6085..dd49a50ba92 100644 --- a/bindings/c/test/mako/mako.rst +++ b/bindings/c/test/mako/mako.rst @@ -161,6 +161,7 @@ Operation Types - ``gr`` – GET RANGE - ``sg`` – Snapshot GET - ``sgr`` – Snapshot GET RANGE +- ``sj`` – GET ``\xff\xff/status/json`` from the special key space - ``u`` – Update (= GET followed by SET) - ``i`` – Insert (= SET with a new key) - ``ir`` – Insert Range (Sequential) diff --git a/bindings/c/test/mako/operations.cpp b/bindings/c/test/mako/operations.cpp index 7f7cf6a6b79..5c75fa8a599 100644 --- a/bindings/c/test/mako/operations.cpp +++ b/bindings/c/test/mako/operations.cpp @@ -111,6 +111,20 @@ const std::array opTable{ { } } }, 1, false }, + { "STATUSJSON", + { { StepKind::READ, + [](Transaction& tx, Arguments const&, ByteString&, ByteString&, ByteString&) { + static constexpr auto status_json_key = + std::string_view{ "\xff\xff/status/json", sizeof("\xff\xff/status/json") - 1 }; + return tx.get(toBytesRef(status_json_key), false /*snapshot*/).eraseType(); + }, + [](Future& f, Transaction&, Arguments const&, ByteString&, ByteString&, ByteString&) { + if (f && !f.error()) { + f.get(); + } + } } }, + 1, + false }, { "UPDATE", { { StepKind::READ, [](Transaction& tx, Arguments const& args, ByteString& key, ByteString&, ByteString&) { diff --git a/documentation/coro_tutorial/tutorial.cpp b/documentation/coro_tutorial/tutorial.cpp index 24aca9cc780..fe52bb1d90d 100644 --- a/documentation/coro_tutorial/tutorial.cpp +++ b/documentation/coro_tutorial/tutorial.cpp @@ -554,17 +554,6 @@ Future fdbClient() { } } -Future fdbStatusStresser() { - Database db = Database::createDatabase(clusterFile, 300); - Key statusJson(std::string("\xff\xff/status/json")); - loop { - co_await runRYWTransaction(db, [&statusJson](ReadYourWritesTransaction* tr) -> Future { - co_await tr->get(statusJson); - co_return; - }); - } -} - AsyncGenerator> readBlocks(Reference file, int64_t blockSize) { auto sz = co_await file->size(); decltype(sz) offset = 0; @@ -645,9 +634,8 @@ std::unordered_map()>> actors = { { "fdbClientStream", &fdbClientStream }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientStream { "fdbClientGetRange", &fdbClientGetRange }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientGetRange { "fdbClient", &fdbClient }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClient - { "fdbStatusStresser", &fdbStatusStresser }, { "testReadLines", &testReadLines } -}; // ./tutorial -C $CLUSTER_FILE_PATH fdbStatusStresser +}; int main(int argc, char* argv[]) { bool isServer = false; diff --git a/documentation/tutorial/tutorial.actor.cpp b/documentation/tutorial/tutorial.actor.cpp index 000282e1d27..5a706a6f837 100644 --- a/documentation/tutorial/tutorial.actor.cpp +++ b/documentation/tutorial/tutorial.actor.cpp @@ -518,20 +518,6 @@ ACTOR Future fdbClient() { } } -ACTOR Future fdbStatusStresser() { - state Database db = Database::createDatabase(clusterFile, 300); - state ReadYourWritesTransaction tx(db); - state Key statusJson(std::string("\xff\xff/status/json")); - loop { - try { - tx.reset(); - Optional _ = wait(tx.get(statusJson)); - } catch (Error& e) { - wait(tx.onError(e)); - } - } -} - std::unordered_map()>> actors = { { "timer", &simpleTimer }, // ./tutorial timer { "promiseDemo", &promiseDemo }, // ./tutorial promiseDemo @@ -543,9 +529,8 @@ std::unordered_map()>> actors = { { "multipleClients", &multipleClients }, // ./tutorial -s 127.0.0.1:6666 multipleClients { "fdbClientStream", &fdbClientStream }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientStream { "fdbClientGetRange", &fdbClientGetRange }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientGetRange - { "fdbClient", &fdbClient }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClient - { "fdbStatusStresser", &fdbStatusStresser } -}; // ./tutorial -C $CLUSTER_FILE_PATH fdbStatusStresser + { "fdbClient", &fdbClient } // ./tutorial -C $CLUSTER_FILE_PATH fdbClient +}; int main(int argc, char* argv[]) { bool isServer = false;