Skip to content

Commit

Permalink
repair: fix small error-handling logic mistake
Browse files Browse the repository at this point in the history
As noticed by Tomasz Grabiec, we test a future's available() after
having already waited for it with when_all(), which is pointless.

The code after the wrong if() exchanges the contents of a token-range
between this node and several other live neighbors; We can't do this
exchange if either this node is broken or there is no other live neighbor.
So this is what we needed to test. so !available() should have been failed().

Also the test for live_neighbors_checksum.empty() added in commit 7c873f0
is unnecessary - we build live_neighbors and live_neighbors_checksum
together, so if one of them is empty, so is the other.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20180710114940.26027-1-nyh@scylladb.com>
  • Loading branch information
nyh authored and avikivity committed Jul 10, 2018
1 parent 559439b commit 5e47061
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion repair/repair.cc
Expand Up @@ -830,7 +830,7 @@ static future<> repair_cf_range(repair_info& ri,
live_neighbors_checksum.push_back(checksums[i].get0());
}
}
if (!checksums[0].available() || live_neighbors.empty() || live_neighbors_checksum.empty()) {
if (checksums[0].failed() || live_neighbors.empty()) {
return make_ready_future<>();
}
// If one of the available checksums is different, repair
Expand Down

0 comments on commit 5e47061

Please sign in to comment.