| 1 |
SET @save_ndb_log_cache_size = @@global.ndb_log_cache_size; |
| 2 |
SELECT @save_ndb_log_cache_size; |
| 3 |
@save_ndb_log_cache_size |
| 4 |
32768 |
| 5 |
SET @@global.ndb_log_cache_size=4096; |
| 6 |
SET SESSION ndb_log_cache_size=32768; |
| 7 |
ERROR HY000: Variable 'ndb_log_cache_size' is a GLOBAL variable and should be set with SET GLOBAL |
| 8 |
SELECT @@global.ndb_log_cache_size; |
| 9 |
@@global.ndb_log_cache_size |
| 10 |
4096 |
| 11 |
SELECT @@global.binlog_cache_size; |
| 12 |
@@global.binlog_cache_size |
| 13 |
32768 |
| 14 |
SELECT @@global.binlog_stmt_cache_size; |
| 15 |
@@global.binlog_stmt_cache_size |
| 16 |
32768 |
| 17 |
SELECT NAME, ENABLED FROM performance_schema.setup_instruments WHERE name LIKE "%file/sql/io_cache%"; |
| 18 |
NAME ENABLED |
| 19 |
wait/io/file/sql/io_cache YES |
| 20 |
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB, lb LONGBLOB) ENGINE = NDB; |
| 21 |
# Insert small transactions that should NOT |
| 22 |
# trigger an IO_CACHE overflow |
| 23 |
# Insert ~2KiB of data per transaction |
| 24 |
INSERT INTO t1 VALUES (1, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 25 |
INSERT INTO t1 VALUES (2, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 26 |
|
| 27 |
## Verify there were no IO_CACHE write events |
| 28 |
|
| 29 |
include/assert.inc [There were 0 writes to IO_CACHE] |
| 30 |
|
| 31 |
# Generate larger transactions to force an IO_CACHE |
| 32 |
# overflow and subsequent write to a temporary file. |
| 33 |
# Insert ~8KiB of data per transaction. |
| 34 |
SET SESSION AUTOCOMMIT=OFF; |
| 35 |
BEGIN; |
| 36 |
INSERT INTO t1 VALUES (3, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 37 |
INSERT INTO t1 VALUES (4, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 38 |
INSERT INTO t1 VALUES (5, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 39 |
INSERT INTO t1 VALUES (6, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 40 |
COMMIT; |
| 41 |
SET SESSION AUTOCOMMIT=ON; |
| 42 |
INSERT INTO t1 VALUES (7, repeat(0x41, 4096), repeat(0x42, 4096)); |
| 43 |
|
| 44 |
## Verify IO_CACHE write events and that warnings were logged |
| 45 |
|
| 46 |
include/assert.inc [There were >0 writes to IO_CACHE] |
| 47 |
# Check that error log contains message indicating cache spill |
| 48 |
include/assert.inc [Binary log cache data overflowed to disk] |
| 49 |
include/assert.inc [The IO_CACHE should spill to disk] |
| 50 |
# |
| 51 |
# Check that ndb_log_cache_size can be reconfigured at runtime and the |
| 52 |
# large write which previously caused cache spill now fits. This is done |
| 53 |
# by increasing cache size and doing the large write again. |
| 54 |
SET @@global.ndb_log_cache_size=1024*1024; |
| 55 |
BEGIN; |
| 56 |
INSERT INTO t1 VALUES (8, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 57 |
INSERT INTO t1 VALUES (9, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 58 |
INSERT INTO t1 VALUES (10, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 59 |
INSERT INTO t1 VALUES (11, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 60 |
INSERT INTO t1 VALUES (12, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 61 |
INSERT INTO t1 VALUES (13, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 62 |
INSERT INTO t1 VALUES (14, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 63 |
INSERT INTO t1 VALUES (15, repeat(0x41, 1024), repeat(0x42, 1024)); |
| 64 |
COMMIT; |
| 65 |
# Wait for ndb_binlog thread... |
| 66 |
include/assert.inc [Write with large cache didn't trigger cache overflow] |
| 67 |
SET @@global.ndb_log_cache_size=@save_ndb_log_cache_size; |
| 68 |
|
| 69 |
DROP TABLE t1; |