| 1 |
# WL#7742: test case that checks that the option |
| 2 |
# binlog_group_commit_sync_delay introduces a |
| 3 |
# delay in the group commit |
| 4 |
|
| 5 |
--source include/have_binlog_format_mixed.inc |
| 6 |
|
| 7 |
--let $bgcd_saved=`SELECT @@GLOBAL.binlog_group_commit_sync_delay` |
| 8 |
--let $sync_binlog_saved=`SELECT @@GLOBAL.sync_binlog` |
| 9 |
|
| 10 |
--let $delay=1000000 |
| 11 |
--eval SET GLOBAL binlog_group_commit_sync_delay=$delay |
| 12 |
SET GLOBAL sync_binlog = 1; |
| 13 |
|
| 14 |
SET @clock_in = SYSDATE(); |
| 15 |
CREATE TABLE t1 (c1 INT) Engine=InnoDB; |
| 16 |
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE()); |
| 17 |
|
| 18 |
--let $assert_text="Assert that the statement never takes less than the delay set." |
| 19 |
--let $assert_cond= [SELECT @elapsed >= @@GLOBAL.binlog_group_commit_sync_delay] |
| 20 |
--source include/assert.inc |
| 21 |
|
| 22 |
# |
| 23 |
# Bug#21420180 BINLOG_GROUP_COMMIT_SYNC_DELAY SHOULD BE CONSIDERED ONLY WHEN |
| 24 |
# SYNCING BINLOG |
| 25 |
# |
| 26 |
# Execute 1000 insertions (i.e., 1000 groups , one transaction per group). |
| 27 |
# Without the fix, it will take 1000 * binlog_group_commit_sync_delay which |
| 28 |
# is 1000 seconds (> 15 mints). Hence test script will be timed out. |
| 29 |
# But with fix, it should not take more than few seconds (that depends |
| 30 |
# on Pb2 machine speed and also depends on various build options too. |
| 31 |
# |
| 32 |
--let $group_count=1000 |
| 33 |
--eval SET GLOBAL sync_binlog=$group_count |
| 34 |
--let $i=0 |
| 35 |
|
| 36 |
SET @clock_in = SYSDATE(); |
| 37 |
--disable_query_log |
| 38 |
while ($i <= $group_count) |
| 39 |
{ |
| 40 |
--eval INSERT INTO t1 VALUES ($i) |
| 41 |
--inc $i |
| 42 |
} |
| 43 |
--enable_query_log |
| 44 |
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE()); |
| 45 |
--let $assert_text="Assert that the above statements should not take more than 1000 seconds" |
| 46 |
--let $assert_cond= [SELECT @elapsed < 1000 * @@GLOBAL.binlog_group_commit_sync_delay] |
| 47 |
--source include/assert.inc |
| 48 |
|
| 49 |
# End of Bug#21420180 test |
| 50 |
|
| 51 |
# Cleanup |
| 52 |
--eval SET GLOBAL binlog_group_commit_sync_delay=$bgcd_saved |
| 53 |
--eval SET GLOBAL sync_binlog=$sync_binlog_saved |
| 54 |
|
| 55 |
DROP TABLE t1; |