Skip to content

Commit 8869f92

Browse files
jimwwalkertrondn
authored andcommitted
RangeScan: More tweaks to rangescan tool
1) Always log the enoent (empty scan) case as the tool is more usable when all vbuckets scan. 2) Don't clear the start/stop time in the enoent case, it just messes up any time based output. 3) Log total duration (ms) in the summary Change-Id: I57012be1f293c74986c61dcddebe997240f321e3 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/197196 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Jim Walker <[email protected]>
1 parent 3c24258 commit 8869f92

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

programs/rangescan/rangescan.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ class RangeScanConnection {
197197
tailp = head.get();
198198
}
199199
}
200+
200201
connection->getUnderlyingAsyncSocket().writeChain(
201202
&terminateOnErrorWriteCallback, std::move(head));
203+
204+
start = std::chrono::steady_clock::now();
205+
202206
connection->enterMessagePumpMode(
203207
[this](const cb::mcbp::Header& header) {
204208
if (verbose) {
@@ -210,7 +214,6 @@ class RangeScanConnection {
210214
handleResponse(header.getResponse());
211215
}
212216
});
213-
start = std::chrono::steady_clock::now();
214217
}
215218

216219
size_t getTotalBytesReceived() const {
@@ -307,14 +310,11 @@ class RangeScanConnection {
307310
}
308311

309312
void handleCreateRangeEmpty(const cb::mcbp::Response& response) {
310-
if (verbose) {
311-
auto vb = creates.at(response.getOpaque());
312-
std::cout << "vb:" << vb << " with no keys in range"
313-
<< response.to_json(false).dump() << std::endl;
314-
}
313+
auto vb = creates.at(response.getOpaque());
314+
std::cerr << "Warning vb:" << vb << " has no keys in range"
315+
<< response.to_json(false).dump() << std::endl;
315316
// erase this scan
316317
creates.erase(response.getOpaque());
317-
start = stop = {};
318318
}
319319

320320
void continueNextScan() {
@@ -895,6 +895,7 @@ int main(int argc, char** argv) {
895895
result["total_throughput"] = calculateThroughput(
896896
total_bytes,
897897
std::chrono::duration_cast<std::chrono::seconds>(duration));
898+
result["duration_ms"] = duration.count();
898899
std::cout << result.dump() << std::endl;
899900

900901
connections.clear();

0 commit comments

Comments
 (0)