Hi! IIRC, rw_trans is false when the table was empty On Tue, 2 Apr 2019 at 20:07, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Nikita!
On Apr 02, Nikita Malyavin wrote:
revision-id: 126a9b6db25 (mariadb-10.3.12-101-g126a9b6db25) parent(s): 1c60f40868f author: Nikita Malyavin <nikitamalyavin@gmail.com> committer: Nikita Malyavin <nikitamalyavin@gmail.com> timestamp: 2019-03-23 03:37:10 +1000 message:
MDEV-18875 Assertion `thd->transaction.stmt.ha_list == __null || trans == &thd->transaction.stmt' failed or bogus ER_DUP_ENTRY upon ALTER TABLE with versioning
diff --git a/sql/handler.cc b/sql/handler.cc index e01392d236c..9d295afb631 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1420,7 +1420,8 @@ int ha_commit_trans(THD *thd, bool all)
#if 1 // FIXME: This should be done in ha_prepare(). if (rw_trans || (thd->lex->sql_command == SQLCOM_ALTER_TABLE && - thd->lex->alter_info.flags & ALTER_ADD_SYSTEM_VERSIONING)) + thd->lex->alter_info.flags & ALTER_ADD_SYSTEM_VERSIONING && + is_real_trans))
Why there's a special check for SQLCOM_ALTER_TABLE + ALTER_ADD_SYSTEM_VERSIONING in the first place?
Does it mean that ALTER TABLE ... ADD SYSTEM VERSIONING does not marks a transaction as read/write? That's be weird.
Regards, Sergei Chief Architect MariaDB and security@mariadb.org
-- Yours truly, Nikita Malyavin