[Tarantool-patches] [PATCH 9/9] box: enrich ER_READONLY with new details

Cyrill Gorcunov gorcunov at gmail.com
Sat Nov 6 22:30:36 MSK 2021


On Sat, Nov 06, 2021 at 12:56:40AM +0100, Vladislav Shpilevoy via Tarantool-patches wrote:
> +	if (raft_is_ro(raft)) {
> +		error_field_set_str(e, "reason", "election");
> +		error_field_set_str(e, "state", raft_state_str(raft->state));
> +		error_field_set_uint(e, "term", raft->volatile_term);
> +		uint32_t id = raft->leader;
> +		if (id != REPLICA_ID_NIL) {
> +			error_field_set_uint(e, "leader_id", id);
> +			struct replica *r = replica_by_id(id);

Why do we need an additional variable here instead of raft->leader?
To shrink code left?

> +	} else if (txn_limbo_is_ro(&txn_limbo)) {
> +		error_field_set_str(e, "reason", "synchro");
> +		uint32_t id = txn_limbo.owner_id;
> +		error_field_set_uint(e, "queue_owner_id", id);
> +		error_field_set_uint(e, "term", raft->volatile_term);
> +		struct replica *r = replica_by_id(id);

And here too. Just wondering.


More information about the Tarantool-patches mailing list