Skip to content

Commit

Permalink
MDEV-32901: innodb.mdev-14846 fails in 11.0
Browse files Browse the repository at this point in the history
InnoDB could return off-by-1 estimates for the involved tables.
This would cause off-by-many difference in join output cardinality
for the top-level SELECT, and so different query plan for the subquery.

The fix: Introduce mysql-test/include/innodb_stable_estimates.{inc,opt}
which disables InnoDB's background statistics collection, and use it.
  • Loading branch information
spetrunia committed Dec 5, 2023
1 parent 5c4c184 commit bd23b3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mysql-test/include/innodb_stable_estimates.inc
@@ -0,0 +1,12 @@
#
# Include this file in your .test file if your testcase uses InnoDB tables
# requiring stable query plans, which likely requires that InnoDB produces
# stable estimates for #records in tables.
#
# How it works:
# Unstable InnoDB estimates are caused by InnoDB's background statistics
# collection. When you include this file, MTR will use server options from
# include/innodb_stable_estimates.opt, which disables background statistics
# collection.
# (and no, InnoDB team objects to using this configuration for all MTR tests)
#
1 change: 1 addition & 0 deletions mysql-test/include/innodb_stable_estimates.opt
@@ -0,0 +1 @@
--innodb_stats_auto_recalc=0
2 changes: 2 additions & 0 deletions mysql-test/suite/innodb/t/mdev-14846.test
Expand Up @@ -2,6 +2,8 @@
--source include/count_sessions.inc
--source include/have_debug_sync.inc

--source include/innodb_stable_estimates.inc

CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
Expand Down

0 comments on commit bd23b3d

Please sign in to comment.