Skip to content

Commit

Permalink
Merged revisions 3418..3424 from mariadb-galera-5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Seppo Jaakola committed Oct 7, 2013
1 parent 06a7eeb commit 255e20a
Show file tree
Hide file tree
Showing 18 changed files with 188 additions and 77 deletions.
2 changes: 1 addition & 1 deletion cmake/install_macros.cmake
Expand Up @@ -32,7 +32,7 @@ MACRO (INSTALL_DSYM_DIRECTORIES targets)
# It's a dirty hack, but cmake too stupid and mysql cmake files too buggy */
STRING(REPLACE "liblibmysql.dylib" "libmysqlclient.${SHARED_LIB_MAJOR_VERSION}.dylib" location ${location})
IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY")
INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${INSTALL_LOCATION} COMPONENT Debuginfo)
INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${ARG_DESTINATION} COMPONENT Debuginfo)
ENDIF()
ENDFOREACH()
ENDIF()
Expand Down
2 changes: 1 addition & 1 deletion cmake/wsrep.cmake
Expand Up @@ -17,7 +17,7 @@
# so WSREP_VERSION is produced regardless

# Set the patch version
SET(WSREP_PATCH_VERSION "7.5")
SET(WSREP_PATCH_VERSION "7.6")

# Obtain patch revision number
SET(WSREP_PATCH_REVNO $ENV{WSREP_REV})
Expand Down
9 changes: 8 additions & 1 deletion mysql-test/r/mysqld--help.result
Expand Up @@ -1016,10 +1016,15 @@ The following options may be given as the first argument:
--wsrep-dbug-option=name
DBUG options to provider library
--wsrep-debug To enable debug level logging
--wsrep-desync To desynchronize the node from the cluster
--wsrep-drupal-282555-workaround
To use a workaround forbad autoincrement value
--wsrep-forced-binlog-format=name
binlog format to take effect over user's choice
--wsrep-load-data-splitting
To commit LOAD DATA transaction after every 10K rows
inserted
(Defaults to on; use --skip-wsrep-load-data-splitting to disable.)
--wsrep-log-conflicts
To log multi-master conflicts
--wsrep-max-ws-rows=#
Expand Down Expand Up @@ -1360,8 +1365,10 @@ wsrep-convert-LOCK-to-trx FALSE
wsrep-data-home-dir
wsrep-dbug-option
wsrep-debug FALSE
wsrep-desync FALSE
wsrep-drupal-282555-workaround FALSE
wsrep-forced-binlog-format NONE
wsrep-load-data-splitting TRUE
wsrep-log-conflicts FALSE
wsrep-max-ws-rows 131072
wsrep-max-ws-size 1073741824
Expand All @@ -1379,7 +1386,7 @@ wsrep-slave-threads 1
wsrep-sst-auth (No default value)
wsrep-sst-donor
wsrep-sst-donor-rejects-queries FALSE
wsrep-sst-method mysqldump
wsrep-sst-method rsync
wsrep-sst-receive-address AUTO
wsrep-start-position 00000000-0000-0000-0000-000000000000:-1

Expand Down
2 changes: 2 additions & 0 deletions mysql-test/suite/sys_vars/r/all_vars.result
Expand Up @@ -20,8 +20,10 @@ wsrep_convert_lock_to_trx
wsrep_data_home_dir
wsrep_dbug_option
wsrep_debug
wsrep_desync
wsrep_drupal_282555_workaround
wsrep_forced_binlog_format
wsrep_load_data_splitting
wsrep_log_conflicts
wsrep_max_ws_rows
wsrep_max_ws_size
Expand Down
12 changes: 3 additions & 9 deletions mysys/my_default.c
Expand Up @@ -112,15 +112,9 @@ static my_bool find_wsrep_new_cluster (int* argc, char* argv[])
{
ret= TRUE;
*argc -= 1;
if (*argc == i)
{ // last argument, just zero it up
argv[i]= NULL;
}
else
{ // not the last argument, copy the last one over and zero that up.
argv[i]= argv[*argc];
argv[*argc]= NULL;
}
/* preserve the order of remaining arguments */
memmove(&argv[i], &argv[i + 1], (*argc - i)*sizeof(argv[i]));
argv[*argc]= NULL;
}
}

Expand Down
3 changes: 0 additions & 3 deletions scripts/mysqld_safe.sh
Expand Up @@ -945,9 +945,6 @@ have_sleep=1
# maximum number of wsrep restarts
max_wsrep_restarts=0

# maximum number of wsrep restarts
max_wsrep_restarts=0

while true
do
rm -f "$pid_file" # Some extra safety
Expand Down
109 changes: 58 additions & 51 deletions scripts/wsrep_sst_rsync.sh
Expand Up @@ -67,16 +67,24 @@ check_pid_and_port()
MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
rm -rf "$MAGIC_FILE"

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd -P)
WSREP_LOG_DIR=${WSREP_LOG_DIR:-$($SCRIPT_DIR/my_print_defaults --defaults-file "$WSREP_SST_OPT_CONF" mysqld server mysqld-5.5 \
| grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' | cut -b 29- )}
if [ -n "${WSREP_LOG_DIR:-""}" ]; then
WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P)
else
WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P)
fi

# Old filter - include everything except selected
# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \
# --exclude '*.conf' --exclude core --exclude 'galera.*' \
# --exclude grastate.txt --exclude '*.pem' \
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')

# New filter - exclude everything except dirs (schemas) and innodb files
FILTER=(-f '- lost+found' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /ib_logfile*' -f '+ */' -f '-! */*')
# Old versions of rsync have a bug transferring filter rules to daemon, so specify filter rules directly to daemon
FILTER_DAEMON="- lost+found + /ib_lru_dump + /ibdata* + ib_logfile* + */ -! */*"
FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
-f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*')

if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
then
Expand Down Expand Up @@ -107,54 +115,58 @@ then

# first, the normal directories, so that we can detect incompatible protocol
RC=0
rsync --archive --no-times --ignore-times --inplace --delete --quiet \
--no-recursive --dirs \
rsync --owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \
rsync://$WSREP_SST_OPT_ADDR-with_filter || RC=$?

[ $RC -ne 0 ] && wsrep_log_error "rsync returned code $RC:"

case $RC in
0) RC=0 # Success
;;
12) RC=71 # EPROTO
wsrep_log_error \
"rsync server on the other end has incompatible protocol. " \
"Make sure you have the same version of rsync on all nodes."
;;
22) RC=12 # ENOMEM
;;
*) RC=255 # unknown error
;;
esac

[ $RC -ne 0 ] && exit $RC
rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$?

if [ "$RC" -ne 0 ]; then
wsrep_log_error "rsync returned code $RC:"

case $RC in
12) RC=71 # EPROTO
wsrep_log_error \
"rsync server on the other end has incompatible protocol. " \
"Make sure you have the same version of rsync on all nodes."
;;
22) RC=12 # ENOMEM
;;
*) RC=255 # unknown error
;;
esac
exit $RC
fi

# second, we transfer InnoDB log files
rsync --owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \
rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$?

if [ $RC -ne 0 ]; then
wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:"
exit 255 # unknown error
fi

# then, we parallelize the transfer of database directories, use . so that pathconcatenation works
pushd "$WSREP_SST_OPT_DATA" 1>/dev/null
pushd "$WSREP_SST_OPT_DATA" >/dev/null

count=1
[ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
[ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu)

find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \
rsync --archive --no-times --ignore-times --inplace --delete --quiet \
$WHOLE_FILE_OPT "$WSREP_SST_OPT_DATA"/{}/ \
rsync://$WSREP_SST_OPT_ADDR/{} || RC=$?

popd 1>/dev/null
rsync --owner --group --perms --links --specials \
--ignore-times --inplace --recursive --delete --quiet \
$WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \
rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$?

[ $RC -ne 0 ] && wsrep_log_error "find/rsync returned code $RC:"

case $RC in
0) RC=0 # Success
;;
*) RC=255 # unknown error
;;
esac

[ $RC -ne 0 ] && exit $RC
popd >/dev/null

if [ $RC -ne 0 ]; then
wsrep_log_error "find/rsync returned code $RC:"
exit 255 # unknown error
fi

else # BYPASS
wsrep_log_info "Bypassing state dump."
Expand Down Expand Up @@ -203,19 +215,14 @@ then
cat << EOF > "$RSYNC_CONF"
pid file = $RSYNC_PID
use chroot = no
[$MODULE-with_filter]
path = $WSREP_SST_OPT_DATA
read only = no
timeout = 300
uid = $MYUID
gid = $MYGID
filter = $FILTER_DAEMON
read only = no
timeout = 300
uid = $MYUID
gid = $MYGID
[$MODULE]
path = $WSREP_SST_OPT_DATA
read only = no
timeout = 300
uid = $MYUID
gid = $MYGID
[$MODULE-log_dir]
path = $WSREP_LOG_DIR
EOF

# rm -rf "$DATA"/ib_logfile* # we don't want old logs around
Expand Down
7 changes: 6 additions & 1 deletion sql/mysqld.cc
Expand Up @@ -738,6 +738,7 @@ wsrep_aborting_thd_t wsrep_aborting_thd= NULL;
mysql_mutex_t LOCK_wsrep_replaying;
mysql_cond_t COND_wsrep_replaying;
mysql_mutex_t LOCK_wsrep_slave_threads;
mysql_mutex_t LOCK_wsrep_desync;
int wsrep_replaying= 0;
static void wsrep_close_threads(THD* thd);
#endif
Expand Down Expand Up @@ -881,7 +882,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd,
key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst,
key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init,
key_LOCK_wsrep_slave_threads;
key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync;
#endif
PSI_mutex_key key_RELAYLOG_LOCK_index;
PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state;
Expand Down Expand Up @@ -966,6 +967,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0},
{ &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL},
#endif
{ &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL},
Expand Down Expand Up @@ -2217,6 +2219,7 @@ static void clean_up_mutexes()
(void) mysql_mutex_destroy(&LOCK_wsrep_replaying);
(void) mysql_cond_destroy(&COND_wsrep_replaying);
(void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads);
(void) mysql_mutex_destroy(&LOCK_wsrep_desync);
#endif
mysql_mutex_destroy(&LOCK_server_started);
mysql_cond_destroy(&COND_server_started);
Expand Down Expand Up @@ -4482,6 +4485,8 @@ static int init_thread_environment()
mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL);
mysql_mutex_init(key_LOCK_wsrep_slave_threads,
&LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_wsrep_desync,
&LOCK_wsrep_desync, MY_MUTEX_INIT_FAST);
#endif

DBUG_RETURN(0);
Expand Down
24 changes: 24 additions & 0 deletions sql/sql_parse.cc
Expand Up @@ -2656,7 +2656,11 @@ mysql_execute_command(THD *thd)
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
/* Commit the normal transaction if one is active. */
if (trans_commit_implicit(thd))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id);
goto error;
}
/* Release metadata locks acquired in this transaction. */
thd->mdl_context.release_transactional_locks();
}
Expand Down Expand Up @@ -4588,7 +4592,11 @@ case SQLCOM_PREPARE:

case SQLCOM_BEGIN:
if (trans_begin(thd, lex->start_transaction_opt))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id);
goto error;
}
my_ok(thd);
break;
case SQLCOM_COMMIT:
Expand All @@ -4602,7 +4610,11 @@ case SQLCOM_PREPARE:
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
if (trans_commit(thd))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id);
goto error;
}
thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
if (tx_chain)
Expand Down Expand Up @@ -4636,7 +4648,11 @@ case SQLCOM_PREPARE:
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
if (trans_rollback(thd))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id);
goto error;
}
thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
if (tx_chain)
Expand Down Expand Up @@ -5181,7 +5197,11 @@ case SQLCOM_PREPARE:
break;
case SQLCOM_XA_COMMIT:
if (trans_xa_commit(thd))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id);
goto error;
}
thd->mdl_context.release_transactional_locks();
/*
We've just done a commit, reset transaction
Expand All @@ -5193,7 +5213,11 @@ case SQLCOM_PREPARE:
break;
case SQLCOM_XA_ROLLBACK:
if (trans_xa_rollback(thd))
{
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id);
goto error;
}
thd->mdl_context.release_transactional_locks();
/*
We've just done a rollback, reset transaction
Expand Down
11 changes: 11 additions & 0 deletions sql/sys_vars.cc
Expand Up @@ -2971,6 +2971,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
if (trans_commit_stmt(thd) || trans_commit(thd))
{
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id);
return true;
}
/*
Expand Down Expand Up @@ -4253,6 +4255,15 @@ static Sys_var_enum Sys_wsrep_OSU_method(
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(0));

static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync);
static Sys_var_mybool Sys_wsrep_desync (
"wsrep_desync", "To desynchronize the node from the cluster",
GLOBAL_VAR(wsrep_desync),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
&PLock_wsrep_desync, NOT_IN_BINLOG,
ON_CHECK(wsrep_desync_check),
ON_UPDATE(wsrep_desync_update));

static Sys_var_enum Sys_wsrep_forced_binlog_format(
"wsrep_forced_binlog_format", "binlog format to take effect over user's choice",
GLOBAL_VAR(wsrep_forced_binlog_format),
Expand Down

0 comments on commit 255e20a

Please sign in to comment.