From 800ece286d385588f30bdde757841bcb68514593 Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Tue, 1 Sep 2020 13:14:27 -0700 Subject: [PATCH] Results from read hot range requests were not held by the results arena. --- fdbclient/NativeAPI.actor.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 715c93b6af..e0b3af6f29 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -3889,13 +3889,22 @@ ACTOR Future>> getReadHotRanges(Da } wait(waitForAll(fReplies)); - Standalone> results; - for (int i = 0; i < nLocs; i++) - results.append(results.arena(), fReplies[i].get().readHotRanges.begin(), - fReplies[i].get().readHotRanges.size()); + if(nLocs == 0) { + TEST(true); // Single-shard read hot range request + return fReplies[0].get().readHotRanges; + } + else { + TEST(true); // Multi-shard read hot range request + Standalone> results; + for (int i = 0; i < nLocs; i++) { + results.append(results.arena(), fReplies[i].get().readHotRanges.begin(), + fReplies[i].get().readHotRanges.size()); + results.arena().dependsOn(fReplies[i].get().readHotRanges.arena()); + } - return results; + return results; + } } catch (Error& e) { if (e.code() != error_code_wrong_shard_server && e.code() != error_code_all_alternatives_failed) { TraceEvent(SevError, "GetReadHotSubRangesError").error(e);