mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
228b7e4db5
This imports and adapts a number of MySQL 5.7 test cases that are applicable to MariaDB. Some tests for old bug fixes are not that relevant because the code has been refactored since then (especially starting with MariaDB Server 10.6), and the tests would not reproduce the original bug if the fix was reverted. In the test innodb_fts.opt, there are many duplicate MATCH ranks, which would make the results nondeterministic. The test was stabilized by changing some LIMIT clauses or by adding sorted_result in those cases where the purpose of a test was to show that no sorting took place in the server. In the test innodb_fts.phrase, MySQL 5.7 would generate FTS_DOC_ID that are 1 larger than in MariaDB. In innodb_fts.index_table the difference is 2. This is because in MariaDB, fts_get_next_doc_id() post-increments cache->next_doc_id, while MySQL 5.7 pre-increments it. Reviewed by: Thirunarayanan Balathandayuthapani
79 lines
2.5 KiB
Text
79 lines
2.5 KiB
Text
#
|
|
# Bug#18384390 WRONG STATISTICS WITH BIG ROW LENGTH AND PERSISTENT STATS
|
|
#
|
|
|
|
--source include/have_innodb.inc
|
|
--source include/have_innodb_max_16k.inc
|
|
--source include/have_sequence.inc
|
|
|
|
CREATE TABLE bug18384390 (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
txt VARCHAR(10000)
|
|
) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=0;
|
|
|
|
let $count=1024;
|
|
eval
|
|
INSERT INTO bug18384390 (txt) SELECT REPEAT('0', 10000) FROM seq_1_to_$count;
|
|
|
|
set use_stat_tables=never;
|
|
ANALYZE TABLE bug18384390;
|
|
|
|
-- let $n_rows = `SELECT n_rows FROM mysql.innodb_table_stats WHERE table_name = 'bug18384390'`
|
|
|
|
-- let $table_rows = `SELECT table_rows FROM information_schema.tables WHERE table_name = 'bug18384390'`
|
|
|
|
-- let $n_diff = `SELECT stat_value FROM mysql.innodb_index_stats WHERE table_name = 'bug18384390' AND stat_name = 'n_diff_pfx01'`
|
|
|
|
-- let $cardinality = `SELECT cardinality FROM information_schema.statistics WHERE table_name = 'bug18384390'`
|
|
|
|
-- let $margin_of_err_pct = 30
|
|
-- let $margin_of_err_rows = `SELECT ROUND($count * $margin_of_err_pct / 100)`
|
|
|
|
-- let $min_allowed = `SELECT $count - $margin_of_err_rows`
|
|
-- let $max_allowed = `SELECT $count + $margin_of_err_rows`
|
|
|
|
-- let $dump_sql = SELECT COUNT(*) FROM bug18384390; SELECT * FROM mysql.innodb_table_stats; SELECT * FROM mysql.innodb_index_stats; SELECT * FROM information_schema.tables WHERE table_name = 'bug18384390'; SELECT * FROM information_schema.statistics WHERE table_name = 'bug18384390';
|
|
|
|
-- vertical_results
|
|
|
|
if ($n_rows < $min_allowed) {
|
|
-- echo mysql.innodb_table_stats.n_rows is too small ($n_rows < $min_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($n_rows > $max_allowed) {
|
|
-- echo mysql.innodb_table_stats.n_rows is too big ($n_rows > $max_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($table_rows < $min_allowed) {
|
|
-- echo information_schema.tables.table_rows is too small ($table_rows < $min_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($table_rows > $max_allowed) {
|
|
-- echo information_schema.tables.table_rows is too big ($table_rows > $max_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($n_diff < $min_allowed) {
|
|
-- echo mysql.innodb_index_stats.stat_value is too small ($n_diff < $min_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($n_diff > $max_allowed) {
|
|
-- echo mysql.innodb_index_stats.stat_value is too big ($n_diff > $max_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($cardinality < $min_allowed) {
|
|
-- echo information_schema.statistics.cardinality is too small ($cardinality < $min_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
if ($cardinality > $max_allowed) {
|
|
-- echo information_schema.statistics.cardinality is too big ($cardinality > $max_allowed)
|
|
-- eval $dump_sql
|
|
}
|
|
|
|
DROP TABLE bug18384390;
|