diff --git a/fdbserver/DiskQueue.actor.cpp b/fdbserver/DiskQueue.actor.cpp index 40342945b6..de78b859d6 100644 --- a/fdbserver/DiskQueue.actor.cpp +++ b/fdbserver/DiskQueue.actor.cpp @@ -1659,3 +1659,37 @@ IDiskQueue* openDiskQueue(std::string basename, int64_t fileSizeWarningLimit) { return new DiskQueue_PopUncommitted(basename, ext, dbgid, dqv, fileSizeWarningLimit); } + +TEST_CASE("performance/fdbserver/DiskQueue") { + state IDiskQueue* queue = + openDiskQueue("test-", "fdq", deterministicRandom()->randomUniqueID(), DiskQueueVersion::V2); + state std::string valueString = std::string(10e6, '.'); + state StringRef valueStr((uint8_t*)valueString.c_str(), 10e6); + state std::deque locations; + state int loopCount = 0; + state Future lastCommit = Void(); + bool fullyRecovered = wait(queue->initializeRecovery(0)); + if (!fullyRecovered) { + loop { + Standalone h = wait(queue->readNext(1e6)); + if (h.size() < 1e6) { + break; + } + } + } + loop { + if (++loopCount % 2 == 0) { + state IDiskQueue::location frontLocation = locations.front(); + locations.pop_front(); + if (locations.size() > 10) { + Standalone r = wait(queue->read(frontLocation, locations.front(), CheckHashes::True)); + } + queue->pop(frontLocation); + } + wait(delay(0.001)); + locations.push_back(queue->push(valueStr)); + Future prevCommit = lastCommit; + lastCommit = queue->commit(); + wait(prevCommit); + } +} \ No newline at end of file