Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms
Date: Tue, 10 Aug 2021 15:27:23 +0300	[thread overview]
Message-ID: <1a58f1dc-bd03-7b45-a99f-389b9b37f325@tarantool.org> (raw)
In-Reply-To: <YRFWuAudhwhjSi5w@grain>



On 09.08.2021 19:24, Cyrill Gorcunov wrote:
> On Sun, Aug 08, 2021 at 05:34:54PM +0300, Vladislav Shpilevoy wrote:
>>>> In the next patch you would make txn_limbo_process_begin()
>>>> also take the request to validate it. Then the 'filtering'
>>>> would become internal to the limbo.
>>
>> I didn't propose to drop the locking. I said it could be hidden
>> inside of the limbo's API. In the only example above you show:
>>
>>>       txn_limbo_term_lock
>>>         txn_limbo_replica_term_locked
>>>       txn_limbo_term_unlock
>>
>> Here the lock is done inside of the limbo's API too. It is
>> not exposed on the limbo's API level. So the questions is the
>> same - can it be hidden inside of the API? Are there any usages
>> of the lock done explicitly out of the limo?
> 
> Actually, everything start looking a way more unattractive I think.
> Lets gather the current API from the patchset.
> 
> applier_synchro_filter_tx
>   txn_limbo_is_replica_outdated
>     txn_limbo_term_lock
>       txn_limbo_replica_term_locked
>     txn_limbo_term_unlock
> 
> box_demote | box_promote_qsync | box_promote
>   txn_limbo_replica_term
>     txn_limbo_term_lock
>       txn_limbo_replica_term_locked
>     txn_limbo_term_unlock
> 
> 
> wal_stream_apply_synchro_row | box_issue_promote | box_issue_demote | memtx_engine_recover_synchro
>   txn_limbo_process
>     txn_limbo_term_lock
>       txn_limbo_filter_locked
>       txn_limbo_process_locked
>     txn_limbo_term_unlock
> 
> apply_synchro_row
>   txn_limbo_term_lock
>     txn_limbo_filter_locked
>     ** in-callback apply_synchro_row_cb -> txn_limbo_process_locked
>   txn_limbo_term_unlock
> 
> Thus we have:
> 
>  - big txn_limbo_process function which operates with locked promote term
>  - txn_limbo_replica_term inliner, which relies on txn_limbo_term_lock/unlock
>    being present in header file
>  - txn_limbo_is_replica_outdated inliner, which relies on lock/unlock being
>    exported as well
> 
> and apply_synchro_row as a special one which uses txn_limbo_process_locked
> internally when commit happens. Note that all the functions above use explicit
> lock/unlock inside single function, and even apply_synchro_row calls lock at
> start and unlock at exit.
> 
> Now if I gonna hide locking completely from usage ouside of limbo code I
> have to:
> 
> 1) Move txn_limbo_term_lock/txn_limbo_term_unlock into .c file, in result
>    txn_limbo_is_replica_outdated and txn_limbo_replica_term won't be
>    inliner anymore. Which is not critical I think but better to point out.
> 2) We inroduce txn_txn_limbo_process_begin/complete/rollback which are basically
>    the wrappers arount txn_limbo_process_locked (because txn_limbo_process
>    will remain as is). Thus we will have
> 
> txn_txn_limbo_process_begin()
>   txn_limbo_term_lock()
>   txn_limbo_filter_locked();
> 
> txn_txn_limbo_process_complete()
>   txn_limbo_process_locked()
>   txn_limbo_term_unlock
> 
> txn_txn_limbo_process_rollback
>   txn_limbo_term_unlock
> 
> And these three helpers looks very ugly. First of all they hide locking
> unlocking between functions, since there is no explicit lock/unlock
> in apply_synchro_row anymore. Do you really prefer this kind of
> design, or I miss something obvious?

They look consistent with txn_begin/commit/rollback. They hide the locking,
exactly. This is what I wanted to achieve, because I don't like that
the applier interferes into the limbo so hard. Yes, I would prefer this API.
Lets wait for Sergey's opinion too.

  reply	other threads:[~2021-08-10 12:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 19:07 [Tarantool-patches] [PATCH v10 0/4] limbo: implement packets filtering Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 1/4] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:29   ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06 15:20     ` Cyrill Gorcunov via Tarantool-patches
2021-08-08 14:34       ` Vladislav Shpilevoy via Tarantool-patches
2021-08-09 16:24         ` Cyrill Gorcunov via Tarantool-patches
2021-08-10 12:27           ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-08-10 12:57             ` Cyrill Gorcunov via Tarantool-patches
2021-08-23 11:32     ` Serge Petrenko via Tarantool-patches
2021-08-23 11:41       ` Cyrill Gorcunov via Tarantool-patches
2021-09-01 16:04         ` Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 3/4] limbo: filter incoming synchro requests Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:33   ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06 19:01     ` Cyrill Gorcunov via Tarantool-patches
2021-08-08 11:43       ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 22:35         ` Cyrill Gorcunov via Tarantool-patches
2021-08-10 12:31           ` Vladislav Shpilevoy via Tarantool-patches
2021-08-10 14:36             ` Cyrill Gorcunov via Tarantool-patches
2021-08-12 16:59               ` Vladislav Shpilevoy via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 4/4] test: add replication/gh-6036-rollback-confirm Cyrill Gorcunov via Tarantool-patches
2021-08-05  9:38 ` [Tarantool-patches] [PATCH v10 0/4] limbo: implement packets filtering Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:29 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 22:03   ` Cyrill Gorcunov via Tarantool-patches

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=1a58f1dc-bd03-7b45-a99f-389b9b37f325@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms' \
    /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