summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-06-12 13:24:23 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-06-12 16:16:02 +0300
commit4423f42da0ad4ae129afe696be5796e024e8e200 (patch)
treeed4e278f9743d76a32f2dc88af8e17eecdfb68b4 /mysql-test/include
parent8ec21afc8ed2df3b02815a45624b3287d5ffceae (diff)
downloadmariadb-git-bb-10.5-mdev15101.tar.gz
Apply this patch from Percona Server (amended for 10.5):bb-10.5-mdev15101
commit cd7201514fee78aaf7d3eb2b28d2573c76f53b84 Author: Laurynas Biveinis <laurynas.biveinis@gmail.com> Date: Tue Nov 14 06:34:19 2017 +0200 Fix bug 1704195 / 87065 / TDB-83 (Stop ANALYZE TABLE from flushing table definition cache) Make ANALYZE TABLE stop flushing affected tables from the table definition cache, which has the effect of not blocking any subsequent new queries involving the table if there's a parallel long-running query: - new table flag HA_ONLINE_ANALYZE, return it for InnoDB and TokuDB tables; - in mysql_admin_table, if we are performing ANALYZE TABLE, and the table flag is set, do not remove the table from the table definition cache, do not invalidate query cache; - in partitioning handler, refresh the query optimizer statistics after ANALYZE if the underlying handler supports HA_ONLINE_ANALYZE; - new testcases main.percona_nonflushing_analyze_debug, parts.percona_nonflushing_abalyze_debug and a supporting debug sync point. For TokuDB, this change exposes bug TDB-83 (Index cardinality stats updated for handler::info(HA_STATUS_CONST), not often enough for tokudb_cardinality_scale_percent). TokuDB may return different rec_per_key values depending on dynamic variable tokudb_cardinality_scale_percent value. The server does not have a way of knowing that changing this variable invalidates the previous rec_per_key values in any opened table shares, and so does not call info(HA_STATUS_CONST) again. Fix by updating rec_per_key for both HA_STATUS_CONST and HA_STATUS_VARIABLE. This also forces a re-record of tokudb.bugs.db756_card_part_hash_1_pick, with the new output seeming to be more correct.
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/percona_nonflushing_analyze_debug.inc32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/include/percona_nonflushing_analyze_debug.inc b/mysql-test/include/percona_nonflushing_analyze_debug.inc
new file mode 100644
index 00000000000..b2f6df51ab8
--- /dev/null
+++ b/mysql-test/include/percona_nonflushing_analyze_debug.inc
@@ -0,0 +1,32 @@
+#
+# Test ANALYZE TABLE that does not flush table definition cache
+# Arguments:
+# $percona_nonflushing_analyze_table - table to test
+#
+
+--source include/count_sessions.inc
+
+--connect con1,localhost,root
+
+SET DEBUG_SYNC="handler_ha_index_next_end SIGNAL idx_scan_in_progress WAIT_FOR finish_scan";
+
+send_eval SELECT * FROM $percona_nonflushing_analyze_table;
+
+--connection default
+
+SET DEBUG_SYNC="now WAIT_FOR idx_scan_in_progress";
+
+eval ANALYZE TABLE $percona_nonflushing_analyze_table;
+
+# With the bug fixed this should not block
+eval SELECT * FROM $percona_nonflushing_analyze_table;
+
+SET DEBUG_SYNC="now SIGNAL finish_scan";
+
+--connection con1
+reap;
+--disconnect con1
+--connection default
+SET DEBUG_SYNC='reset';
+
+--source include/wait_until_count_sessions.inc