]> git.proxmox.com Git - ovs.git/commitdiff
ovsdb raft: cmd->eid should always be non-null.
authorHan Zhou <hzhou8@ebay.com>
Fri, 12 Apr 2019 23:26:27 +0000 (16:26 -0700)
committerBen Pfaff <blp@ovn.org>
Mon, 15 Apr 2019 20:15:56 +0000 (13:15 -0700)
raft_command's eid should always be non-null in all 3 cases. Fix the
comment, and also replace if condition with assert.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovsdb/raft.c

index abcc9c0e3dadff77cee888d4c70f7927d4aec049..02bdf115d000f73c7ccad67d0dd18be1ebec5f56 100644 (file)
@@ -108,13 +108,11 @@ struct raft_command {
     struct hmap_node hmap_node; /* In struct raft's 'commands' hmap. */
     unsigned int n_refs;        /* Reference count.  */
     enum raft_command_status status; /* Execution status. */
+    struct uuid eid;            /* Entry ID of result. */
 
     /* Case 1 only. */
     uint64_t index;             /* Index in log (0 if being relayed). */
 
-    /* Cases 2 and 3. */
-    struct uuid eid;            /* Entry ID of result. */
-
     /* Case 2 only. */
     long long int timestamp;    /* Issue or last ping time, for expiration. */
 
@@ -1974,9 +1972,8 @@ raft_command_initiate(struct raft *raft,
     }
 
     struct raft_command *cmd = raft_command_create_incomplete(raft, index);
-    if (eid) {
-        cmd->eid = *eid;
-    }
+    ovs_assert(eid);
+    cmd->eid = *eid;
 
     raft_waiter_create(raft, RAFT_W_ENTRY, true)->entry.index = cmd->index;