-
Notifications
You must be signed in to change notification settings - Fork 149
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
PXC-4173: PXC node stalls with parallel replication workers executing DDLs via async node #1927
Open
venkatesh-prasad-v
wants to merge
7
commits into
percona:8.0
Choose a base branch
from
venkatesh-prasad-v:8.0-PXC-4173-monitor
base: 8.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PXC-4173: PXC node stalls with parallel replication workers executing DDLs via async node #1927
venkatesh-prasad-v
wants to merge
7
commits into
percona:8.0
from
venkatesh-prasad-v:8.0-PXC-4173-monitor
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
September 18, 2024 09:16
45b94f6
to
91ab128
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
4 times, most recently
from
September 19, 2024 14:53
63a4df8
to
25c09e8
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
September 24, 2024 10:45
830bcf5
to
1a9149c
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
October 10, 2024 08:18
1a9149c
to
a1f0c52
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
10 times, most recently
from
November 18, 2024 05:42
30112dc
to
9387f0a
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 18, 2024 08:24
9387f0a
to
eafc945
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 18, 2024 13:51
eafc945
to
0972579
Compare
… DDLs via async node https://perconadev.atlassian.net/browse/PXC-4173 Problem ======= PXC replica could enter into a deadlock with multi threaded replication when --replica-preserve-commit-order is enabled. The deadlock is more likely to occur on a replica with --replica-preserve-commit-order enabled when the source server's workload consists of concurrent executions of DMLs and DDLs. In such a scenario, the replica shall try to commit them in the same order as that of the source which will conflict with galera's ordering resulting in a deadlock. MySQL ordering: Commits are serialized as per their commit order on source server. Galera ordering: Commits are serialized in a FIFO manner. Scenario ======== Let's assume we have the following two transactions in the relay log with same last_committed. T1: DML, seqno=10 T2: DDL, seqno=11 +-----------+--------------+-------------------------------------------------------+ | Timestamp | Thread | Activity | +-----------+--------------+-------------------------------------------------------+ | t0 | Co-ordinator | Assigns T1 to Applier-1 | +-----------+--------------+-------------------------------------------------------+ | t1 | Co-ordinator | Assigns T2 to Applier-2 | +-----------+--------------+-------------------------------------------------------+ | t2 | Applier-1 | DML starts with seqno = 10 | +-----------+--------------+-------------------------------------------------------+ | t3 | Applier-2 | DDL starts with seqno = 11 | +-----------+--------------+-------------------------------------------------------+ | t4 | Applier-2 | DDL calls TOI_begin(), acquires commit monitor | +-----------+--------------+-------------------------------------------------------+ | t5 | Applier-2 | DDL executes | +-----------+--------------+-------------------------------------------------------+ | t5 | Applier-1 | DML executes | +-----------+--------------+-------------------------------------------------------+ | t6 | Applier-2 | DDL reaches commit_order_manager, finds that | | | | it needs to wait until Applier-1 is committed | +-----------+--------------+-------------------------------------------------------+ | t7 | Applier-1 | DML reaches commit, calls commit_order_enter_local() | | | | and will wait for Applier-2 to release commit monitor | +-----------+--------------+-------------------------------------------------------+ In the end it will result in Applier-1: DML executing Xid_log_event::commit waiting for DDL to release commit order Applier-2: DDL executing ALTER TABLE waiting for applier-1 to commit first Solution ======== This commit introduces "Async Monitor" at server layer to ensure that the ordering in galera is done in the same order in the relay log. Async Monitor is similar to Commit Monitor used in galera, but differs in how seqnois are tracked within the monitor. The Async Monitor has the following methods. 1. schedule() - Schedules the transactions in as per their order in the the relay log. 2. enter() - Ensures that threads are serialized as per their order. 3. leave() - Ensures that threads are removed from the monitor in the serialized order. 4. skip() - Provides some flexibilty to the monitor to skip transactions. This will be required for handling skipped and filtered transactions. Lifetime of the Async Monitor: Async Monitor is created on START REPLICA and is destroyed on STOP REPLICA, or whenever applier thread exits.
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 18, 2024 13:54
0972579
to
fe1bd96
Compare
kamil-holubicki
requested changes
Nov 19, 2024
The commit message says about ordering transactions basing on their seqnos i not way this = prev + 1. But the code does it in a different way (I can understand that logically it is still the same). It would be good to add more details about how the current implementation actually works. |
@kamil-holubicki Description is updated |
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 25, 2024 06:48
91850b9
to
9b82c13
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 25, 2024 06:58
9b82c13
to
e1633a2
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
2 times, most recently
from
November 25, 2024 08:38
322713c
to
fe3375e
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 25, 2024 10:05
fe3375e
to
e3fc77b
Compare
- Fix the removal of seqnos from skipped_seqnos - Removed printfs - Use thd->system_thread instead of thd->slave_thread - Fixed wsrep applier thread calling monitor methods
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 25, 2024 10:10
e3fc77b
to
ba356c8
Compare
venkatesh-prasad-v
force-pushed
the
8.0-PXC-4173-monitor
branch
from
November 25, 2024 11:19
44a0910
to
562db79
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/PXC-4173