summaryrefslogtreecommitdiff
path: root/plugin/semisync
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-10-23 12:56:30 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-10-23 12:56:30 +0800
commite9acb9f0212f31e9fc5e8a09ee2932f37faed13a (patch)
tree9a5b1366ff418440003a17f8eb21baa18ede113e /plugin/semisync
parentd8dee8cb32a8acc23a95f5288b30f7c488815fa1 (diff)
downloadmariadb-git-e9acb9f0212f31e9fc5e8a09ee2932f37faed13a.tar.gz
Add semi-sync support for Windows
CMakeLists.txt: Add plugin/semisync subdirectory mysql-test/mysql-test-run.pl: Check for semisync dll for Windows mysql-test/suite/rpl/r/rpl_semi_sync.result: Update result file mysql-test/suite/rpl/t/rpl_semi_sync.test: Test semi-sync on Windows plugin/semisync/semisync_master.cc: Define gettimeofday for Windows
Diffstat (limited to 'plugin/semisync')
-rw-r--r--plugin/semisync/Makefile.am2
-rw-r--r--plugin/semisync/semisync_master.cc18
2 files changed, 20 insertions, 0 deletions
diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am
index dfe539b8386..25949485987 100644
--- a/plugin/semisync/Makefile.am
+++ b/plugin/semisync/Makefile.am
@@ -34,3 +34,5 @@ libsemisync_slave_la_LDFLAGS = -module
libsemisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libsemisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libsemisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc
+
+EXTRA_DIST= CMakeLists.txt plug.in
diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
index 1a7106621a4..cc83978ad4e 100644
--- a/plugin/semisync/semisync_master.cc
+++ b/plugin/semisync/semisync_master.cc
@@ -45,6 +45,18 @@ char rpl_semi_sync_master_wait_no_slave = 1;
static int getWaitTime(const struct timeval& start_tv);
+#ifdef __WIN__
+static int gettimeofday(struct timeval *tv, void *tz)
+{
+ unsigned int ticks;
+ ticks= GetTickCount();
+ tv->tv_usec= ticks*1000;
+ tv->tv_sec= ticks/1000;
+
+ return 0;
+}
+#endif /* __WIN__ */
+
/*******************************************************************************
*
* <ActiveTranx> class : manage all active transaction nodes
@@ -728,6 +740,11 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
int diff_usecs = start_tv.tv_usec + wait_timeout_ * TIME_THOUSAND;
/* Calcuate the waiting period. */
+#ifdef __WIN__
+ abstime.tv.i64 = (__int64)start_tv.tv_sec * TIME_MILLION * 10;
+ abstime.tv.i64 += (__int64)diff_usecs * 10;
+ abstime.max_timeout_msec= (long)wait_timeout_;
+#else
abstime.tv_sec = start_tv.tv_sec;
if (diff_usecs < TIME_MILLION)
{
@@ -742,6 +759,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
}
abstime.tv_nsec = diff_usecs * TIME_THOUSAND;
}
+#endif /* __WIN__ */
/* In semi-synchronous replication, we wait until the binlog-dump
* thread has received the reply on the relevant binlog segment from the