← Back to team overview

maria-developers team mailing list archive

Re: 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

 

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@xxxxxxxxxxx


References