facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.47k stars 711 forks source link

Remove Rdb_transaction::m_ddl_transaction #1391

Closed laurynas-biveinis closed 7 months ago

laurynas-biveinis commented 7 months ago

With DD tables in MyRocks, the property of whether it is safe to skip uniqueness checks on writes should be resolved on a table, not transaction level. Thus fold the logic of setting m_ddl_transaction to true into ha_rocksdb::skip_unique. At the same time this flag is duplicated between struct update_row_info and callstack of affected functions, thus remove it from the callstack.

laurynas-biveinis commented 7 months ago

This is done in preparation for always flushing DD transactions: it will require a new flag m_dd_transaction or similar in Rdb_transaction, which would have too similar a name yet completely different functionality from m_ddl_transaction. Thus removing the latter first.

laurynas-biveinis commented 7 months ago

@luqun , removed TABLE_CATEGORY_TEMPORARY and rebased; ready for review

facebook-github-bot commented 7 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 7 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

luqun commented 7 months ago

looks like rocksdb.rqg_runtime MTR failed. still investigating

luqun commented 7 months ago

looks like rocksdb.rqg_runtime MTR failed. still investigating

The issue is related to DDL skip uniq check, such as following code. Add PK should fail due to duplicate col2 value.

create table t1(col1 int, col2 int, col3 varchar(16));
insert into t1 values(0,0,'0');
insert into t1 values(1,0,'0');
ALTER TABLE t1 ADD KEY ( col1 );
ALTER TABLE t1 ADD PRIMARY KEY ( col2 );
check table t1;
laurynas-biveinis commented 7 months ago

The DDL transaction flag cannot be folded into unique check flag, the original design idea was broken. Thinking of alternatives

laurynas-biveinis commented 7 months ago

The DD durability PR is https://github.com/facebook/mysql-5.6/pull/1403. I will scavenge non-functional skip_unique_check cleanups from this PR

laurynas-biveinis commented 7 months ago

The cleanups are in https://github.com/facebook/mysql-5.6/pull/1404