Skip to content

MDEV-39763 main.innodb_mrr_cpk fails under view protocol - #5343

Merged
grooverdan merged 1 commit into
MariaDB:12.3from
grooverdan:MDEV-39763
Jul 10, 2026
Merged

MDEV-39763 main.innodb_mrr_cpk fails under view protocol#5343
grooverdan merged 1 commit into
MariaDB:12.3from
grooverdan:MDEV-39763

Conversation

@grooverdan

Copy link
Copy Markdown
Member

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gkodinov gkodinov added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jul 6, 2026

@mariadb-RexJohnston mariadb-RexJohnston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mariadb-RexJohnston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@grooverdan
grooverdan enabled auto-merge (rebase) July 10, 2026 01:56
@grooverdan
grooverdan merged commit 27df566 into MariaDB:12.3 Jul 10, 2026
17 of 19 checks passed
@grooverdan
grooverdan deleted the MDEV-39763 branch July 10, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

3 participants