Re: [Maria-developers] 126a9b6db25: MDEV-18875 Assertion `thd->transaction.stmt.ha_list == __null || trans == &thd->transaction.stmt' failed or bogus ER_DUP_ENTRY upon ALTER TABLE with versioning
![](https://secure.gravatar.com/avatar/39b623a1559cf9c69ac3d9d4fb44e7fe.jpg?s=120&d=mm&r=g)
Hi, Nikita! On Apr 02, Nikita Malyavin wrote:
revision-id: 126a9b6db25 (mariadb-10.3.12-101-g126a9b6db25) parent(s): 1c60f40868f author: Nikita Malyavin
committer: Nikita Malyavin 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
![](https://secure.gravatar.com/avatar/be4a8eaa75d904276e4551aedf1f4b9b.jpg?s=120&d=mm&r=g)
Hi!
IIRC, rw_trans is false when the table was empty
On Tue, 2 Apr 2019 at 20:07, Sergei Golubchik
Hi, Nikita!
On Apr 02, Nikita Malyavin wrote:
revision-id: 126a9b6db25 (mariadb-10.3.12-101-g126a9b6db25) parent(s): 1c60f40868f author: Nikita Malyavin
committer: Nikita Malyavin 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
![](https://secure.gravatar.com/avatar/39b623a1559cf9c69ac3d9d4fb44e7fe.jpg?s=120&d=mm&r=g)
Hi, Nikita! On Apr 03, Nikita Malyavin wrote:
Hi!
IIRC, rw_trans is false when the table was empty
the code inside the if() is for (Ha_trx_info *ha_info= trans->ha_list; ha_info; ha_info= ha_info->next()) { if (ha_info->ht()->prepare_commit_versioned) { trx_end_id= ha_info->ht()->prepare_commit_versioned(thd, &trx_start_id); if (trx_end_id) break; // FIXME: use a common ID for cross-engine transactions } } Are you saying that when the table was empty, rw_trans is false, but ha_list is not empty and innodb->prepare_commit_versioned() returns a non-zero trx_end_id (that is, inside InnoDB, trx->mod_tables is not empty either)?
#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
participants (2)
-
Nikita Malyavin
-
Sergei Golubchik