| 1 |
##################### mysql-test\t\delay_key_write_func.test ################# |
| 2 |
# # |
| 3 |
# Variable Name: delay_key_write # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: enumeration # |
| 7 |
# Default Value: ON # |
| 8 |
# Valid Values: ON, OFF & ALL # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-03-08 # |
| 12 |
# Author: Rizwan # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable delay_key_write # |
| 15 |
# that checks the behavior of this variable # |
| 16 |
# # |
| 17 |
# Reference: # |
| 18 |
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # |
| 19 |
# # |
| 20 |
############################################################################### |
| 21 |
|
| 22 |
--echo '#--------------------FN_DYNVARS_023_01-------------------------#' |
| 23 |
SET @start_value= @@global.delay_key_write; |
| 24 |
|
| 25 |
--echo '#--------------------FN_DYNVARS_023_02-------------------------#' |
| 26 |
###################################################### |
| 27 |
# Begin the functionality Testing of delay_key_write # |
| 28 |
###################################################### |
| 29 |
|
| 30 |
# create procedure to add rows |
| 31 |
DELIMITER //; |
| 32 |
CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT) |
| 33 |
BEGIN |
| 34 |
WHILE (var1 < var2) DO |
| 35 |
INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1); |
| 36 |
SET var1=var1+1; |
| 37 |
END WHILE; |
| 38 |
END// |
| 39 |
DELIMITER ;// |
| 40 |
|
| 41 |
#============================================================================== |
| 42 |
--echo '---check when delay_key_write is OFF---' |
| 43 |
#============================================================================== |
| 44 |
|
| 45 |
SET @@global.delay_key_write = OFF; |
| 46 |
|
| 47 |
# create a table with delay_key_write enabled |
| 48 |
CREATE TABLE t1( |
| 49 |
a INT PRIMARY KEY, |
| 50 |
b VARCHAR(512), |
| 51 |
c DOUBLE |
| 52 |
) DELAY_KEY_WRITE = 1; |
| 53 |
|
| 54 |
FLUSH GLOBAL STATUS; |
| 55 |
|
| 56 |
CALL sp_addRecords(1,10); |
| 57 |
|
| 58 |
SHOW STATUS LIKE 'Key_reads'; |
| 59 |
SHOW STATUS LIKE 'Key_writes'; |
| 60 |
SHOW STATUS LIKE 'Key_write_requests'; |
| 61 |
SELECT COUNT(*) FROM t1; |
| 62 |
DROP TABLE t1; |
| 63 |
|
| 64 |
#============================================================================== |
| 65 |
--echo '----check when delay_key_write is ON---' |
| 66 |
#============================================================================== |
| 67 |
|
| 68 |
SET @@global.delay_key_write = ON; |
| 69 |
|
| 70 |
# create a table with delay_key_write enabled |
| 71 |
CREATE TABLE t1( |
| 72 |
a INT PRIMARY KEY, |
| 73 |
b VARCHAR(512), |
| 74 |
c DOUBLE |
| 75 |
) DELAY_KEY_WRITE = 1; |
| 76 |
|
| 77 |
FLUSH GLOBAL STATUS; |
| 78 |
CALL sp_addRecords(1,10); |
| 79 |
|
| 80 |
SHOW STATUS LIKE 'Key_reads'; |
| 81 |
SHOW STATUS LIKE 'Key_writes'; |
| 82 |
SHOW STATUS LIKE 'Key_write_requests'; |
| 83 |
SELECT COUNT(*) FROM t1; |
| 84 |
DROP TABLE t1; |
| 85 |
|
| 86 |
#============================================================================== |
| 87 |
--echo '----check when delay_key_write is ALL---' |
| 88 |
#============================================================================== |
| 89 |
SET @@global.delay_key_write = ALL; |
| 90 |
|
| 91 |
# create a table with delay_key_write disabled |
| 92 |
CREATE TABLE t1( |
| 93 |
a INT PRIMARY KEY, |
| 94 |
b VARCHAR(512), |
| 95 |
c DOUBLE |
| 96 |
) DELAY_KEY_WRITE = 0; |
| 97 |
|
| 98 |
FLUSH GLOBAL STATUS; |
| 99 |
CALL sp_addRecords(1,10); |
| 100 |
|
| 101 |
SHOW STATUS LIKE 'Key_reads'; |
| 102 |
SHOW STATUS LIKE 'Key_writes'; |
| 103 |
SHOW STATUS LIKE 'Key_write_requests'; |
| 104 |
SELECT COUNT(*) FROM t1; |
| 105 |
|
| 106 |
DROP PROCEDURE sp_addRecords; |
| 107 |
DROP TABLE t1; |
| 108 |
|
| 109 |
SET @@global.delay_key_write= @start_value; |
| 110 |
|
| 111 |
#################################################### |
| 112 |
# End of functionality testing for delay_key_write # |
| 113 |
#################################################### |