[Tarantool-patches] [PATCH] limbo: introduce request processing hooks

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Jul 12 11:03:32 MSK 2021


>> This simply should not be possible. The term map is updated only
>> after WAL write is done. At least this is how it works now, doesn't
>> it? Why did you change it? (In case you did, because I am not sure,
>> I didn't review the code throughly).
> 
> Look, I think this maybe not explicitly seen from the patch since
> diff is big enough. But here is a key moment. Current code is called
> after WAL is updated
> 
> void
> txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req)
> {
> 	uint64_t term = req->term;
> 	uint32_t origin = req->origin_id;
> 	if (txn_limbo_replica_term(limbo, origin) < term) {
> 		vclock_follow(&limbo->promote_term_map, origin, term);
> 		if (term > limbo->promote_greatest_term) {
> 			limbo->promote_greatest_term = term;
> 		} else if (req->type == IPROTO_PROMOTE) {
> 			/*
> 			 * PROMOTE for outdated term. Ignore.
> 			 */
> -->			return;
> 		}
> 	}
> 
> we exit early without any error.
> 
> In new approach we start reporting an error if this situation is
> happening, 'cause it is a split brain. But we shall not write this
> term into our WAL file, thus we should validate incoming packet
> earlier.
> 
> Now imagine the following: we validated the incoming packet and
> remember its term in promote_term_map, then we start writting
> this packet into our WAL and write procedure failed.

That is the core problem of your entire approach - why do you imagine
we update promote_term_map before writing to WAL? We do not do that.
And you should not do that. Before WAL write there should no be any
changes. **Zero changes before WAL write**. Before you write to WAL,
you can only validate requests. Using `const struct txn_limbo *`. With
zero changes.


More information about the Tarantool-patches mailing list