Skip to content

Commit

Permalink
ovsdb raft: cmd->eid should always be non-null.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
hzhou8 authored and blp committed Apr 15, 2019
1 parent eb69225 commit 7ef3608
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ovsdb/raft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 7ef3608

Please sign in to comment.