1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

Add application defined sequential consistency for certification

Client state methods before_prepare() and before_commit() accept
a callback which is called by the provider after it can guarantee
sequential consistency. This allows application threads which wish to
maintain sequential consistency to enter before_prepare() and
before_commit() calls concurrently without waiting the prior call
to finish.
This commit is contained in:
Teemu Ollakka
2024-11-21 14:29:11 +02:00
parent 1c61b809d1
commit 3de594b662
9 changed files with 113 additions and 31 deletions

View File

@ -413,11 +413,49 @@ namespace wsrep
/** @name Commit ordering interface */
/** @{ */
int before_prepare();
/**
* This method should be called before the transaction
* is prepared. This call certifies the transaction and
* assigns write set meta data.
*
* @param seq_cb Callback which is passed to underlying
* certify() call. See wsrep::provider::certify().
*
* @return Zero on success, non-zero on failure.
*/
int before_prepare(const wsrep::provider::seq_cb_t* seq_cb);
/** Same as before_prepare() above, but nullptr is passed
* to seq_cb. */
int before_prepare()
{
return before_prepare(nullptr);
}
int after_prepare();
int before_commit();
/**
* This method should be called before transaction is committed.
* This call makes the transaction to enter commit time
* critical section. The critical section is left by calling
* ordered_commit().
*
* If before_prepare() is not called before this call, the
* before_prepare() is called internally.
*
* @param seq_cb Callback which is passed to underlying
* before_prepare() call.
*
* @return Zero on success, non-zero on failure.
*/
int before_commit(const wsrep::provider::seq_cb_t* seq_cb);
/** Same as before_commit(), but nullptr is passed to seq_cb. */
int before_commit()
{
return before_commit(nullptr);
}
int ordered_commit();