[Tarantool-patches] [PATCH v2 1/9] wal: enrich row's meta information with sync replication flags

Serge Petrenko sergepetrenko at tarantool.org
Tue Apr 13 16:29:12 MSK 2021



13.04.2021 16:09, Cyrill Gorcunov пишет:
> On Mon, Apr 12, 2021 at 10:40:14PM +0300, Serge Petrenko wrote:
>> @@ -996,7 +996,13 @@ wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base,
>>   				first_glob_row = row;
>>   			}
>>   			(*row)->tsn = tsn == 0 ? (*start)->lsn : tsn;
>> -			(*row)->is_commit = row == end - 1;
>> +			if (row < end - 1)
>> +				continue;
> These two lines ^^
> Serge, why we need `continue` here at all? Why can't we simply drop the
> above `if` saving a branch?
>
>> +			/* Tx meta is stored in the last tx row. */
>> +			if (row == end - 1) {
>> +				(*row)->opt_flags = entry->opt_flags;
>> +				(*row)->is_commit = true;
>> +			}
> IOW, I mean
>
> 		(*row)->tsn = tsn == 0 ? (*start)->lsn : tsn;
> 		(*row)->is_commit = row == end - 1;
> 		if (row == end - 1) {
> 			// Save meta
> 		}

Thanks for noticing! That's strange, indeed. Removed:

diff --git a/src/box/wal.c b/src/box/wal.c
index b7c69fc59..4ec8034a3 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -996,8 +996,6 @@ wal_assign_lsn(struct vclock *vclock_diff, struct 
vclock *base,
                                 first_glob_row = row;
                         }
                         (*row)->tsn = tsn == 0 ? (*start)->lsn : tsn;
-                       if (row < end - 1)
-                               continue;
                         /* Tx meta is stored in the last tx row. */
                         if (row == end - 1) {
                                 (*row)->opt_flags = entry->opt_flags;

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list