[Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms
gorcunov at gmail.com
Mon Aug 9 19:24:24 MSK 2021
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.
box_demote | box_promote_qsync | box_promote
wal_stream_apply_synchro_row | box_issue_promote | box_issue_demote | memtx_engine_recover_synchro
** in-callback apply_synchro_row_cb -> txn_limbo_process_locked
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
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
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?
More information about the Tarantool-patches