Skip to content

Commit b8884c6

Browse files
Venkatesh DuggiralaHery Ramilison
authored andcommitted
Revert "Bug#26589008 SYNC_BINLOG=0 SHOULD IGNORE BINLOG_GROUP_COMMIT_SYNC_DELAY"
This reverts commit 5654f5ec294f3d8ea087029ba9b47ad3eb2835b3.
1 parent d665420 commit b8884c6

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

mysql-test/suite/binlog/r/binlog_group_commit_sync_delay.result

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ SET GLOBAL sync_binlog=1000;
88
SET @clock_in = SYSDATE();
99
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());
1010
include/assert.inc ["Assert that the above statements should not take more than 1000 seconds"]
11-
SET GLOBAL sync_binlog=0;
12-
SET @clock_in = SYSDATE();
13-
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());
14-
include/assert.inc ["Assert that the above statements should not take more than 1000 seconds"]
1511
SET GLOBAL binlog_group_commit_sync_delay=0;
1612
SET GLOBAL sync_binlog=1;
1713
DROP TABLE t1;

mysql-test/suite/binlog/t/binlog_group_commit_sync_delay.test

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,23 @@ SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());
2929
# But with fix, it should not take more than few seconds (that depends
3030
# on Pb2 machine speed and also depends on various build options too.
3131
#
32-
# Do above experiment with two iterations
33-
# 1) When sync_binlog > 1 (i.e., with 1000)
34-
# 2) When sync_binlog = 0
35-
#
3632
--let $group_count=1000
37-
--let $iter=1
38-
while ($iter <= 2)
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)
3939
{
40-
if ($iter == 1)
41-
{
42-
--eval SET GLOBAL sync_binlog=$group_count
43-
}
44-
if ($iter == 2)
45-
{
46-
--eval SET GLOBAL sync_binlog=0
47-
}
48-
--let $i=0
49-
SET @clock_in = SYSDATE();
50-
--disable_query_log
51-
while ($i <= $group_count)
52-
{
53-
--eval INSERT INTO t1 VALUES ($i)
54-
--inc $i
55-
}
56-
--enable_query_log
57-
SET @elapsed = TIMESTAMPDIFF(MICROSECOND, @clock_in, SYSDATE());
58-
--let $assert_text="Assert that the above statements should not take more than 1000 seconds"
59-
--let $assert_cond= [SELECT @elapsed < 1000 * @@GLOBAL.binlog_group_commit_sync_delay]
60-
--source include/assert.inc
61-
--inc $iter
40+
--eval INSERT INTO t1 VALUES ($i)
41+
--inc $i
6242
}
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+
6349
# End of Bug#21420180 test
6450

6551
# Cleanup

sql/binlog.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9157,7 +9157,6 @@ int MYSQL_BIN_LOG::ordered_commit(THD *thd, bool all, bool skip_commit)
91579157
int flush_error= 0, sync_error= 0;
91589158
my_off_t total_bytes= 0;
91599159
bool do_rotate= false;
9160-
unsigned int current_sync_period;
91619160

91629161
/*
91639162
These values are used while flushing a transaction, so clear
@@ -9304,9 +9303,11 @@ int MYSQL_BIN_LOG::ordered_commit(THD *thd, bool all, bool skip_commit)
93049303
Shall introduce a delay only if it is going to do sync
93059304
in this ongoing SYNC stage. The "+1" used below in the
93069305
if condition is to count the ongoing sync stage.
9306+
When sync_binlog=0 (where we never do sync in BGC group),
9307+
it is considered as a special case and delay will be executed
9308+
for every group just like how it is done when sync_binlog= 1.
93079309
*/
9308-
current_sync_period= get_sync_period();
9309-
if (!flush_error && current_sync_period && (sync_counter + 1 >= current_sync_period))
9310+
if (!flush_error && (sync_counter + 1 >= get_sync_period()))
93109311
stage_manager.wait_count_or_timeout(opt_binlog_group_commit_sync_no_delay_count,
93119312
opt_binlog_group_commit_sync_delay,
93129313
Stage_manager::SYNC_STAGE);

0 commit comments

Comments
 (0)