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
99df0fba
Commit
99df0fba
authored
May 21, 2014
by
Nirbhay Choubey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bzr merge -r3968..3984 codership/5.5 (non-Innodb changes only).
parent
8a6f4e19
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
129 additions
and
111 deletions
+129
-111
scripts/wsrep_sst_common.sh
scripts/wsrep_sst_common.sh
+5
-5
scripts/wsrep_sst_mysqldump.sh
scripts/wsrep_sst_mysqldump.sh
+11
-5
scripts/wsrep_sst_rsync.sh
scripts/wsrep_sst_rsync.sh
+20
-14
sql/slave.cc
sql/slave.cc
+35
-16
sql/sql_base.cc
sql/sql_base.cc
+1
-0
sql/wsrep_hton.cc
sql/wsrep_hton.cc
+6
-0
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+29
-14
sql/wsrep_notify.cc
sql/wsrep_notify.cc
+11
-8
sql/wsrep_sst.cc
sql/wsrep_sst.cc
+6
-4
wsrep/wsrep_dummy.c
wsrep/wsrep_dummy.c
+5
-45
No files found.
scripts/wsrep_sst_common.sh
View file @
99df0fba
...
...
@@ -20,6 +20,7 @@ set -u
WSREP_SST_OPT_BYPASS
=
0
WSREP_SST_OPT_DATA
=
""
WSREP_SST_OPT_AUTH
=
""
while
[
$#
-gt
0
]
;
do
case
"
$1
"
in
...
...
@@ -55,7 +56,7 @@ case "$1" in
shift
;;
'--password'
)
readonly
WSREP_SST_OPT_PSWD
=
"
$2
"
WSREP_SST_OPT_PSWD
=
"
$2
"
shift
;;
'--port'
)
...
...
@@ -71,7 +72,7 @@ case "$1" in
shift
;;
'--user'
)
readonly
WSREP_SST_OPT_USER
=
"
$2
"
WSREP_SST_OPT_USER
=
"
$2
"
shift
;;
'--gtid'
)
...
...
@@ -89,7 +90,7 @@ readonly WSREP_SST_OPT_BYPASS
# For Bug:1200727
if
my_print_defaults
-c
$WSREP_SST_OPT_CONF
sst |
grep
-q
"wsrep_sst_auth"
;
then
if
[
-z
$WSREP_SST_OPT_AUTH
-o
$WSREP_SST_OPT_AUTH
=
"(null)"
]
;
then
if
[
-z
"
$WSREP_SST_OPT_AUTH
"
-o
"
$WSREP_SST_OPT_AUTH
"
=
"(null)"
]
;
then
WSREP_SST_OPT_AUTH
=
$(
my_print_defaults
-c
$WSREP_SST_OPT_CONF
sst |
grep
--
"--wsrep_sst_auth"
|
cut
-d
=
-f2
)
fi
fi
...
...
@@ -124,4 +125,3 @@ wsrep_cleanup_progress_file()
{
[
-n
"
$SST_PROGRESS_FILE
"
]
&&
rm
-f
"
$SST_PROGRESS_FILE
"
2>/dev/null
}
scripts/wsrep_sst_mysqldump.sh
View file @
99df0fba
#!/bin/sh -e
#!/bin/
ba
sh -e
# Copyright (C) 2009 Codership Oy
#
# This program is free software; you can redistribute it and/or modify
...
...
@@ -65,6 +65,11 @@ then
exit
$EINVAL
fi
# For Bug:1293798
if
[
-z
"
$WSREP_SST_OPT_PSWD
"
-a
-n
"
$WSREP_SST_OPT_AUTH
"
]
;
then
WSREP_SST_OPT_USER
=
$(
echo
$WSREP_SST_OPT_AUTH
|
cut
-d
:
-f1
)
WSREP_SST_OPT_PSWD
=
$(
echo
$WSREP_SST_OPT_AUTH
|
cut
-d
:
-f2
)
fi
AUTH
=
"-u
$WSREP_SST_OPT_USER
"
if
test
-n
"
$WSREP_SST_OPT_PSWD
"
;
then
AUTH
=
"
$AUTH
-p
$WSREP_SST_OPT_PSWD
"
;
fi
...
...
@@ -123,4 +128,5 @@ else
wsrep_log_info
"Bypassing state dump."
echo
$SET_START_POSITION
|
$MYSQL
fi
wsrep_cleanup_progress_file
#
scripts/wsrep_sst_rsync.sh
View file @
99df0fba
...
...
@@ -25,6 +25,9 @@ OS=$(uname)
.
$(
dirname
$0
)
/wsrep_sst_common
# Setting the path for lsof on CentOS
export
PATH
=
"/usr/sbin:/sbin:
$PATH
"
cleanup_joiner
()
{
wsrep_log_info
"Joiner cleanup."
...
...
@@ -49,19 +52,21 @@ check_pid()
check_pid_and_port
()
{
local
pid_file
=
$1
local
rsync_pid
=
$
(
cat
$pid_file
)
local
rsync_port
=
$
2
local
rsync_pid
=
$
2
local
rsync_port
=
$
3
if
[
"
$OS
"
==
"Darwin"
-o
"
$OS
"
==
"FreeBSD"
]
;
then
# no netstat --program(-p) option in Darwin and FreeBSD
check_pid
$pid_file
&&
\
lsof
-i
-Pn
2>/dev/null |
\
grep
"(LISTEN)"
|
grep
":
$rsync_port
"
|
grep
-w
'^rsync[[:space:]]\+'
"
$rsync_pid
"
>
/dev/null
else
check_pid
$pid_file
&&
\
netstat
-lnpt
2>/dev/null |
\
grep
LISTEN |
grep
\:
$rsync_port
|
grep
$rsync_pid
/rsync
>
/dev/null
local
port_info
=
$(
lsof
-i
:
$rsync_port
-Pn
2>/dev/null |
\
grep
"(LISTEN)"
)
local
is_rsync
=
$(
echo
$port_info
|
\
grep
-w
'^rsync[[:space:]]\+'
"
$rsync_pid
"
2>/dev/null
)
if
[
-n
"
$port_info
"
-a
-z
"
$is_rsync
"
]
;
then
wsrep_log_error
"rsync daemon port '
$rsync_port
' has been taken"
exit
16
# EBUSY
fi
check_pid
$pid_file
&&
\
[
-n
"
$port_info
"
]
&&
[
-n
"
$is_rsync
"
]
&&
\
[
$(
cat
$pid_file
)
-eq
$rsync_pid
]
}
MAGIC_FILE
=
"
$WSREP_SST_OPT_DATA
/rsync_sst_complete"
...
...
@@ -234,9 +239,10 @@ EOF
# rm -rf "$DATA"/ib_logfile* # we don't want old logs around
# listen at all interfaces (for firewalled setups)
rsync
--daemon
--port
$RSYNC_PORT
--config
"
$RSYNC_CONF
"
rsync
--daemon
--no-detach
--port
$RSYNC_PORT
--config
"
$RSYNC_CONF
"
&
RSYNC_REAL_PID
=
$!
until
check_pid_and_port
$RSYNC_PID
$RSYNC_PORT
until
check_pid_and_port
$RSYNC_PID
$RSYNC_
REAL_PID
$RSYNC_
PORT
do
sleep
0.2
done
...
...
sql/slave.cc
View file @
99df0fba
...
...
@@ -4370,6 +4370,9 @@ pthread_handler_t handle_slave_sql(void *arg)
my_off_t
saved_skip
=
0
;
Master_info
*
mi
=
((
Master_info
*
)
arg
);
Relay_log_info
*
rli
=
&
mi
->
rli
;
#ifdef WITH_WSREP
my_bool
wsrep_node_dropped
=
FALSE
;
#endif
/* WITH_WSREP */
const
char
*
errmsg
;
rpl_group_info
*
serial_rgi
;
rpl_sql_thread_info
sql_info
(
mi
->
rpl_filter
);
...
...
@@ -4377,6 +4380,9 @@ pthread_handler_t handle_slave_sql(void *arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init
();
DBUG_ENTER
(
"handle_slave_sql"
);
#ifdef WITH_WSREP
wsrep_restart_point:
#endif
/* WITH_WSREP */
LINT_INIT
(
saved_master_log_pos
);
LINT_INIT
(
saved_log_pos
);
...
...
@@ -4617,7 +4623,15 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
DBUG_PRINT
(
"info"
,
(
"exec_relay_log_event() failed"
));
// do not scare the user if SQL thread was simply killed or stopped
if
(
!
sql_slave_killed
(
serial_rgi
))
{
slave_output_error_info
(
rli
,
thd
);
#ifdef WITH_WSREP
if
(
WSREP_ON
&&
last_errno
==
ER_UNKNOWN_COM_ERROR
)
{
wsrep_node_dropped
=
TRUE
;
}
#endif
/* WITH_WSREP */
}
goto
err
;
}
}
...
...
@@ -4702,30 +4716,35 @@ err_during_init:
delete
serial_rgi
;
delete
thd
;
mysql_mutex_unlock
(
&
LOCK_thread_count
);
/*
Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
is important. Otherwise a killer_thread can execute between the calls and
delete the mi structure leading to a crash! (see BUG#25306 for details)
*/
mysql_cond_broadcast
(
&
rli
->
stop_cond
);
DBUG_EXECUTE_IF
(
"simulate_slave_delay_at_terminate_bug38694"
,
sleep
(
5
););
mysql_mutex_unlock
(
&
rli
->
run_lock
);
// tell the world we are done
#ifdef WITH_WSREP
/* if slave stopped due to node going non primary, we set global flag to
trigger automatic restart of slave when node joins back to cluster
*/
if
(
WSREP_ON
&&
!
wsrep_ready
)
if
(
wsrep_node_dropped
&&
wsrep_restart_slave
)
{
WSREP_INFO
(
"Slave thread stopped because node dropped from cluster"
);
if
(
wsrep_restart_slave
)
if
(
wsrep_ready
)
{
WSREP_INFO
(
"Slave error due to node temporarily non-primary"
"SQL slave will continue"
);
wsrep_node_dropped
=
FALSE
;
mysql_mutex_unlock
(
&
rli
->
run_lock
);
goto
wsrep_restart_point
;
}
else
{
WSREP_INFO
(
"Slave error due to node going non-primary"
);
WSREP_INFO
(
"wsrep_restart_slave was set and therefore slave will be "
"automatically restarted when node joins back to cluster"
);
wsrep_restart_slave_activated
=
TRUE
;
}
}
#endif
/* WITH_WSREP */
/*
Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
is important. Otherwise a killer_thread can execute between the calls and
delete the mi structure leading to a crash! (see BUG#25306 for details)
*/
mysql_cond_broadcast
(
&
rli
->
stop_cond
);
DBUG_EXECUTE_IF
(
"simulate_slave_delay_at_terminate_bug38694"
,
sleep
(
5
););
mysql_mutex_unlock
(
&
rli
->
run_lock
);
// tell the world we are done
DBUG_LEAVE
;
// Must match DBUG_ENTER()
my_thread_end
();
...
...
sql/sql_base.cc
View file @
99df0fba
...
...
@@ -4598,6 +4598,7 @@ restart:
thd
->
lex
->
sql_command
==
SQLCOM_LOAD
||
thd
->
lex
->
sql_command
==
SQLCOM_DELETE
)
&&
wsrep_replicate_myisam
&&
(
*
start
)
&&
(
*
start
)
->
table
&&
(
*
start
)
->
table
->
file
->
ht
->
db_type
==
DB_TYPE_MYISAM
)
{
WSREP_TO_ISOLATION_BEGIN
(
NULL
,
NULL
,
(
*
start
));
...
...
sql/wsrep_hton.cc
View file @
99df0fba
...
...
@@ -513,11 +513,17 @@ wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all)
DBUG_RETURN
(
WSREP_TRX_CERT_FAIL
);
case
WSREP_SIZE_EXCEEDED
:
WSREP_ERROR
(
"transaction size exceeded"
);
mysql_mutex_unlock
(
&
thd
->
LOCK_wsrep_thd
);
DBUG_RETURN
(
WSREP_TRX_SIZE_EXCEEDED
);
case
WSREP_CONN_FAIL
:
WSREP_ERROR
(
"connection failure"
);
mysql_mutex_unlock
(
&
thd
->
LOCK_wsrep_thd
);
DBUG_RETURN
(
WSREP_TRX_ERROR
);
default:
WSREP_ERROR
(
"unknown connection failure"
);
mysql_mutex_unlock
(
&
thd
->
LOCK_wsrep_thd
);
DBUG_RETURN
(
WSREP_TRX_ERROR
);
}
...
...
sql/wsrep_mysqld.cc
View file @
99df0fba
...
...
@@ -433,9 +433,22 @@ static void wsrep_synced_cb(void* app_ctx)
}
if
(
wsrep_restart_slave_activated
)
{
int
rcode
;
WSREP_INFO
(
"MySQL slave restart"
);
wsrep_restart_slave_activated
=
FALSE
;
init_slave
();
mysql_mutex_lock
(
&
LOCK_active_mi
);
if
((
rcode
=
start_slave_threads
(
1
/* need mutex */
,
0
/* no wait for start*/
,
active_mi
,
master_info_file
,
relay_log_info_file
,
SLAVE_SQL
)))
{
WSREP_WARN
(
"Failed to create slave threads: %d"
,
rcode
);
}
mysql_mutex_unlock
(
&
LOCK_active_mi
);
}
}
...
...
@@ -526,6 +539,7 @@ int wsrep_init()
{
DBUG_PRINT
(
"wsrep"
,(
"wsrep::init() failed: %d"
,
rcode
));
WSREP_ERROR
(
"wsrep::init() failed: %d, must shutdown"
,
rcode
);
wsrep
->
free
(
wsrep
);
free
(
wsrep
);
wsrep
=
NULL
;
}
...
...
@@ -670,6 +684,7 @@ int wsrep_init()
{
DBUG_PRINT
(
"wsrep"
,(
"wsrep::init() failed: %d"
,
rcode
));
WSREP_ERROR
(
"wsrep::init() failed: %d, must shutdown"
,
rcode
);
wsrep
->
free
(
wsrep
);
free
(
wsrep
);
wsrep
=
NULL
;
}
else
{
...
...
sql/wsrep_notify.cc
View file @
99df0fba
...
...
@@ -75,6 +75,8 @@ void wsrep_notify_status (wsrep_member_status_t status,
cmd_off
+=
snprintf
(
cmd_ptr
+
cmd_off
,
cmd_len
-
cmd_off
,
" --index %d"
,
view
->
my_idx
);
if
(
view
->
memb_num
)
{
cmd_off
+=
snprintf
(
cmd_ptr
+
cmd_off
,
cmd_len
-
cmd_off
,
" --members"
);
for
(
int
i
=
0
;
i
<
view
->
memb_num
;
i
++
)
...
...
@@ -86,6 +88,7 @@ void wsrep_notify_status (wsrep_member_status_t status,
view
->
members
[
i
].
incoming
);
}
}
}
if
(
cmd_off
==
cmd_len
)
{
...
...
sql/wsrep_sst.cc
View file @
99df0fba
...
...
@@ -763,9 +763,11 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_PORT
" '%s' "
WSREP_SST_OPT_LPORT
" '%u' "
WSREP_SST_OPT_SOCKET
" '%s' "
WSREP_SST_OPT_CONF
" '%s' "
WSREP_SST_OPT_GTID
" '%s:%lld'"
"%s"
,
user
,
pswd
,
host
,
port
,
mysqld_port
,
mysqld_unix_port
,
uuid_str
,
user
,
pswd
,
host
,
port
,
mysqld_port
,
mysqld_unix_port
,
wsrep_defaults_file
,
uuid_str
,
(
long
long
)
seqno
,
bypass
?
" "
WSREP_SST_OPT_BYPASS
:
""
);
WSREP_DEBUG
(
"Running: '%s'"
,
cmd_str
);
...
...
wsrep/wsrep_dummy.c
View file @
99df0fba
...
...
@@ -20,13 +20,11 @@
#include <errno.h>
#include <stdbool.h>
#include <string.h>
/*! Dummy backend context. */
typedef
struct
wsrep_dummy
{
wsrep_log_cb_t
log_fn
;
char
*
options
;
}
wsrep_dummy_t
;
/* Get pointer to wsrep_dummy context from wsrep_t pointer */
...
...
@@ -44,10 +42,6 @@ typedef struct wsrep_dummy
static
void
dummy_free
(
wsrep_t
*
w
)
{
WSREP_DBUG_ENTER
(
w
);
if
(
WSREP_DUMMY
(
w
)
->
options
)
{
free
(
WSREP_DUMMY
(
w
)
->
options
);
}
free
(
w
->
ctx
);
w
->
ctx
=
NULL
;
}
...
...
@@ -55,15 +49,8 @@ static void dummy_free(wsrep_t *w)
static
wsrep_status_t
dummy_init
(
wsrep_t
*
w
,
const
struct
wsrep_init_args
*
args
)
{
WSREP_DBUG_ENTER
(
w
);
WSREP_DUMMY
(
w
)
->
log_fn
=
args
->
logger_cb
;
if
(
args
->
options
)
{
char
*
options
=
malloc
(
strlen
(
args
->
options
)
+
1
);
if
(
options
==
NULL
)
return
WSREP_WARNING
;
strcpy
(
options
,
args
->
options
);
WSREP_DUMMY
(
w
)
->
options
=
options
;
}
WSREP_DBUG_ENTER
(
w
);
return
WSREP_OK
;
}
...
...
@@ -74,41 +61,16 @@ static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused)))
static
wsrep_status_t
dummy_options_set
(
wsrep_t
*
w
,
const
char
*
conf
)
{
char
*
options
=
NULL
;
WSREP_DBUG_ENTER
(
w
);
// concatenate config string with ';'
options
=
WSREP_DUMMY
(
w
)
->
options
;
if
(
options
==
NULL
)
{
options
=
malloc
(
strlen
(
conf
)
+
1
);
if
(
options
==
NULL
)
{
return
WSREP_WARNING
;
}
strcpy
(
options
,
conf
);
}
else
{
int
opt_len
=
strlen
(
options
);
char
*
p
=
realloc
(
options
,
opt_len
+
1
+
// ';'
strlen
(
conf
)
+
1
);
// \0
if
(
p
==
NULL
)
{
return
WSREP_WARNING
;
}
p
[
opt_len
]
=
';'
;
strcpy
(
p
+
opt_len
+
1
,
conf
);
options
=
p
;
}
WSREP_DUMMY
(
w
)
->
options
=
options
;
const
char
*
conf
__attribute__
((
unused
)))
{
WSREP_DBUG_ENTER
(
w
);
return
WSREP_OK
;
}
static
char
*
dummy_options_get
(
wsrep_t
*
w
)
{
WSREP_DBUG_ENTER
(
w
);
return
WSREP_DUMMY
(
w
)
->
options
;
return
NULL
;
}
static
wsrep_status_t
dummy_connect
(
...
...
@@ -423,8 +385,6 @@ int wsrep_dummy_loader(wsrep_t* w)
// initialize private context
WSREP_DUMMY
(
w
)
->
log_fn
=
NULL
;
WSREP_DUMMY
(
w
)
->
options
=
NULL
;
return
0
;
}
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