Skip to content

Commit

Permalink
do not crash in user-defined operations if the controller is disabled
Browse files Browse the repository at this point in the history
Scylla currently crashes if we run manual operations like nodetool
compact with the controller disabled. While we neither like nor
recommend running with the controller disabled, due to some corner cases
in the controller algorithm we are not yet at the point in which we can
deprecate this and are sometimes forced to disable it.

The reason for the crash is that manual operations will invoke
_backlog_of_shares, which returns what is the backlog needed to
create a certain number of shares. That scan the existing control
points, but when we run without the controller there are no control
points and we crash.

Backlog doesn't matter if the controller is disabled, and the return
value of this function will be immaterial in this case. So to avoid the
crash, we return something right away if the controller is disabled.

Fixes scylladb#5016

Signed-off-by: Glauber Costa <glauber@scylladb.com>
  • Loading branch information
Glauber Costa committed Sep 14, 2019
1 parent 8517eec commit 31546c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ void backlog_controller::adjust() {

float backlog_controller::backlog_of_shares(float shares) const {
size_t idx = 1;
// No control points means the controller is disabled.
if (_control_points.size() == 0) {
return 1.0f;
}
while ((idx < _control_points.size() - 1) && (_control_points[idx].output < shares)) {
idx++;
}
Expand Down

0 comments on commit 31546c5

Please sign in to comment.