[Tarantool-patches] [PATCH v4 05/12] box: make clear_synchro_queue() write a PROMOTE entry instead of CONFIRM + ROLLBACK

Serge Petrenko sergepetrenko at tarantool.org
Wed Apr 21 08:58:20 MSK 2021



21.04.2021 01:30, Vladislav Shpilevoy пишет:
> Thanks for the patch!
>
> Consider this commit on top of yours on the
> branch sp/gh-5445-election-fixes-review:

Thanks! Looks good, I squashed it.

>
> ====================
>      [tosquash] Pass args explicitly to read_promote
>      
>      Firstly, to be consistent with the other read_*() functions.
>      Secondly, one of the next patches is going to change promote
>      lsn, and it should not change the original struct synchro_request
>      or copy it for a change.
>
> diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
> index 0d2d274f6..8668eb964 100644
> --- a/src/box/txn_limbo.c
> +++ b/src/box/txn_limbo.c
> @@ -487,13 +487,13 @@ txn_limbo_write_promote(struct txn_limbo *limbo, int64_t lsn, uint64_t term)
>    * rollback all entries > @a req.lsn.
>    */
>   static void
> -txn_limbo_read_promote(struct txn_limbo *limbo,
> -		       const struct synchro_request *req)
> +txn_limbo_read_promote(struct txn_limbo *limbo, uint32_t replica_id,
> +		       int64_t lsn)
>   {
> -	txn_limbo_read_confirm(limbo, req->lsn);
> -	txn_limbo_read_rollback(limbo, req->lsn + 1);
> +	txn_limbo_read_confirm(limbo, lsn);
> +	txn_limbo_read_rollback(limbo, lsn + 1);
>   	assert(txn_limbo_is_empty(&txn_limbo));
> -	limbo->owner_id = req->origin_id;
> +	limbo->owner_id = replica_id;
>   	limbo->confirmed_lsn = 0;
>   }
>   
> @@ -660,7 +660,7 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req)
>   		txn_limbo_read_rollback(limbo, req->lsn);
>   		break;
>   	case IPROTO_PROMOTE:
> -		txn_limbo_read_promote(limbo, req);
> +		txn_limbo_read_promote(limbo, req->origin_id, req->lsn);
>   		break;
>   	default:
>   		unreachable();

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list