MDEV-39763 main.innodb_mrr_cpk fails under view protocol - #5343
Conversation
There was a problem hiding this comment.
Code Review
This pull request disables the view protocol around a specific test block in mysql-test/main/innodb_mrr_cpk.test to prevent overlapping fieldnames from causing ER_DUP_FIELDNAME errors, which was impacting the EXPLAIN output when index condition pushdown is disabled. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
We can use include/innodb_stable_estimates.inc at the start of the file.
When you are trimming out columns in the select clause to make the query view compatible, can you make sure that you include as many of the columns as you can and include at least one column from each of the tables?
So in this case,
explain select * from t1, t2 where t1.a=t2.a;
you changed it to
explain select t1.a from t1, t2 where t1.a=t2.a;
there is no guarantee that the plan won't change (tho in this case it didn't).
explain select t1.a, t1.b, t1.filler from t1, t2 where t1.a=t2.a;
Should ensure the same plan (in general)
mariadb-RexJohnston
left a comment
There was a problem hiding this comment.
Correct the commit message and we are good to go.
The rows returned by this under view protocol where inconsistent. Under view protocol the CREATE VIEW in a different connection was providing statistics that ended up in the result. To normalize the output: * include/innodb_stable_estimates.inc for the test * Use analyze with persistent stats on the tables. Despite the CREATE VIEW being executed under view protocol, it always failed as most cases in the test had t1 and t2 with the same columns names and a SELECT * FROM t1,t2 form of query. Creating a view from this query resulting in duplicate result field names which can't happen in a view. To make the view protocol useful the SELECT queries where modified to return columns from both tables with different result field names. Thanks Rex Johnston for guidance.
Since 12.3, this test has been failing under view protocol.
During the creation of the view for ICP=off, the ha_innobase::info_low gains a measurement of the nuber of rows. This measurement showed up in the explain output as a difference in row number despite no query plan change.
The majority of the SELECT statements in this test are of the form:
SELECT * FROM t1,t2 ..
where t1 and t2 have a significant overlap in column names. The creation of the view ultimately fails with ER_DUP_FIELDNAME. No view protocol is exercised for the majority of the tests.
As such, disabled the view protocol for the portion of tests that resulted in ER_DUP_FIELDNAME when a view of them is created.