1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
|
--source suite/ndb_big/suite.inc
--source include/have_ndb.inc
--source suite/ndb/include/ndb_info.inc
--source suite/ndb/include/backup_restore_setup.inc
# --call mtr.force_restart()
set new=on;
select version();
#
# Table with many columns will fill up to 15% of memory
#
--let $num_cols= 125
--let $fill_percentage= 15
--echo # Table with $num_cols columns will fill up to $fill_percentage% of memory
--let $sql= CREATE TABLE manycol (pri int(11) NOT NULL
--let $c= $num_cols
while ($c)
{
--let $sql=$sql, c$c CHAR(2) NULL
--dec $c
}
--let $sql= $sql, PRIMARY KEY (pri)) ENGINE=NDB DEFAULT CHARSET=utf8 PARTITION BY HASH (pri)
--source suite/ndb_big/run_query_with_retry.inc
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage before inserts: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Inserting rows into the many columns table
--source suite/ndb_big/start_timer.inc
--disable_query_log
--let $row= 0
while (`SELECT $MTR_NDB_DATA_USAGE_PERCENTAGE < $fill_percentage`)
{
--let $sql= INSERT INTO manycol (pri
--let $c= $num_cols
while ($c)
{
--let $sql=$sql, c$c
--dec $c
}
--let $sql= $sql) VALUES
--let $separator=
--let $batch_size= 50
while ($batch_size)
{
--inc $row
--let $sql= $sql$separator($row
--let $c= $num_cols
while ($c)
{
--let $sql=$sql, 'ab'
--dec $c
}
--let $sql= $sql)
--dec $batch_size
--let $separator= ,
}
--source suite/ndb_big/run_query_with_retry.inc
--source suite/ndb/include/memory_usage.inc
# Workaround for bug#52464, since MTR caches --source file content in while loops
--eval SET @content = LOAD_FILE('$MYSQLTEST_VARDIR/tmp/ndb_memory_usage_result.inc')
--let $start= `SELECT LOCATE('=', @content) + 1`
--let $end = `SELECT LOCATE(CHAR(10), @content)`
--let $MTR_NDB_DATA_USAGE_PERCENTAGE= `SELECT CAST(TRIM(SUBSTR(@content, $start, $end - $start)) AS DECIMAL(10,2))`
}
--enable_query_log
--source suite/ndb_big/end_timer.inc
SELECT COUNT(*) AS 'Rows inserted into manycol table' FROM manycol;
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after inserts into manycol table: $MTR_NDB_DATA_USAGE_PERCENTAGE%
#
# Empty table
#
--echo # Empty table
CREATE TABLE empty (pri int(11) NOT NULL) ENGINE=NDB;
#
# Table with many data types
#
--let $fill_percentage= 25
--echo # Table with many column types will fill up to $fill_percentage% of memory
CREATE TABLE types (
pri int(11) NOT NULL,
ti TINYINT,
si SMALLINT,
mi MEDIUMINT,
bi BIGINT,
ft FLOAT(20),
tt FLOAT(40),
du DOUBLE,
nu NUMERIC(10, 5),
bt BIT(16),
da DATE,
tm TIME,
dt DATETIME,
ts TIMESTAMP,
ye YEAR,
ch CHAR(2),
bn BINARY,
vc VARCHAR(10),
vb VARBINARY(10),
en ENUM('one', 'two', 'three'),
se SET('one', 'two', 'three'),
PRIMARY KEY (pri)
) ENGINE=NDB DEFAULT CHARSET=utf8 PARTITION BY HASH (pri);
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage before inserts: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Inserting rows into the column types table
--source suite/ndb_big/start_timer.inc
--disable_query_log
--let $row= 0
while (`SELECT $MTR_NDB_DATA_USAGE_PERCENTAGE < $fill_percentage`)
{
--let $sql= INSERT INTO types (pri, ti, si, mi, bi, ft, tt, du, nu, bt, da, tm, dt, ts, ye, ch, bn, vc, vb, en, se) VALUES
--let $batch_size= 50
--let $separator=
while ($batch_size)
{
--inc $row
--let $sql= $sql$separator($row, 2, 3, 4, 5, 1.2, 3.14, 2.71, 42.42, b'1101', '1977-05-13', '01:23:45', '1980-01-02 01:34:54', NOW(), 2010, 'cd', b'10101', 'xyz', 'abc', 'one', 'one,two')
--dec $batch_size
--let $separator= ,
}
--source suite/ndb_big/run_query_with_retry.inc
--source suite/ndb/include/memory_usage.inc
# Workaround for bug#52464, since MTR caches --source file content in while loops
--eval SET @content = LOAD_FILE('$MYSQLTEST_VARDIR/tmp/ndb_memory_usage_result.inc')
--let $start= `SELECT LOCATE('=', @content) + 1`
--let $end = `SELECT LOCATE(CHAR(10), @content)`
--let $MTR_NDB_DATA_USAGE_PERCENTAGE= `SELECT CAST(TRIM(SUBSTR(@content, $start, $end - $start)) AS DECIMAL(10,2))`
}
--enable_query_log
--source suite/ndb_big/end_timer.inc
SELECT COUNT(*) AS 'Rows inserted into types table' FROM types;
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after inserts into types table: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after inserts: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
#
# Create extra indexes
#
--echo # Creating indexes
CREATE UNIQUE INDEX types_ints ON types (pri, ti, si, mi, bi);
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after create index 1: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after create index 1: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
CREATE UNIQUE INDEX types_dec ON types (ft, tt, du, nu, pri);
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after create index 2: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after create index 2: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
CREATE UNIQUE INDEX types_date ON types (ts, da, tm, dt, pri);
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after create index 3: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after create index 3: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
--source suite/ndb/include/memory_usage.inc
--echo # Index memory usage after creating secondary indexes: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
#
# Create BLOB (text) table
#
--echo # Table with BLOB(TEXT) columns
CREATE TABLE blobs (pri int(11) NOT NULL, data1 TEXT, data2 TEXT, PRIMARY KEY (pri)) ENGINE=NDB DEFAULT CHARSET=utf8 PARTITION BY HASH (pri);
--let $fill_percentage= 75
--echo # Inserting rows into the blobs table until $fill_percentage% memory fill
--source suite/ndb_big/start_timer.inc
--disable_query_log
--let $row= 0
while (`SELECT $MTR_NDB_DATA_USAGE_PERCENTAGE < $fill_percentage`)
{
--let $sql= INSERT INTO blobs(pri, data1, data2) VALUES
--let $batch_size= 50
--let $separator=
while ($batch_size)
{
--inc $row
--let $sql= $sql$separator($row, REPEAT('dt01', 10240 * RAND()), REPEAT('dt02', 1024 * RAND()))
--dec $batch_size
--let $separator= ,
}
--source suite/ndb_big/run_query_with_retry.inc
--source suite/ndb/include/memory_usage.inc
# Workaround for bug#52464, since MTR caches --source file content in while loops
--eval SET @content = LOAD_FILE('$MYSQLTEST_VARDIR/tmp/ndb_memory_usage_result.inc')
--let $start= `SELECT LOCATE('=', @content) + 1`
--let $end = `SELECT LOCATE(CHAR(10), @content)`
--let $MTR_NDB_DATA_USAGE_PERCENTAGE= `SELECT CAST(TRIM(SUBSTR(@content, $start, $end - $start)) AS DECIMAL(10,2))`
}
--enable_query_log
--source suite/ndb_big/end_timer.inc
SELECT COUNT(*) AS 'Rows inserted into blobs table' FROM blobs;
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after inserts into blobs table: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after inserts into blobs table: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
#
# Fill up with many tables, as long as memory/index usage < 95%
#
--let $fill_percentage= 95
--echo # Creating tables until $fill_percentage% memory/index fill is reached
--source suite/ndb_big/start_timer.inc
--disable_query_log
--let $table_id= 0
while (`SELECT $MTR_NDB_DATA_USAGE_PERCENTAGE < $fill_percentage AND $MTR_NDB_INDEX_USAGE_PERCENTAGE < $fill_percentage AND $table_id < 1500`)
{
--inc $table_id
--let sql=CREATE TABLE t$table_id (c1 int(11) NOT NULL, c3 text, PRIMARY KEY (c1)) ENGINE=NDB DEFAULT CHARSET=utf8 PARTITION BY HASH (c1)
--source suite/ndb_big/run_query_with_retry.inc
--let $rows= 100
--let $batch_size= 50
--let $i= `SELECT $rows / $batch_size`
while ($i)
{
--let $batch= $batch_size
let $separator= ;
--let $sql= INSERT t$table_id (c1, c3) VALUES
while($batch)
{
--let $sql=$sql$separator(($i*$batch_size)+$batch, REPEAT('ks87', 128*RAND()))
--dec $batch
--let $separator = ,
}
--source suite/ndb_big/run_query_with_retry.inc
--dec $i
}
--source suite/ndb/include/memory_usage.inc
# Workaround for bug#52464, since MTR caches --source file content in while loops
--eval SET @content = LOAD_FILE('$MYSQLTEST_VARDIR/tmp/ndb_memory_usage_result.inc')
--let $start= `SELECT LOCATE('=', @content) + 1`
--let $end = `SELECT LOCATE(CHAR(10), @content)`
--let $MTR_NDB_DATA_USAGE_PERCENTAGE= `SELECT CAST(TRIM(SUBSTR(@content, $start, $end - $start)) AS DECIMAL(10,2))`
--let $index_start= `SELECT LOCATE('=', @content, $start) + 1`
--let $index_end = `SELECT LOCATE(CHAR(10), @content, $end + 1)`
--let $MTR_NDB_INDEX_USAGE_PERCENTAGE= `SELECT CAST(TRIM(SUBSTR(@content, $index_start, $index_end - $index_start)) AS DECIMAL(10,2))`
# --echo # After table t$table_id: data: $MTR_NDB_DATA_USAGE_PERCENTAGE%, index: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
}
--echo # Num tables: $table_id
--source suite/ndb/include/memory_usage.inc
--echo # Memory usage after inserts into many tables table: $MTR_NDB_DATA_USAGE_PERCENTAGE%
--echo # Index memory usage after inserts into many tables table: $MTR_NDB_INDEX_USAGE_PERCENTAGE%
--append_file $NDB_TOOLS_OUTPUT
# ndb_mgm -e "ALL REPORT MemoryUsage"
EOF
--exec $NDB_MGM -e "ALL REPORT MemoryUsage" >> $NDB_TOOLS_OUTPUT
## Backup
--echo # Starting backup:
--source suite/ndb_big/start_timer.inc
--source include/ndb_backup.inc
--source suite/ndb_big/end_timer.inc
## Random node restart
--source suite/ndb_big/start_timer.inc
--source suite/ndb/include/restart_random_node.inc
--source suite/ndb_big/end_timer.inc
## System restart
--source suite/ndb_big/start_timer.inc
--source suite/ndb/include/restart_cluster.inc
--source suite/ndb_big/end_timer.inc
## Rolling system restart
--source suite/ndb_big/start_timer.inc
--source suite/ndb/include/restart_cluster_rolling.inc
--source suite/ndb_big/end_timer.inc
## Clean up
--echo # Dropping tables:
--let $t= $table_id
--source suite/ndb_big/start_timer.inc
while ($t)
{
--let $sql=drop table t$t
--source suite/ndb_big/run_query_with_retry.inc
--dec $t
}
--source suite/ndb_big/end_timer.inc
DROP TABLE blobs;
DROP TABLE types;
DROP TABLE manycol;
DROP TABLE empty;
--source suite/ndb/include/backup_restore_cleanup.inc
## Test suceeded
exit;
--remove_file $NDB_TOOLS_OUTPUT
|