mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
75 lines
2 KiB
Text
75 lines
2 KiB
Text
--source include/have_innodb.inc
|
|
--source include/no_valgrind_without_big.inc
|
|
#
|
|
# Test that mysqld does not crash when running ANALYZE TABLE with
|
|
# different values of the parameter innodb_stats_transient_sample_pages.
|
|
#
|
|
|
|
# we care only that the following SQL commands do not produce errors
|
|
# and do not crash the server
|
|
-- disable_query_log
|
|
-- enable_warnings
|
|
|
|
SET @save_sample_pages = @@GLOBAL.innodb_stats_transient_sample_pages;
|
|
SET @save_traditional = @@GLOBAL.innodb_stats_traditional;
|
|
SET GLOBAL innodb_stats_transient_sample_pages=0;
|
|
#use new method to calculate statistics
|
|
SET GLOBAL innodb_stats_traditional=0;
|
|
SHOW VARIABLES LIKE 'innodb_stats_transient_sample_pages';
|
|
SHOW VARIABLES LIKE 'innodb_stats_traditional';
|
|
-- disable_result_log
|
|
|
|
CREATE TABLE innodb_analyze (
|
|
a INT,
|
|
b INT,
|
|
c char(50),
|
|
KEY(a),
|
|
KEY(b,a)
|
|
) ENGINE=InnoDB;
|
|
|
|
# test with empty table
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=2;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=1;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=8000;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
delimiter //;
|
|
create procedure innodb_insert_proc (repeat_count int)
|
|
begin
|
|
declare current_num int;
|
|
set current_num = 0;
|
|
while current_num < repeat_count do
|
|
insert into innodb_analyze values(current_num, current_num*100,substring(MD5(RAND()), -44));
|
|
set current_num = current_num + 1;
|
|
end while;
|
|
end//
|
|
delimiter ;//
|
|
commit;
|
|
|
|
set autocommit=0;
|
|
call innodb_insert_proc(7000);
|
|
commit;
|
|
set autocommit=1;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=1;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=8;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=16;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
SET GLOBAL innodb_stats_transient_sample_pages=8000;
|
|
ANALYZE TABLE innodb_analyze;
|
|
|
|
DROP PROCEDURE innodb_insert_proc;
|
|
DROP TABLE innodb_analyze;
|
|
SET GLOBAL innodb_stats_transient_sample_pages = @save_sample_pages;
|
|
SET GLOBAL innodb_stats_traditional = @save_traditional;
|