-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
MDEV-35658 Assertion `commit_trx' failed in test galera_as_master #3753
base: 10.6
Are you sure you want to change the base?
Conversation
|
I don’t know the replication code at all. Perhaps @andrelkin or @knielsen would be better reviewers? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the l.7764 note the patch looks good.
sql/log.cc
Outdated
@@ -7761,7 +7761,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, | |||
{ | |||
DBUG_RETURN(0); | |||
} | |||
else if (!(thd->variables.option_bits & OPTION_BIN_LOG)) | |||
else if (!WSREP(thd) && !(thd->variables.option_bits & OPTION_BIN_LOG)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to isolate !WSREP(thd) &&
with
#ifdef WITH_WSREP
!WSREP(thd) &&
#endif
which would be also consistent with l.8671.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now.
The test issues a simple INSERT statement, while sql_log_bin = 0. This option disables writes to binlog. However, since MDEV-7205, the option does not affect Galera, so changes are still replicated. So sql_log_bin=off, "partially" disabled the binlog and the INSERT will involve both binlog and innodb, thus requiring internal 2 phase commit (2PC). In 2PC INSERT is first prepared, which will make it transition to PREPARED state in innodb, and later committed which causes the new assertion from MDEV-24035 to fail. Running the same test with sql_log_bin enabled also results in 2PC, but the execution has one more step for ordered commit, between prepare and commit. Ordered commit causes the transaction state to transition back to TRX_STATE_NOT_STARTED. Thus avoiding the assertion. This patch makes sure that when sql_log_bin=off, the ordered commit step is not skipped, thus going through the expected state transitions in the storage engine.
ab148fc
to
c0abe2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Fix assertion
commit_trx
in innobase_commit() during MTR test galera.galera_as_master.The test issues a simple INSERT statement, while sql_log_bin = 0. This option disables writes to binlog. However, since MDEV-7205, the option does not affect Galera, so changes are still replicated. So sql_log_bin=off, "partially" disabled the binlog and the INSERT will involve both binlog and innodb, thus requiring internal 2 phase commit (2PC). In 2PC INSERT is first prepared, which will make it transition to PREPARED state in innodb, and later committed which causes the new assertion from MDEV-24035 to fail.
Running the same test with sql_log_bin enabled also results in 2PC, but the execution has one more step for ordered commit, between prepare and commit. Ordered commit causes the transaction state to transition back to TRX_STATE_NOT_STARTED. Thus avoiding the assertion. This patch makes sure that when sql_log_bin=off, the ordered commit step is not skipped, thus going through the expected state transitions in the storage engine.
Release Notes
Nothing.
How can this PR be tested?
Should fix MTR test galera.galera_as_master.
Basing the PR against the correct MariaDB version
main
branch.PR quality check