~percona-toolkit-dev/percona-toolkit/fix-empty-table-bug-987393

« back to all changes in this revision

Viewing changes to t/lib/bash/report_mysql_info.sh

  • Committer: Daniel Nichter
  • Date: 2012-04-03 16:14:55 UTC
  • mfrom: (217.6.22 2.0.3)
  • Revision ID: daniel@percona.com-20120403161455-ntv33vju9o6njtqv
Merge summary-tools-2.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
 
 
3
plan 32
 
4
 
 
5
. "$LIB_DIR/alt_cmds.sh"
 
6
. "$LIB_DIR/log_warn_die.sh"
 
7
. "$LIB_DIR/summary_common.sh"
 
8
. "$LIB_DIR/report_formatting.sh"
 
9
. "$LIB_DIR/report_mysql_info.sh"
 
10
 
 
11
TMPDIR="$TEST_TMPDIR"
 
12
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
 
13
TOOL="pt-mysql-summary"
 
14
 
 
15
samples="$PERCONA_TOOLKIT_BRANCH/t/pt-mysql-summary/samples"
 
16
NAME_VAL_LEN=20
 
17
# ###########################################################################
 
18
# table_cache
 
19
# ###########################################################################
 
20
 
 
21
rm $TMPDIR/table_cache_tests 2>/dev/null
 
22
touch $TMPDIR/table_cache_tests
 
23
 
 
24
is                                                  \
 
25
   $(get_table_cache "$TMPDIR/table_cache_tests")   \
 
26
   0                                                \
 
27
   "0 if neither table_cache nor table_open_cache are present"
 
28
 
 
29
cat <<EOF > $TMPDIR/table_cache_tests
 
30
table_cache       5
 
31
table_open_cache  4
 
32
EOF
 
33
 
 
34
is                                                 \
 
35
   $(get_table_cache "$TMPDIR/table_cache_tests")  \
 
36
   4                                               \
 
37
   "If there's a table_open_cache present, uses that"
 
38
 
 
39
cat <<EOF > $TMPDIR/table_cache_tests
 
40
table_cache       5
 
41
EOF
 
42
 
 
43
is                                                 \
 
44
   $(get_table_cache "$TMPDIR/table_cache_tests")  \
 
45
   5                                               \
 
46
   "Otherwise, defaults to table_cache"
 
47
 
 
48
# ###########################################################################
 
49
# summarize_processlist
 
50
# ###########################################################################
 
51
 
 
52
cat <<EOF > $TMPDIR/expected
 
53
 
 
54
  Command                        COUNT(*) Working SUM(Time) MAX(Time)
 
55
  ------------------------------ -------- ------- --------- ---------
 
56
  Binlog Dump                           1       1   9000000   9000000
 
57
  Connect                               2       2   6000000   5000000
 
58
  Query                                 2       2         0         0
 
59
  Sleep                               150       0    150000     20000
 
60
 
 
61
  User                           COUNT(*) Working SUM(Time) MAX(Time)
 
62
  ------------------------------ -------- ------- --------- ---------
 
63
  acjcxx                                4       0         0         0
 
64
  aecac                                 1       0         0         0
 
65
  babeecc                              20       0         0         0
 
66
  centous                               2       0         0         0
 
67
  crcpcpc                               2       0         0         0
 
68
  crgcp4c                               3       0         0         0
 
69
  eanecj                               30       1         0         0
 
70
  ebace                                10       0         0         0
 
71
  etace                                80       0         0         0
 
72
  goate                                 8       0         0         0
 
73
  qjveec                                1       0         0         0
 
74
  repl                                  1       1   9000000   9000000
 
75
  root                                  1       1         0         0
 
76
  system user                           2       2   6000000   5000000
 
77
 
 
78
  Host                           COUNT(*) Working SUM(Time) MAX(Time)
 
79
  ------------------------------ -------- ------- --------- ---------
 
80
  10.14.82.196                          6       0         0         0
 
81
  10.14.82.202                         20       0         0         0
 
82
  10.17.85.100                          9       0         0         0
 
83
  10.17.85.74                           1       1   9000000   9000000
 
84
  10.17.85.86                          35       0         0         0
 
85
  10.17.85.88                           5       0         0         0
 
86
  10.17.85.90                          10       0         0         0
 
87
  10.36.34.66                          35       1         0         0
 
88
                                        2       2   6000000   5000000
 
89
  localhost                             1       1         0         0
 
90
  someserver.woozle.com11               1       0         0         0
 
91
  someserver.woozle.com14               1       0         0         0
 
92
  someserver.woozle.com                40       0         0         0
 
93
 
 
94
  db                             COUNT(*) Working SUM(Time) MAX(Time)
 
95
  ------------------------------ -------- ------- --------- ---------
 
96
  aetecjc                             175       1         0         0
 
97
  NULL                                  4       4  15000000   9000000
 
98
 
 
99
  State                          COUNT(*) Working SUM(Time) MAX(Time)
 
100
  ------------------------------ -------- ------- --------- ---------
 
101
                                      150       0         0         0
 
102
  Has read all relay log; waitin        1       1    300000    300000
 
103
  Has sent all binlog to slave;         1       1   9000000   9000000
 
104
  NULL                                  2       2         0         0
 
105
  Waiting for master to send eve        1       1   5000000   5000000
 
106
 
 
107
EOF
 
108
 
 
109
summarize_processlist "$samples/processlist-001.txt" > "$TMPDIR/got"
 
110
no_diff "$TMPDIR/got" "$TMPDIR/expected" "summarize_processlist"
 
111
 
 
112
 
 
113
# ###########################################################################
 
114
# summarize_binlogs
 
115
# ###########################################################################
 
116
NAME_VAL_LEN=25
 
117
cat <<EOF > "$TMPDIR/expected"
 
118
                  Binlogs | 20
 
119
               Zero-Sized | 3
 
120
               Total Size | 6.5G
 
121
EOF
 
122
 
 
123
summarize_binlogs "$samples/mysql-master-logs-001.txt" > "$TMPDIR/got"
 
124
no_diff "$TMPDIR/expected" "$TMPDIR/got" "summarize_binlogs"
 
125
 
 
126
# ###########################################################################
 
127
# Reporting semisync replication
 
128
# ###########################################################################
 
129
 
 
130
cat <<EOF > "$TMPDIR/expected"
 
131
   master semisync status | 
 
132
       master trace level | 32, net wait (more information about network waits)
 
133
master timeout in milliseconds | 10000
 
134
  master waits for slaves | ON
 
135
           master clients | 
 
136
 master net_avg_wait_time | 
 
137
     master net_wait_time | 
 
138
         master net_waits | 
 
139
          master no_times | 
 
140
             master no_tx | 
 
141
 master timefunc_failures | 
 
142
  master tx_avg_wait_time | 
 
143
      master tx_wait_time | 
 
144
          master tx_waits | 
 
145
master wait_pos_backtraverse | 
 
146
     master wait_sessions | 
 
147
            master yes_tx | 
 
148
EOF
 
149
 
 
150
_semi_sync_stats_for "master" "$samples/mysql-variables-with-semisync.txt" > "$TMPDIR/got"
 
151
no_diff "$TMPDIR/expected" "$TMPDIR/got" "semisync replication"
 
152
 
 
153
# ###########################################################################
 
154
# pretty_print_cnf_file
 
155
# ###########################################################################
 
156
 
 
157
cat <<EOF > $TMPDIR/expected
 
158
 
 
159
[mysqld]
 
160
datadir                             = /mnt/data/mysql
 
161
socket                              = /mnt/data/mysql/mysql.sock
 
162
old_passwords                       = 1
 
163
ssl-key                             = /opt/mysql.pdns/.cert/server-key.pem
 
164
ssl-cert                            = /opt/mysql.pdns/.cert/server-cert.pem
 
165
ssl-ca                              = /opt/mysql.pdns/.cert/ca-cert.pem
 
166
innodb_buffer_pool_size             = 16M
 
167
innodb_flush_method                 = O_DIRECT
 
168
innodb_log_file_size                = 64M
 
169
innodb_log_buffer_size              = 1M
 
170
innodb_flush_log_at_trx_commit      = 2
 
171
innodb_file_per_table               = 1
 
172
ssl                                 = 1
 
173
server-id                           = 1
 
174
log-bin                             = sl1-bin
 
175
 
 
176
[mysql.server]
 
177
user                                = mysql
 
178
basedir                             = /mnt/data
 
179
 
 
180
[mysqld_safe]
 
181
log-error                           = /var/log/mysqld.log
 
182
pid-file                            = /var/run/mysqld/mysqld.pid
 
183
 
 
184
[mysql]
 
185
 
 
186
[xtrabackup]
 
187
target-dir                          = /data/backup
 
188
EOF
 
189
 
 
190
pretty_print_cnf_file "$samples/my.cnf-001.txt" > "$TMPDIR/got"
 
191
no_diff "$TMPDIR/got" "$TMPDIR/expected" "pretty_print_cnf_file"
 
192
 
 
193
 
 
194
# TODO BUG NUMBER#
 
195
cp "$samples/my.cnf-001.txt" "$TMPDIR/test_pretty_print_cnf_file"
 
196
echo "some_var_yadda=0" >> "$TMPDIR/test_pretty_print_cnf_file"
 
197
echo "some_var_yadda                      = 0" >> "$TMPDIR/expected"
 
198
 
 
199
pretty_print_cnf_file "$TMPDIR/test_pretty_print_cnf_file" > "$TMPDIR/got"
 
200
no_diff "$TMPDIR/got" "$TMPDIR/expected" "pretty_print_cnf_file, bug XXXXXX"
 
201
 
 
202
 
 
203
# ###########################################################################
 
204
# plugin_status
 
205
# ###########################################################################
 
206
 
 
207
cat <<EOF > $TMPDIR/plugins
 
208
binlog   ACTIVE   STORAGE ENGINE NULL  GPL
 
209
partition   ACTIVE   STORAGE ENGINE NULL  GPL
 
210
ARCHIVE  ACTIVE   STORAGE ENGINE NULL  GPL
 
211
BLACKHOLE   ACTIVE   STORAGE ENGINE NULL  GPL
 
212
CSV   ACTIVE   STORAGE ENGINE NULL  GPL
 
213
FEDERATED   DISABLED STORAGE ENGINE NULL  GPL
 
214
MEMORY   ACTIVE   STORAGE ENGINE NULL  GPL
 
215
InnoDB   ACTIVE   STORAGE ENGINE NULL  GPL
 
216
MyISAM   ACTIVE   STORAGE ENGINE NULL  GPL
 
217
MRG_MYISAM  ACTIVE   STORAGE ENGINE NULL  GPL
 
218
EOF
 
219
 
 
220
is \
 
221
   "$(get_plugin_status $TMPDIR/plugins InnoDB )"  \
 
222
   "ACTIVE"                                  \
 
223
   "Sanity test, finds InnoDB as active"
 
224
 
 
225
is \
 
226
   "$(get_plugin_status $TMPDIR/plugins some_plugin_that_doesnt_exist )"  \
 
227
   "Not found"                                  \
 
228
   "Doesn't find a nonexistent plugin"
 
229
 
 
230
echo "INNODB_CMP  ACTIVE" >> $TMPDIR/plugins
 
231
is \
 
232
   "$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )"  \
 
233
   "ACTIVE"
 
234
 
 
235
cat <<EOF > $TMPDIR/plugins
 
236
binlog   ACTIVE   STORAGE ENGINE NULL  GPL
 
237
mysql_native_password   ACTIVE   AUTHENTICATION NULL  GPL
 
238
mysql_old_password   ACTIVE   AUTHENTICATION NULL  GPL
 
239
MRG_MYISAM  ACTIVE   STORAGE ENGINE NULL  GPL
 
240
MyISAM   ACTIVE   STORAGE ENGINE NULL  GPL
 
241
CSV   ACTIVE   STORAGE ENGINE NULL  GPL
 
242
MEMORY   ACTIVE   STORAGE ENGINE NULL  GPL
 
243
FEDERATED   DISABLED STORAGE ENGINE NULL  GPL
 
244
ARCHIVE  ACTIVE   STORAGE ENGINE NULL  GPL
 
245
BLACKHOLE   ACTIVE   STORAGE ENGINE NULL  GPL
 
246
InnoDB   ACTIVE   STORAGE ENGINE NULL  GPL
 
247
INNODB_TRX  ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
248
INNODB_LOCKS   ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
249
INNODB_LOCK_WAITS ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
250
INNODB_CMP  ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
251
INNODB_CMP_RESET  ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
252
INNODB_CMPMEM  ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
253
INNODB_CMPMEM_RESET  ACTIVE   INFORMATION SCHEMA   NULL  GPL
 
254
PERFORMANCE_SCHEMA   ACTIVE   STORAGE ENGINE NULL  GPL
 
255
partition   ACTIVE   STORAGE ENGINE NULL  GPL
 
256
EOF
 
257
 
 
258
is \
 
259
   "$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )"  \
 
260
   "ACTIVE"                                              \
 
261
   "Doesn't get confused by multiple plugins with the same prefix"
 
262
 
 
263
# ###########################################################################
 
264
# parse_mysqld_instances
 
265
# ###########################################################################
 
266
 
 
267
_NO_FALSE_NEGATIVES=1
 
268
 
 
269
cat <<EOF > $TMPDIR/expected
 
270
  Port  Data Directory             Nice OOM Socket
 
271
  ===== ========================== ==== === ======
 
272
   3306 /var/lib/mysql             ?    ?   /var/run/mysqld/mysqld.sock
 
273
  12345 /tmp/12345/data            ?    ?   /tmp/12345/mysql_sandbox12345.sock
 
274
  12346 /tmp/12346/data            ?    ?   /tmp/12346/mysql_sandbox12346.sock
 
275
EOF
 
276
touch "$TMPDIR/empty"
 
277
parse_mysqld_instances "$samples/ps-mysqld-001.txt" "$TMPDIR/empty" > "$TMPDIR/got"
 
278
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-001.txt"
 
279
 
 
280
cat <<EOF > "$TMPDIR/expected"
 
281
  Port  Data Directory             Nice OOM Socket
 
282
  ===== ========================== ==== === ======
 
283
        /var/lib/mysql             ?    ?   /var/lib/mysql/mysql.sock
 
284
EOF
 
285
parse_mysqld_instances "$samples/ps-mysqld-002.txt" "$TMPDIR/empty" > "$TMPDIR/got"
 
286
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-002.txt"
 
287
 
 
288
#parse_mysqld_instances
 
289
cat <<EOF > $TMPDIR/expected
 
290
  Port  Data Directory             Nice OOM Socket
 
291
  ===== ========================== ==== === ======
 
292
   3306 /mnt/data-store/mysql/data ?    ?   /tmp/mysql.sock
 
293
EOF
 
294
parse_mysqld_instances "$samples/ps-mysqld-003.txt" "$TMPDIR/empty" > "$TMPDIR/got"
 
295
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-003.txt"
 
296
 
 
297
cat <<EOF > "$TMPDIR/expected"
 
298
  Port  Data Directory             Nice OOM Socket
 
299
  ===== ========================== ==== === ======
 
300
        /var/db/mysql              ?    ?   
 
301
EOF
 
302
 
 
303
cat <<EOF > "$TMPDIR/in"
 
304
mysql   767  0.0  0.9  3492  1100  v0  I     3:01PM   0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
 
305
mysql   818  0.0 17.4 45292 20584  v0  I     3:01PM   0:02.28 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --log-error=/var/db/mysql/freebsd.hsd1.va.comcast.net..err --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
 
306
EOF
 
307
parse_mysqld_instances "$TMPDIR/in" "$TMPDIR/empty" > "$TMPDIR/got"
 
308
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_mysqld_instances"
 
309
 
 
310
# ###########################################################################
 
311
# get_mysql_*
 
312
# ###########################################################################
 
313
NAME_VAL_LEN=20
 
314
 
 
315
cp $samples/mysql-variables-001.txt $TMPDIR/mysql-variables
 
316
is \
 
317
   $(get_mysql_timezone "$TMPDIR/mysql-variables") \
 
318
   "EDT" \
 
319
   "get_mysql_timezone"
 
320
 
 
321
cat <<EOF > $TMPDIR/expected
 
322
2010-05-27 11:38 (up 0+02:08:52)
 
323
EOF
 
324
cp $samples/mysql-status-001.txt $TMPDIR/mysql-status
 
325
uptime="$(get_var Uptime $TMPDIR/mysql-status)"
 
326
current_time="$(echo -e "2010-05-27 11:38\n")"
 
327
get_mysql_uptime "${uptime}" "${current_time}" > $TMPDIR/got
 
328
no_diff "$TMPDIR/got" "$TMPDIR/expected" "get_mysql_uptime"
 
329
 
 
330
cat <<EOF > $TMPDIR/expected
 
331
             Version | 5.0.51a-24+lenny2 (Debian)
 
332
            Built On | debian-linux-gnu i486
 
333
EOF
 
334
cp "$samples/mysql-variables-001.txt" "$TMPDIR/mysql-variables"
 
335
get_mysql_version "$TMPDIR/mysql-variables" > "$TMPDIR/got"
 
336
no_diff "$TMPDIR/got" "$TMPDIR/expected" "get_mysql_version"
 
337
 
 
338
# ###########################################################################
 
339
# format_status_variables
 
340
# ###########################################################################
 
341
 
 
342
cat <<EOF > "$TMPDIR/expected"
 
343
Variable                                Per day  Per second      5 secs
 
344
Bytes_received                          8000000         100            
 
345
Bytes_sent                             35000000         400            
 
346
Com_admin_commands                           20                        
 
347
Com_change_db                              1000                        
 
348
Com_delete                                 8000                        
 
349
Com_insert                                 8000                        
 
350
Com_lock_tables                             200                        
 
351
Com_replace                                1250                        
 
352
Com_select                                22500                        
 
353
Com_set_option                            22500                        
 
354
Com_show_binlogs                             10                        
 
355
Com_show_create_db                          400                        
 
356
Com_show_create_table                      7000                        
 
357
Com_show_databases                          125                        
 
358
Com_show_fields                            7000                        
 
359
Com_show_innodb_status                      300                        
 
360
Com_show_open_tables                         10                        
 
361
Com_show_processlist                        300                        
 
362
Com_show_slave_status                       300                        
 
363
Com_show_status                             350                        
 
364
Com_show_storage_engines                     10                        
 
365
Com_show_tables                             400                        
 
366
Com_show_triggers                          7000                        
 
367
Com_show_variables                          450                        
 
368
Com_truncate                                300                        
 
369
Com_unlock_tables                           250                        
 
370
Com_update                                  900                        
 
371
Connections                                2500                        
 
372
Created_tmp_disk_tables                   15000                        
 
373
Created_tmp_files                            60                        
 
374
Created_tmp_tables                        22500                        
 
375
Flush_commands                               10                        
 
376
Handler_delete                             8000                        
 
377
Handler_read_first                         2250                        
 
378
Handler_read_key                          30000                        
 
379
Handler_read_next                         15000                        
 
380
Handler_read_rnd                           9000                        
 
381
Handler_read_rnd_next                    300000           3            
 
382
Handler_update                            17500                        
 
383
Handler_write                            250000           2            
 
384
Innodb_buffer_pool_pages_data               225                        
 
385
Innodb_buffer_pool_pages_free              5000                        
 
386
Innodb_buffer_pool_pages_total             6000                        
 
387
Innodb_buffer_pool_read_ahead_rnd            10                        
 
388
Innodb_buffer_pool_read_requests           2250                        
 
389
Innodb_buffer_pool_reads                    150                        
 
390
Innodb_data_fsyncs                           35                        
 
391
Innodb_data_read                       30000000         350            
 
392
Innodb_data_reads                           300                        
 
393
Innodb_data_writes                           35                        
 
394
Innodb_data_written                       17500                        
 
395
Innodb_log_writes                            10                        
 
396
Innodb_os_log_fsyncs                         35                        
 
397
Innodb_os_log_written                      6000                        
 
398
Innodb_page_size                         175000           2            
 
399
Innodb_pages_read                           225                        
 
400
Key_blocks_unused                        150000           1            
 
401
Key_blocks_used                             175                        
 
402
Key_read_requests                        100000           1            
 
403
Key_reads                                   600                        
 
404
Key_write_requests                        70000                        
 
405
Key_writes                                17500                        
 
406
Max_used_connections                         45                        
 
407
Open_files                                 1500                        
 
408
Open_tables                                 700                        
 
409
Opened_tables                             15000                        
 
410
Qcache_free_blocks                           80                        
 
411
Qcache_free_memory                    175000000        2250            
 
412
Qcache_hits                                8000                        
 
413
Qcache_inserts                            20000                        
 
414
Qcache_not_cached                         10000                        
 
415
Qcache_queries_in_cache                     225                        
 
416
Qcache_total_blocks                         600                        
 
417
Questions                                100000           1            
 
418
Select_scan                               25000                        
 
419
Sort_rows                                  8000                        
 
420
Sort_scan                                   300                        
 
421
Table_locks_immediate                     50000                   17500
 
422
Table_locks_waited                           10                       1
 
423
Threads_cached                               35                        
 
424
Threads_connected                            10                        
 
425
Threads_created                              45                        
 
426
Threads_running                              10                        
 
427
Uptime                                    90000           1           1
 
428
Uptime_since_flush_status                 90000           1            
 
429
EOF
 
430
 
 
431
join "$samples/mysql-status-001.txt" "$samples/mysql-status-002.txt" > "$TMPDIR/in"
 
432
format_status_variables "$TMPDIR/in" > "$TMPDIR/got"
 
433
no_diff "$TMPDIR/got" "$TMPDIR/expected" "format_status_variables"
 
434
 
 
435
# ###########################################################################
 
436
# format_overall_db_stats
 
437
# ###########################################################################
 
438
 
 
439
cat <<EOF > "$TMPDIR/expected"
 
440
 
 
441
  Database Tables Views SPs Trigs Funcs   FKs Partn
 
442
  mysql        17                                  
 
443
  sakila       17     7   3     6     3    22     1
 
444
 
 
445
  Database MyISAM InnoDB
 
446
  mysql        17       
 
447
  sakila        2     15
 
448
 
 
449
  Database BTREE FULLTEXT
 
450
  mysql       24         
 
451
  sakila      63        1
 
452
 
 
453
             c   t   s   e   t   s   i   t   b   l   b   v   d   y   d   m
 
454
             h   i   e   n   i   m   n   e   l   o   i   a   a   e   e   e
 
455
             a   m   t   u   n   a   t   x   o   n   g   r   t   a   c   d
 
456
             r   e       m   y   l       t   b   g   i   c   e   r   i   i
 
457
                 s           i   l               b   n   h   t       m   u
 
458
                 t           n   i               l   t   a   i       a   m
 
459
                 a           t   n               o       r   m       l   i
 
460
                 m               t               b           e           n
 
461
                 p                                                       t
 
462
  Database === === === === === === === === === === === === === === === ===
 
463
  mysql     38   5   5  69   2   3  16   2   4   1   2                    
 
464
  sakila     1  15   1   3  19  26   3   4   1          45   4   1   7   2
 
465
 
 
466
EOF
 
467
format_overall_db_stats "$samples/mysql-schema-001.txt" > "$TMPDIR/got"
 
468
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
469
 
 
470
cat <<EOF > $TMPDIR/expected
 
471
 
 
472
  Database Tables Views SPs Trigs Funcs   FKs Partn
 
473
  {chosen}      1                                  
 
474
 
 
475
  Database InnoDB
 
476
  {chosen}      1
 
477
 
 
478
  Database BTREE
 
479
  {chosen}     2
 
480
 
 
481
             t   v
 
482
             i   a
 
483
             n   r
 
484
             y   c
 
485
             i   h
 
486
             n   a
 
487
             t   r
 
488
  Database === ===
 
489
  {chosen}   1   1
 
490
 
 
491
EOF
 
492
format_overall_db_stats "$samples/mysql-schema-002.txt" > "$TMPDIR/got"
 
493
no_diff \
 
494
   "$TMPDIR/got" \
 
495
   "$TMPDIR/expected" \
 
496
   "format_overall_db_stats: single DB without CREATE DATABASE nor USE db defaults to {chosen}"
 
497
 
 
498
# ###########################################################################
 
499
# format_innodb_status
 
500
# ###########################################################################
 
501
 
 
502
# ############################################################################
 
503
TEST_NAME="innodb-status.001.txt"
 
504
# ############################################################################
 
505
cat <<EOF > $TMPDIR/expected
 
506
      Checkpoint Age | 619k
 
507
        InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
 
508
  Oldest Transaction | 3 Seconds
 
509
    History List Len | 255
 
510
          Read Views | 23
 
511
    Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
 
512
   Pending I/O Reads | 14 buf pool reads, 6 normal AIO, 0 ibuf AIO, 23 preads
 
513
  Pending I/O Writes | 63 buf pool (63 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (1 log, 0 chkp); 0 pwrites
 
514
 Pending I/O Flushes | 0 buf pool, 1 log
 
515
  Transaction States | 1xACTIVE
 
516
Semaphore Waits
 
517
     69 btr/btr0cur.c line 457
 
518
     47 btr/btr0cur.c line 523
 
519
     17 trx/trx0trx.c line 1621
 
520
     12 row/row0sel.c line 3549
 
521
      4 lock/lock0lock.c line 4944
 
522
      3 lock/lock0lock.c line 5316
 
523
      2 lock/lock0lock.c line 3224
 
524
      2 btr/btr0sea.c line 1032
 
525
      1 trx/trx0trx.c line 738
 
526
      1 row/row0sel.c line 4574
 
527
      1 lock/lock0lock.c line 5163
 
528
      1 lock/lock0lock.c line 3249
 
529
      1 ./include/btr0btr.ic line 53
 
530
      1 fsp/fsp0fsp.c line 3395
 
531
      1 btr/btr0cur.c line 672
 
532
      1 btr/btr0cur.c line 450
 
533
Semaphore Holders
 
534
     66 thread id 139960165583184
 
535
     45 thread id 139960567171408
 
536
      4 thread id 139960404199760
 
537
      1 thread id 139961215367504
 
538
      1 thread id 139960969292112
 
539
      1 thread id 139960676096336
 
540
Mutexes/Locks Waited For
 
541
     65 lock on RW-latch at 0x905d33d0 '&new_index->lock'
 
542
     45 lock on RW-latch at 0x7f4bedbf8810 '&block->lock'
 
543
     30 Mutex at 0xf89ab0 '&kernel_mutex'
 
544
     15 lock on RW-latch at 0x90075530 '&btr_search_latch'
 
545
      4 lock on RW-latch at 0x90a42ca0 '&new_index->lock'
 
546
      1 lock on RW-latch at 0x90fe1c80 '&new_index->lock'
 
547
      1 lock on RW-latch at 0x90078f10 '&space->latch'
 
548
      1 lock on RW-latch at 0x7f4c0d3abba8 '&block->lock'
 
549
      1 lock on RW-latch at 0x7f4bfc558040 '&block->lock'
 
550
      1 lock on RW-latch at 0x7f4bd0a8c8d0 '&block->lock'
 
551
EOF
 
552
 
 
553
format_innodb_status $samples/innodb-status.001.txt > $TMPDIR/got
 
554
no_diff $TMPDIR/got $TMPDIR/expected
 
555
 
 
556
# ############################################################################
 
557
TEST_NAME="innodb-status.002.txt"
 
558
# ############################################################################
 
559
cat <<'EOF' > $TMPDIR/expected
 
560
      Checkpoint Age | 348M
 
561
        InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
 
562
  Oldest Transaction | 4 Seconds
 
563
    History List Len | 426
 
564
          Read Views | 583
 
565
    Undo Log Entries | 71 transactions, 247 total undo, 46 max undo
 
566
   Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
 
567
  Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
 
568
 Pending I/O Flushes | 0 buf pool, 0 log
 
569
  Transaction States | 1xACTIVE, 70xACTIVE (PREPARED)
 
570
Tables Locked
 
571
     62 `citydb`.`player_buildings`
 
572
     46 `citydb`.`players`
 
573
     22 `citydb`.`city_grid`
 
574
     17 `citydb`.`player_stats`
 
575
      6 `citydb`.`player_contracts`
 
576
      1 `citydb`.`player_achievements`
 
577
Semaphore Waits
 
578
     23 trx/trx0undo.c line 1796
 
579
     10 trx/trx0trx.c line 1888
 
580
      8 trx/trx0trx.c line 1033
 
581
      7 trx/trx0trx.c line 738
 
582
      1 lock/lock0lock.c line 3770
 
583
      1 ./include/log0log.ic line 322
 
584
Mutexes/Locks Waited For
 
585
     33 Mutex at 0x2abf68b76a18 '&rseg->mutex'
 
586
     16 Mutex at 0x48ace40 '&kernel_mutex'
 
587
      1 Mutex at 0x2abf68b6c0d0 '&log_sys->mutex'
 
588
EOF
 
589
 
 
590
format_innodb_status $samples/innodb-status.002.txt > $TMPDIR/got
 
591
no_diff $TMPDIR/got $TMPDIR/expected
 
592
 
 
593
# ############################################################################
 
594
TEST_NAME="innodb-status.003.txt"
 
595
# ############################################################################
 
596
cat <<'EOF' > $TMPDIR/expected
 
597
      Checkpoint Age | 0
 
598
        InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
 
599
  Oldest Transaction | 35 Seconds
 
600
    History List Len | 11
 
601
          Read Views | 1
 
602
    Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
 
603
   Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
 
604
  Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
 
605
 Pending I/O Flushes | 0 buf pool, 0 log
 
606
  Transaction States | 1xACTIVE, 1xnot started
 
607
Tables Locked
 
608
      1 `test`.`t`
 
609
EOF
 
610
 
 
611
format_innodb_status $samples/innodb-status.003.txt > $TMPDIR/got
 
612
no_diff $TMPDIR/got $TMPDIR/expected
 
613
 
 
614
# ############################################################################
 
615
TEST_NAME="innodb-status.004.txt" 
 
616
# ############################################################################
 
617
cat <<'EOF' > $TMPDIR/expected
 
618
      Checkpoint Age | 93M
 
619
        InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue
 
620
  Oldest Transaction | 263 Seconds
 
621
    History List Len | 1282
 
622
          Read Views | 10
 
623
    Undo Log Entries | 3 transactions, 276797 total undo, 153341 max undo
 
624
   Pending I/O Reads | 50 buf pool reads, 48 normal AIO, 0 ibuf AIO, 2 preads
 
625
  Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
 
626
 Pending I/O Flushes | 0 buf pool, 0 log
 
627
  Transaction States | 9xACTIVE, 57xnot started
 
628
Semaphore Waits
 
629
      3 row/row0sel.c line 3495
 
630
      2 btr/btr0sea.c line 1024
 
631
      1 btr/btr0sea.c line 1170
 
632
      1 btr/btr0cur.c line 443
 
633
      1 btr/btr0cur.c line 1501
 
634
Semaphore Holders
 
635
      7 thread id 1220999488
 
636
      1 thread id 1229429056
 
637
Mutexes/Locks Waited For
 
638
      7 lock on RW-latch at 0x2aaab42120b8 created in file btr/btr0sea.c line 139
 
639
      1 lock on RW-latch at 0x2ab2c679a550 created in file buf/buf0buf.c line 550
 
640
EOF
 
641
 
 
642
format_innodb_status $samples/innodb-status.004.txt > $TMPDIR/got
 
643
no_diff $TMPDIR/got $TMPDIR/expected
 
644
 
 
645
 
 
646
# ###########################################################################
 
647
# section_innodb
 
648
# ###########################################################################
 
649
 
 
650
test_format_innodb () {
 
651
   local NAME_VAL_LEN=25
 
652
   cat <<EOF > $TMPDIR/expected
 
653
                  Version | 1.0.17-13.2
 
654
         Buffer Pool Size | 128.0M
 
655
         Buffer Pool Fill | 1%
 
656
        Buffer Pool Dirty | 0%
 
657
           File Per Table | OFF
 
658
                Page Size | 16k
 
659
            Log File Size | 2 * 1.5G = 3.0G
 
660
          Log Buffer Size | 8M
 
661
             Flush Method | 
 
662
      Flush Log At Commit | 1
 
663
               XA Support | ON
 
664
                Checksums | ON
 
665
              Doublewrite | ON
 
666
          R/W I/O Threads | 4 4
 
667
             I/O Capacity | 200
 
668
       Thread Concurrency | 0
 
669
      Concurrency Tickets | 500
 
670
       Commit Concurrency | 0
 
671
      Txn Isolation Level | REPEATABLE-READ
 
672
        Adaptive Flushing | OFF
 
673
      Adaptive Checkpoint | estimate
 
674
EOF
 
675
 
 
676
   section_innodb "$samples/temp001/mysql-variables" "$samples/temp001/mysql-status" > "$TMPDIR/got"
 
677
   no_diff "$TMPDIR/expected" "$TMPDIR/got"
 
678
}
 
679
 
 
680
test_format_innodb
 
681
 
 
682
 
 
683
# ###########################################################################
 
684
# format_innodb_filters
 
685
# ###########################################################################
 
686
 
 
687
test_format_innodb_filters () {
 
688
   local NAME_VAL_LEN=20
 
689
 
 
690
   cat <<EOF > $TMPDIR/expected
 
691
        binlog_do_db | foo
 
692
    binlog_ignore_db | mysql,test
 
693
EOF
 
694
 
 
695
   format_binlog_filters "$samples/mysql-show-master-status-001.txt" > "$TMPDIR/got"
 
696
   no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
697
}
 
698
 
 
699
test_format_innodb_filters
 
700
 
 
701
# ###########################################################################
 
702
# report_mysql_summary
 
703
# ###########################################################################
 
704
 
 
705
OPT_SLEEP=1
 
706
OPT_DATABASES=""
 
707
OPT_READ_SAMPLES=""
 
708
NAME_VAL_LEN=25
 
709
report_mysql_summary "$samples/tempdir" | tail -n+3 > "$TMPDIR/got"
 
710
no_diff "$TMPDIR/got" "$samples/expected_result_report_summary.txt"
 
711
 
 
712
_NO_FALSE_NEGATIVES=""
 
713
OPT_SLEEP=10
 
714
report_mysql_summary "$samples/temp002" 2>/dev/null | tail -n+3 > "$TMPDIR/got"
 
715
no_diff \
 
716
   "$TMPDIR/got" \
 
717
   "$samples/expected_output_temp002.txt" \
 
718
   "report_mysql_summary, dir: temp002"
 
719
 
 
720
report_mysql_summary "$samples/temp003" 2>/dev/null | tail -n+3 > "$TMPDIR/got"
 
721
no_diff \
 
722
   "$TMPDIR/got" \
 
723
   "$samples/expected_output_temp003.txt" \
 
724
   "report_mysql_summary, dir: temp003"
 
725
 
 
726
report_mysql_summary "$samples/temp004" 2>/dev/null | tail -n+3 > "$TMPDIR/got"
 
727
no_diff \
 
728
   "$TMPDIR/got" \
 
729
   "$samples/expected_output_temp004.txt" \
 
730
   "report_mysql_summary, dir: temp004"
 
731
 
 
732
# ###########################################################################
 
733
# Done
 
734
# ###########################################################################