|
6 | 6 | -- source include/have_ndb.inc
|
7 | 7 | -- source include/have_binlog_format_mixed_or_row.inc
|
8 | 8 |
|
| 9 | +# Save original value to allow restoring config before test end |
| 10 | +SET @save_ndb_log_cache_size = @@global.ndb_log_cache_size; |
| 11 | +SELECT @save_ndb_log_cache_size; |
| 12 | + |
| 13 | +# Configure lowest possible ndb binlog injector cache size to make it possible |
| 14 | +# to exceed the size and trigger a "disk spill" further down |
| 15 | +SET @@global.ndb_log_cache_size=4096; |
| 16 | + |
| 17 | +# Show that ndb_log_cache_size is a global variable |
| 18 | +--error ER_GLOBAL_VARIABLE |
| 19 | +SET SESSION ndb_log_cache_size=32768; |
| 20 | + |
9 | 21 | -- let $cache_qry = SELECT COUNT_WRITE FROM performance_schema.file_summary_by_event_name WHERE event_name LIKE "%io_cache%"
|
10 | 22 |
|
| 23 | +# Check configured values required by test |
| 24 | +SELECT @@global.ndb_log_cache_size; |
11 | 25 | SELECT @@global.binlog_cache_size;
|
12 | 26 | SELECT @@global.binlog_stmt_cache_size;
|
13 | 27 | SELECT NAME, ENABLED FROM performance_schema.setup_instruments WHERE name LIKE "%file/sql/io_cache%";
|
@@ -69,10 +83,50 @@ save_master_pos;
|
69 | 83 | -- let $assert_cond= [$qry, warnings, 1] >= 1
|
70 | 84 | -- source include/assert.inc
|
71 | 85 |
|
| 86 | +# The temporary file used for extending the cache in the above case can be |
| 87 | +# seen in performance_schema by quering the file_instances table, the file |
| 88 | +# has "ML" as file name prefix: |
| 89 | +# SELECT * FROM performance_schema.file_instances |
| 90 | +# WHERE EVENT_NAME = "wait/io/file/sql/io_cache"; |
| 91 | +# FILE_NAME EVENT_NAME OPEN_COUNT |
| 92 | +# /tmp/mysqld.1.1/MLfd=66 wait/io/file/sql/io_cache 1 |
| 93 | +--let $assert_cond = OPEN_COUNT >= 1 FROM performance_schema.file_instances WHERE EVENT_NAME = "wait/io/file/sql/io_cache" |
| 94 | +--let $assert_text = The IO_CACHE should spill to disk |
| 95 | +--source include/assert.inc |
| 96 | + |
72 | 97 | # Supress the provoked message
|
73 | 98 | -- disable_query_log ONCE
|
74 | 99 | call mtr.add_suppression(".*Binary log cache data overflowed to disk.*");
|
75 | 100 |
|
| 101 | +--echo # |
| 102 | +--echo # Check that ndb_log_cache_size can be reconfigured at runtime and the |
| 103 | +--echo # large write which previously caused cache spill now fits. This is done |
| 104 | +--echo # by increasing cache size and doing the large write again. |
| 105 | + |
| 106 | +SET @@global.ndb_log_cache_size=1024*1024; |
| 107 | +BEGIN; |
| 108 | +INSERT INTO t1 VALUES (8, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 109 | +INSERT INTO t1 VALUES (9, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 110 | +INSERT INTO t1 VALUES (10, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 111 | +INSERT INTO t1 VALUES (11, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 112 | +INSERT INTO t1 VALUES (12, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 113 | +INSERT INTO t1 VALUES (13, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 114 | +INSERT INTO t1 VALUES (14, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 115 | +INSERT INTO t1 VALUES (15, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 116 | +COMMIT; |
| 117 | +--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 118 | + |
| 119 | +-- let $after_writes_with_large_cache = `$cache_qry` |
| 120 | +#echo after_writes_with_large_cache: $after_writes_with_large_cache; |
| 121 | + |
| 122 | +-- let $assert_text= Write with large cache didn't trigger cache overflow |
| 123 | +-- let $assert_cond= $after_writes = $after_writes_with_large_cache |
| 124 | +-- source include/assert.inc |
| 125 | + |
| 126 | +# Restore changed config to original value |
| 127 | +SET @@global.ndb_log_cache_size=@save_ndb_log_cache_size; |
| 128 | + |
| 129 | + |
76 | 130 | -- echo
|
77 | 131 |
|
78 | 132 | DROP TABLE t1;
|
0 commit comments