@@ -164,7 +164,7 @@ The clustered format has the following additional notation:
This allows readers to be ignorant of the full semantics of schema change.
The first record in a clustered database contains the following members,
-all of which are required:
+all of which are required, except ``prev_election_timer``:
``"server_id": <raw-uuid>``
The server's own UUID, which must be unique within the cluster.
@@ -190,6 +190,10 @@ all of which are required:
term "prev_term". It might not include this server, if it was not the
initial server in the cluster.
+``"prev_election_timer": <uint64>``
+ The election base time before the beginning of the log. If not exist,
+ the default value 1000 ms is used as if it exists this record.
+
``"prev_data": <json-value>`` and ``"prev_eid": <raw-uuid>``
A snapshot of the data in the database at index "prev_index" and term
"prev_term", and the entry ID for that data. The snapshot must contain a
@@ -284,6 +284,7 @@ raft_entry_clone(struct raft_entry *dst, const struct raft_entry *src)
dst->data = json_nullable_clone(src->data);
dst->eid = src->eid;
dst->servers = json_nullable_clone(src->servers);
+ dst->election_timer = src->election_timer;
}
void
@@ -405,6 +406,8 @@ raft_header_from_json__(struct raft_header *h, struct ovsdb_parser *p)
ovsdb_parser_member(p, "prev_data", OP_ANY));
h->snap.eid = raft_parse_required_uuid(p, "prev_eid");
h->snap.term = raft_parse_required_uint64(p, "prev_term");
+ h->snap.election_timer = raft_parse_optional_uint64(
+ p, "prev_election_timer");
}
}
@@ -457,6 +460,10 @@ raft_header_to_json(const struct raft_header *h)
}
json_object_put_format(json, "prev_eid",
UUID_FMT, UUID_ARGS(&h->snap.eid));
+ if (h->snap.election_timer) {
+ raft_put_uint64(json, "prev_election_timer",
+ h->snap.election_timer);
+ }
}
return json;