Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.4, 5.5.32
-
None
-
None
Description
Apparently the person who included our semi-sync code into MariaDB (or MySQL) assumed that semi-sync timeout will always be less than a second or on the order of a few seconds. With a very big timeout this algorithm doesn't work well.
The following patch fixes this:
--- a/plugin/semisync/semisync_master.cc
|
+++ b/plugin/semisync/semisync_master.cc
|
@@ -677,9 +677,11 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
|
}
|
|
/* Calcuate the waiting period. */
|
+ unsigned long diff_secs = wait_timeout_ / TIME_THOUSAND;
|
unsigned long long diff_nsecs =
|
- start_ts.tv_nsec + (unsigned long long)wait_timeout_ * TIME_MILLION;
|
- abstime.tv_sec = start_ts.tv_sec;
|
+ start_ts.tv_nsec + (unsigned long long)wait_timeout_ * TIME_MILLION
|
+ - diff_secs * TIME_BILLION;
|
+ abstime.tv_sec = start_ts.tv_sec + diff_secs;
|
while (diff_nsecs >= TIME_BILLION)
|
{
|
abstime.tv_sec++;
|