multishard_combining_reader: pause readers after reading ahead

Readers created or resumed just to read ahead should be paused right
after, to avoid consuming all available permits on the shards they
operate on, causing a deadlock.
This commit is contained in:
Botond Dénes
2018-12-06 10:53:19 +02:00
parent 170fa382fa
commit ee193f1ab4

View File

@@ -1309,7 +1309,12 @@ void multishard_combining_reader::shard_reader::read_ahead(db::timeout_clock::ti
if (state->stopped) {
return make_ready_future<>();
}
return do_fill_buffer(timeout);
return do_fill_buffer(timeout).then([this, state = std::move(state)] {
// Read ahead is still in the background, so pause the reader.
if (!state->stopped && _read_ahead) {
pause();
}
});
}));
}