Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add application defined sequential consistency for certification #237

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

temeo
Copy link
Contributor

@temeo temeo commented Nov 26, 2024

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.

@temeo temeo self-assigned this Nov 26, 2024
@temeo temeo force-pushed the seq_cb branch 2 times, most recently from 3b27be5 to aa122bf Compare November 28, 2024 10:59
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.
@temeo temeo force-pushed the seq_cb branch 4 times, most recently from 946bb24 to b063820 Compare November 28, 2024 12:57
- Release commit time critical section in callback
- Check the consistency inside commit order critical section

Other: Add 2pc switch to dbsim
@@ -495,7 +495,7 @@ int wsrep::transaction::before_commit()

if (ret == 0 && state() == s_prepared)
{
ret = certify_commit(lock);
ret = certify_commit(lock, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the logic is not changed here, but

  1. how can we be sure that certify_commit() is not called here for the second time after before_prepare() above?
  2. why nullptr this time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state is s_prepared, which is entered only during XA. XA commit fragment is always sent separately.

I'm not quite sure if it is correct to call the callback from XA commit fragment replication codepath, so passing nullptr keeps the old behavior.

@ayurchen ayurchen merged commit 7994288 into master Dec 3, 2024
26 checks passed
@temeo temeo deleted the seq_cb branch December 3, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants