Skip to content

Commit

Permalink
storage_proxy: prevent short read due to buffer size limit from being…
Browse files Browse the repository at this point in the history
… swallowed during range scan

mutation_result_merger::get() assumes that the merged result may be a
short read if at least one of the partial results is a short read (in
other words, if none of the partial results is a short read, then the
merged result is also not a short read). However this is not true;
because we update the memory accounter incrementally, we may stop
scanning early. All the partial results are full; but we did not scan
the entire range.

Fix by changing the short_read variable initialization from `no`
(which assumes we'll encounter a short read indication when processing
one of the batches) to `this->short_read()`, which also takes into
account the memory accounter.

Fixes #2001.
Message-Id: <20170108111315.17877-1-avi@scylladb.com>
  • Loading branch information
avikivity authored and pdziepak committed Jan 9, 2017
1 parent 42c1e1e commit 8f36dca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion service/storage_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3614,7 +3614,7 @@ class mutation_result_merger {
stdx::optional<dht::decorated_key> last; // set if we had a short read
};
auto merged = std::map<unsigned, partitions_and_last_key>();
auto short_read = query::short_read::no;
auto short_read = query::short_read(this->short_read());
// merge batches with equal keys, and note if we need to sort afterwards
for (auto&& key_value : _partitions) {
auto&& key = key_value.first;
Expand Down

0 comments on commit 8f36dca

Please sign in to comment.