[MDEV-4926] [PATCH] Remove division-using-subtraction implementation from semi-sync plugin Created: 2013-08-20  Updated: 2013-09-04  Resolved: 2013-09-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.4, 5.5.32
Fix Version/s: 10.0.5, 5.5.33

Type: Bug Priority: Major
Reporter: Pavel Ivanov Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: 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++;



 Comments   
Comment by Vladislav Vaintroub [ 2013-09-04 ]

http://lists.askmonty.org/pipermail/commits/2013-September/005341.html

Generated at Thu Feb 08 07:00:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.