Skip to content

MDEV-31342 Fix I_S fast-path follow-up bugs - #5752

Merged
janlindstrom merged 10 commits into
MariaDB:mainfrom
itzanway:MDEV-31342-fix-followups
Oct 23, 2026
Merged

janlindstrom merged 10 commits into
MariaDB:mainfrom
itzanway:MDEV-31342-fix-followups

Conversation

@itzanway

Copy link
Copy Markdown
Contributor

MDEV-31342 Fix I_S fast-path follow-up bugs

https://jira.mariadb.org/browse/MDEV-31342

The INFORMATION_SCHEMA.TABLES fast path streamed rows through the client protocol for statements that still need the normal result sink. That broke ANALYZE, SELECT INTO OUTFILE, SQL_BUFFER_RESULT, PROCEDURE ANALYSE(), and cursor-protocol execution.

LIMIT 1 also stopped after the first scanned table rather than the first matching row. sql_select_limit and FOUND_ROWS() were ignored.

Keep the fast path only for plain client SELECTs. Count matching rows so LIMIT, sql_select_limit, and FOUND_ROWS() are correct.

Related:

  • MDEV-41164 SELECT INTO OUTFILE
  • MDEV-41165 ANALYZE SELECT
  • MDEV-41167 LIMIT 1 missing row
  • MDEV-41171 SQL_SELECT_LIMIT and FOUND_ROWS()
  • MDEV-41196 SQL_BUFFER_RESULT
  • MDEV-41199 PROCEDURE ANALYSE()
  • MDEV-41204 --cursor-protocol

Test plan

  • ./mtr mdev_31342
  • ./mtr mdev_31342 --cursor-protocol

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Sep 24, 2026

@gkodinov gkodinov 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.

I believe we need to simplify the whole thing here.

Right now there's multiple Jiras and multiple pull requests. There's "main" Jira that has the base. And then multiple other jiras each holding some base and then an addon diff. And all of these things have different statuses.

I would suggest this whole feature be brought down to one jira and one pull request. Possibly with many commits in it as needed.
But it's kind of odd to use multiple jiras to track a single feature work IMHO. And the statuses discrepancies are not helping.

Please discuss this with your mentor. And consider my proposal above. Or give me good arguments on why this won't work.

Now on the immediate review:

There are test suite failures with this one. Are you sure it's ready for review?
And also there are suggested changes by Sanja in the jira that I do not see.

@itzanway
itzanway force-pushed the MDEV-31342-fix-followups branch from 7060de8 to db259f3 Compare October 1, 2026 05:16
@itzanway

itzanway commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@janlindstrom @gkodinov

This is now one PR for MDEV-31342, rebased on current main.
Original implementation is one commit; each follow-up MDEV is its own commit.

@itzanway
itzanway force-pushed the MDEV-31342-fix-followups branch from 9b94ab2 to d3339cd Compare October 1, 2026 05:51
@janlindstrom janlindstrom self-assigned this Oct 1, 2026

@janlindstrom janlindstrom 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.

Please remove all references to MDEVs on source code you added. Code comments should be self readable without needing to read JIRA.

Build failure is because of rocsdb and not caused by these changes.

Comment thread sql/sql_show.cc Outdated
Comment thread sql/sql_show.cc Outdated

@gkodinov gkodinov 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.

Thank you for cleaning this up! LGTM. Please keep working with Jan on the final review.

@itzanway
itzanway force-pushed the MDEV-31342-fix-followups branch from d3339cd to 1d166ae Compare October 14, 2026 16:34

@janlindstrom janlindstrom 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.

LGTM

…able writes

For simple single-schema SELECT queries on information_schema.tables,
bypass ha_write_tmp_row() and stream rows directly via the protocol.
Add EXPLAIN is_fast_path visibility and MTR coverage, including Windows
EXPLAIN casing normalization.
…EMA.TABLES

Stop the I_S.TABLES fast path after a matching row is sent, not after
the first scanned table. Honour LIMIT / @@sql_select_limit via
plan->max_rows so filtered rows do not count.
Set limit_found_rows from matching rows sent on the fast path so
FOUND_ROWS() matches the fallback path when SQL_CALC_FOUND_ROWS is
not used.
Keep the I_S.TABLES fast path only for plain client SELECTs. Fall back
when the result must go through a file, ANALYZE, SQL_BUFFER_RESULT,
PROCEDURE ANALYSE(), or the cursor protocol.
Add MTR coverage that ANALYZE SELECT uses the fallback path and does
not assert or send a double EOF.
Add MTR coverage that SQL_BUFFER_RESULT uses the fallback path and
returns the actual column values.
Add MTR coverage that PROCEDURE ANALYSE() is applied instead of being
silently ignored on the fast path.
Document that the I_S.TABLES fast path is disabled for cursor protocol
so MTR --cursor-protocol does not report ER_UNKNOWN_ERROR.
Do not use the fast path when the query has a subquery. Evaluating
that predicate while get_all_tables() uses a temporary MEM_ROOT
freed the subquery JOIN before outer JOIN cleanup.
Do not use the fast path when the statement uses a stored routine.
Evaluating that function during fill changes THD open-table state and
trips restore_backup_open_tables_state().
@janlindstrom
janlindstrom force-pushed the MDEV-31342-fix-followups branch from 1d166ae to 61b6ee0 Compare October 22, 2026 15:18
@janlindstrom
janlindstrom merged commit ee7b76a into MariaDB:main Oct 23, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants