We are debugging a crash induced by RQG in the tokudb storage engine.   The cause of the crash is a mismatch in assumptions about the sequence of storage engine API calls.

We see:

tokudb::external_lock creates a txn

tokudb::index_init creates a cursor on a index db with the txn

tokudb::index_read use the cursor to try to read a row, and returns an error

tokudb_commit commits the txn (called from sql_parse.cc:4584)

tokudb::index_end tries to close the cursor and crashes since the txn has been committed. (called from the unit.cleanup() call at sql_parse.cc:4592)

The current tokudb software does not expect the commit to occur before index_end is called.  Is this assumption correct?  Since mariadb (and i suspect mysql) does this, it appears that the storage engine should expect commit before index_end.  Any comments?

Thanks
Rich Prohaska