Skip to content

Commit

Permalink
ovsdb-tool: Only check leader completeness when we can, in "check-clu…
Browse files Browse the repository at this point in the history
…ster".

Generally when we know the leader for a term, in "check-cluster", it's
because we read that leader's log file.  In that case, we have the leader's
log_end because it told us.  However, taking a snapshot can discard that
data.  In that case, log_end is 0 and we should not try to check for leader
completeness on that basis.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Mark Michelson <[email protected]>
  • Loading branch information
blp committed Aug 3, 2018
1 parent 7073a83 commit c2d7187
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ovsdb/ovsdb-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,8 @@ do_check_cluster(struct ovs_cmdl_context *ctx)
struct commit *commit = NULL;
for (uint64_t term = min_term; term <= max_term; term++) {
struct leader *leader = find_leader(&c, term);
if (leader && commit && commit->index >= leader->log_end) {
if (leader && leader->log_end
&& commit && commit->index >= leader->log_end) {
ovs_fatal(0, "leader %s for term %"PRIu64" has log entries only "
"up to index %"PRIu64", but index %"PRIu64" was "
"committed in a previous term (e.g. by %s)",
Expand Down

0 comments on commit c2d7187

Please sign in to comment.