Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 3/6] txn_limbo: introduce txn_limbo_last_synchro_entry method
Date: Thu, 24 Dec 2020 19:13:28 +0300	[thread overview]
Message-ID: <4e75e345-0d72-d950-ef63-f69344a8c00f@tarantool.org> (raw)
In-Reply-To: <d21765dd-5b8f-b547-4bc0-cb25d4028d96@tarantool.org>



23.12.2020 20:25, Vladislav Shpilevoy пишет:
> Thanks for the patch!
>
> On 23.12.2020 12:59, Serge Petrenko via Tarantool-patches wrote:
>> It'll be useful for box_clear_synchro_queue rework.
>>
>> Prerequisite #5435
>> ---
>>   src/box/txn_limbo.c | 12 ++++++++++++
>>   src/box/txn_limbo.h |  7 +++++++
>>   2 files changed, 19 insertions(+)
>>
>> diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
>> index c406ed4c8..9272f5227 100644
>> --- a/src/box/txn_limbo.c
>> +++ b/src/box/txn_limbo.c
>> @@ -55,6 +55,18 @@ txn_limbo_is_ro(struct txn_limbo *limbo)
>>   	return limbo->owner_id != instance_id && !txn_limbo_is_empty(limbo);
>>   }
>>   
>> +struct txn_limbo_entry *
>> +txn_limbo_last_synchro_entry(struct txn_limbo *limbo)
>> +{
>> +	struct txn_limbo_entry *entry = NULL;
>> +	rlist_foreach_entry_reverse(entry, &limbo->queue, in_queue) {
>> +		if (txn_has_flag(entry->txn, TXN_WAIT_ACK))
>> +			break;
>> +	}
>> +	assert(entry == NULL || txn_has_flag(entry->txn, TXN_WAIT_ACK));
>> +	return entry;
>> +}
> This could be a little simpler, but up to you:
>
> ====================
> @@ -58,13 +58,12 @@ txn_limbo_is_ro(struct txn_limbo *limbo)
>   struct txn_limbo_entry *
>   txn_limbo_last_synchro_entry(struct txn_limbo *limbo)
>   {
> -	struct txn_limbo_entry *entry = NULL;
> +	struct txn_limbo_entry *entry;
>   	rlist_foreach_entry_reverse(entry, &limbo->queue, in_queue) {
>   		if (txn_has_flag(entry->txn, TXN_WAIT_ACK))
> -			break;
> +			return entry;
>   	}
> -	assert(entry == NULL || txn_has_flag(entry->txn, TXN_WAIT_ACK));
> -	return entry;
> +	return NULL;
>   }
>   
>   struct txn_limbo_entry *

Nice. Applied.

-- 
Serge Petrenko

  reply	other threads:[~2020-12-24 16:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 11:59 [Tarantool-patches] [PATCH v2 0/6] make clear_synchro_queue commit everything Serge Petrenko
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 1/6] box: add a single execution guard to clear_synchro_queue Serge Petrenko
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 2/6] relay: introduce on_status_update trigger Serge Petrenko
2020-12-23 17:25   ` Vladislav Shpilevoy
2020-12-24 16:11     ` Serge Petrenko
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 3/6] txn_limbo: introduce txn_limbo_last_synchro_entry method Serge Petrenko
2020-12-23 17:25   ` Vladislav Shpilevoy
2020-12-24 16:13     ` Serge Petrenko [this message]
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 4/6] box: rework clear_synchro_queue to commit everything Serge Petrenko
2020-12-23 17:28   ` Vladislav Shpilevoy
2020-12-24 16:12     ` Serge Petrenko
2020-12-24 17:35       ` Vladislav Shpilevoy
2020-12-24 21:02         ` Serge Petrenko
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 5/6] test: fix replication/election_qsync_stress test Serge Petrenko
2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 6/6] txn_limbo: ignore CONFIRM/ROLLBACK for a foreign master Serge Petrenko
2020-12-23 17:28   ` Vladislav Shpilevoy
2020-12-24 16:13     ` Serge Petrenko
2020-12-25 10:04 ` [Tarantool-patches] [PATCH v2 0/6] make clear_synchro_queue commit everything Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e75e345-0d72-d950-ef63-f69344a8c00f@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 3/6] txn_limbo: introduce txn_limbo_last_synchro_entry method' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox