[ovs-dev] [PATCH 7/7] ovsdb-tool: Only check leader completeness when we can, in "check-cluster".

Ben Pfaff blp at ovn.org
Thu Jul 26 17:09:46 UTC 2018


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 <blp at ovn.org>
---
 ovsdb/ovsdb-tool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index 8ac6a1b21670..438f975902f5 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -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)",
-- 
2.16.1



More information about the dev mailing list