Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b6529a14
Commit
b6529a14
authored
Oct 23, 2009
by
He Zhenxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add semi-sync support for Windows
parent
f71b836e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
26 deletions
+65
-26
CMakeLists.txt
CMakeLists.txt
+4
-0
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+33
-19
mysql-test/suite/rpl/r/rpl_semi_sync.result
mysql-test/suite/rpl/r/rpl_semi_sync.result
+2
-2
mysql-test/suite/rpl/t/rpl_semi_sync.test
mysql-test/suite/rpl/t/rpl_semi_sync.test
+6
-5
plugin/semisync/Makefile.am
plugin/semisync/Makefile.am
+2
-0
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master.cc
+18
-0
No files found.
CMakeLists.txt
View file @
b6529a14
...
...
@@ -276,6 +276,10 @@ FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
ADD_SUBDIRECTORY
(
${
DIR
}
)
ENDFOREACH
(
DIR
${
DYNAMIC_ENGINE_DIRECTORIES
}
)
# Add subdirectories for semisync plugin
IF
(
NOT WITHOUT_DYNAMIC_PLUGINS
)
ADD_SUBDIRECTORY
(
plugin/semisync
)
ENDIF
(
NOT WITHOUT_DYNAMIC_PLUGINS
)
# FIXME "debug" only needed if build type is "Debug", but
# CMAKE_BUILD_TYPE is not set during configure time.
...
...
mysql-test/mysql-test-run.pl
View file @
b6529a14
...
...
@@ -1818,25 +1818,39 @@ sub environment_setup {
# --------------------------------------------------------------------------
# Add the path where mysqld will find semisync plugins
# --------------------------------------------------------------------------
my
$lib_semisync_master_plugin
=
mtr_file_exists
(
vs_config_dirs
('
plugin/semisync
',"
libsemisync_master.so
"),
"
$basedir
/plugin/semisync/.libs/libsemisync_master.so
",
"
$basedir
/lib/mysql/plugin/libsemisync_master.so
");
my
$lib_semisync_slave_plugin
=
mtr_file_exists
(
vs_config_dirs
('
plugin/semisync
',"
libsemisync_slave.so
"),
"
$basedir
/plugin/semisync/.libs/libsemisync_slave.so
",
"
$basedir
/lib/mysql/plugin/libsemisync_slave.so
");
if
(
$lib_semisync_master_plugin
&&
$lib_semisync_slave_plugin
)
{
$ENV
{'
SEMISYNC_MASTER_PLUGIN
'}
=
basename
(
$lib_semisync_master_plugin
);
$ENV
{'
SEMISYNC_SLAVE_PLUGIN
'}
=
basename
(
$lib_semisync_slave_plugin
);
$ENV
{'
SEMISYNC_PLUGIN_OPT
'}
=
"
--plugin-dir=
"
.
dirname
(
$lib_semisync_master_plugin
);
}
else
{
$ENV
{'
SEMISYNC_MASTER_PLUGIN
'}
=
"";
$ENV
{'
SEMISYNC_SLAVE_PLUGIN
'}
=
"";
$ENV
{'
SEMISYNC_PLUGIN_OPT
'}
=
"
--plugin-dir=
";
if
(
!
$opt_embedded_server
)
{
my
$semisync_master_filename
;
my
$semisync_slave_filename
;
if
(
IS_WINDOWS
)
{
$semisync_master_filename
=
"
semisync_master.dll
";
$semisync_slave_filename
=
"
semisync_slave.dll
";
}
else
{
$semisync_master_filename
=
"
libsemisync_master.so
";
$semisync_slave_filename
=
"
libsemisync_slave.so
";
}
my
$lib_semisync_master_plugin
=
mtr_file_exists
(
vs_config_dirs
('
plugin/semisync
',
$semisync_master_filename
),
"
$basedir
/plugin/semisync/.libs/
"
.
$semisync_master_filename
,
"
$basedir
/lib/mysql/plugin/
"
.
$semisync_master_filename
);
my
$lib_semisync_slave_plugin
=
mtr_file_exists
(
vs_config_dirs
('
plugin/semisync
',
$semisync_slave_filename
),
"
$basedir
/plugin/semisync/.libs/
"
.
$semisync_slave_filename
,
"
$basedir
/lib/mysql/plugin/
"
.
$semisync_slave_filename
);
if
(
$lib_semisync_master_plugin
&&
$lib_semisync_slave_plugin
)
{
$ENV
{'
SEMISYNC_MASTER_PLUGIN
'}
=
basename
(
$lib_semisync_master_plugin
);
$ENV
{'
SEMISYNC_SLAVE_PLUGIN
'}
=
basename
(
$lib_semisync_slave_plugin
);
$ENV
{'
SEMISYNC_PLUGIN_OPT
'}
=
"
--plugin-dir=
"
.
dirname
(
$lib_semisync_master_plugin
);
}
else
{
$ENV
{'
SEMISYNC_MASTER_PLUGIN
'}
=
"";
$ENV
{'
SEMISYNC_SLAVE_PLUGIN
'}
=
"";
$ENV
{'
SEMISYNC_PLUGIN_OPT
'}
=
"
--plugin-dir=
";
}
}
# ----------------------------------------------------
...
...
mysql-test/suite/rpl/r/rpl_semi_sync.result
View file @
b6529a14
...
...
@@ -397,7 +397,7 @@ Rpl_semi_sync_slave_status OFF
# Test non-semi-sync slave connect to semi-sync master
#
set sql_log_bin=0;
INSTALL PLUGIN rpl_semi_sync_master SONAME '
libsemisync_master.so
';
INSTALL PLUGIN rpl_semi_sync_master SONAME '
SEMISYNC_MASTER_PLUGIN
';
set global rpl_semi_sync_master_timeout= 5000;
/* 5s */
set sql_log_bin=1;
...
...
@@ -416,7 +416,7 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
include/stop_slave.inc
[ reinstall semi-sync slave plugin and disable semi-sync ]
INSTALL PLUGIN rpl_semi_sync_slave SONAME '
libsemisync_slave.so
';
INSTALL PLUGIN rpl_semi_sync_slave SONAME '
SEMISYNC_SLAVE_PLUGIN
';
set global rpl_semi_sync_slave_enabled= 0;
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value
...
...
mysql-test/suite/rpl/t/rpl_semi_sync.test
View file @
b6529a14
source
include
/
have_semisync_plugin
.
inc
;
source
include
/
not_embedded
.
inc
;
source
include
/
not_windows
.
inc
;
source
include
/
have_innodb
.
inc
;
source
include
/
master
-
slave
.
inc
;
...
...
@@ -61,7 +60,7 @@ let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled',
if
(
`select '$value' = 'No such row'`
)
{
set
sql_log_bin
=
0
;
INSTALL
PLUGIN
rpl_semi_sync_master
SONAME
'libsemisync_master.so
'
;
eval
INSTALL
PLUGIN
rpl_semi_sync_master
SONAME
'$SEMISYNC_MASTER_PLUGIN
'
;
set
global
rpl_semi_sync_master_timeout
=
5000
;
/* 5s */
set
sql_log_bin
=
1
;
}
...
...
@@ -126,7 +125,7 @@ let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', V
if
(
`select '$value' = 'No such row'`
)
{
set
sql_log_bin
=
0
;
INSTALL
PLUGIN
rpl_semi_sync_slave
SONAME
'libsemisync_slave.so
'
;
eval
INSTALL
PLUGIN
rpl_semi_sync_slave
SONAME
'$SEMISYNC_SLAVE_PLUGIN
'
;
set
sql_log_bin
=
1
;
}
enable_query_log
;
...
...
@@ -536,7 +535,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
connection
master
;
set
sql_log_bin
=
0
;
INSTALL
PLUGIN
rpl_semi_sync_master
SONAME
'libsemisync_master.so'
;
replace_result
$SEMISYNC_MASTER_PLUGIN
SEMISYNC_MASTER_PLUGIN
;
eval
INSTALL
PLUGIN
rpl_semi_sync_master
SONAME
'$SEMISYNC_MASTER_PLUGIN'
;
set
global
rpl_semi_sync_master_timeout
=
5000
;
/* 5s */
set
sql_log_bin
=
1
;
set
global
rpl_semi_sync_master_enabled
=
1
;
...
...
@@ -554,7 +554,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
source
include
/
stop_slave
.
inc
;
echo
[
reinstall
semi
-
sync
slave
plugin
and
disable
semi
-
sync
];
INSTALL
PLUGIN
rpl_semi_sync_slave
SONAME
'libsemisync_slave.so'
;
replace_result
$SEMISYNC_SLAVE_PLUGIN
SEMISYNC_SLAVE_PLUGIN
;
eval
INSTALL
PLUGIN
rpl_semi_sync_slave
SONAME
'$SEMISYNC_SLAVE_PLUGIN'
;
set
global
rpl_semi_sync_slave_enabled
=
0
;
SHOW
VARIABLES
LIKE
'rpl_semi_sync_slave_enabled'
;
SHOW
STATUS
LIKE
'Rpl_semi_sync_slave_status'
;
...
...
plugin/semisync/Makefile.am
View file @
b6529a14
...
...
@@ -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
plugin/semisync/semisync_master.cc
View file @
b6529a14
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment