1############# mysql-test\t\query_prealloc_size_func.test ######################
2#                                                                             #
3# Variable Name: query_prealloc_size                                          #
4# Scope: GLOBAL & SESSION                                                     #
5# Access Type: Dynamic                                                        #
6# Data Type: integer                                                          #
7# Default Value: 8192                                                         #
8# Values: 8192-4294967295                                                     #
9#                                                                             #
10#                                                                             #
11# Creation Date: 2008-02-22                                                   #
12# Author:  Sharique Abdullah                                                  #
13#                                                                             #
14# Description: Test Cases of Dynamic System Variable "query_prealloc_size"    #
15#              that checks behavior of this variable in the following ways    #
16#              * Default Value                                                #
17#              * Valid & Invalid values                                       #
18#              * Scope & Access method                                        #
19#              * Cache behaviors                                              #
20#                                                                             #
21# Reference:                                                                  #
22#   http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html       #
23#                                                                             #
24###############################################################################
25
26
27
28--echo ** Setup **
29--echo
30#
31# Setup
32#
33
34#
35# Save initial value
36#
37
38SET @start_value = @@global.query_prealloc_size;
39
40CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200));
41
42INSERT INTO t1 VALUES(NULL,'a');
43INSERT INTO t1 VALUES(NULL,'b');
44INSERT INTO t1 VALUES(NULL,'c');
45INSERT INTO t1 VALUES(NULL,'d');
46
47SELECT * FROM t1 ORDER BY val;
48
49SET SESSION query_prealloc_size = 8192;
50
51
52--echo '#----------------------------FN_DYNVARS_137_05-----------------#'
53#
54# Session data integrity check & GLOBAL Value check
55#
56
57SET GLOBAL query_prealloc_size = 8192;
58
59connect (con_int1,localhost,root,,);
60connection con_int1;
61
62SELECT @@SESSION.query_prealloc_size;
63--echo Expected Value : 8192;
64SET SESSION query_prealloc_size = 16384;
65
66connect (con_int2,localhost,root,,);
67connection con_int2;
68
69SELECT @@SESSION.query_prealloc_size;
70--echo Expected Value : 8192;
71
72SET SESSION query_prealloc_size = 8192;
73
74connection con_int1;
75SELECT @@SESSION.query_prealloc_size;
76--echo Expected Value : 16384;
77
78connection con_int2;
79SELECT @@SESSION.query_prealloc_size;
80--echo Expected Value : 8192;
81
82SELECT @@GLOBAL.query_prealloc_size;
83--echo Expected Value : 8192;
84
85connection default;
86disconnect con_int1;
87disconnect con_int2;
88
89DROP TABLE t1;
90
91SET @@global.query_prealloc_size = @start_value;
92
93