File: binlog_group_commit_sync_delay.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (55 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download
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
# WL#7742: test case that checks that the option
#          binlog_group_commit_sync_delay introduces a
#          delay in the group commit

--source include/have_binlog_format_mixed.inc

--let $bgcd_saved=`SELECT @@GLOBAL.binlog_group_commit_sync_delay`
--let $sync_binlog_saved=`SELECT @@GLOBAL.sync_binlog`

--let $delay=1000000
--eval SET GLOBAL binlog_group_commit_sync_delay=$delay
SET GLOBAL sync_binlog = 1;

SET @clock_in = SYSDATE();
CREATE TABLE t1 (c1 INT) Engine=InnoDB;
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());

--let $assert_text="Assert that the statement never takes less than the delay set."
--let $assert_cond= [SELECT @elapsed >= @@GLOBAL.binlog_group_commit_sync_delay]
--source include/assert.inc

#
# Bug#21420180 BINLOG_GROUP_COMMIT_SYNC_DELAY SHOULD BE CONSIDERED ONLY WHEN
#              SYNCING BINLOG
#
# Execute 1000 insertions (i.e., 1000 groups , one transaction per group).
# Without the fix, it will take 1000 * binlog_group_commit_sync_delay which
# is 1000 seconds (> 15 mints). Hence test script will be timed out.
# But with fix, it should not take more than few seconds (that depends
# on Pb2 machine speed and also depends on various build options too.
#
--let $group_count=1000
--eval SET GLOBAL sync_binlog=$group_count
--let $i=0

SET @clock_in = SYSDATE();
--disable_query_log
while ($i <= $group_count)
{
  --eval INSERT INTO t1 VALUES ($i)
  --inc $i
}
--enable_query_log
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());
--let $assert_text="Assert that the above statements should not take more than 1000 seconds"
--let $assert_cond= [SELECT @elapsed < 1000 * @@GLOBAL.binlog_group_commit_sync_delay]
--source include/assert.inc

# End of Bug#21420180 test

# Cleanup
--eval SET GLOBAL binlog_group_commit_sync_delay=$bgcd_saved
--eval SET GLOBAL sync_binlog=$sync_binlog_saved

DROP TABLE t1;