Skip to content

Commit

Permalink
* bzr merge -r4027..4061 codership/5.6
Browse files Browse the repository at this point in the history
* Merged Innodb changes to xtradb
  • Loading branch information
Nirbhay Choubey committed Mar 26, 2014
1 parent 7d892f6 commit b5871a5
Show file tree
Hide file tree
Showing 28 changed files with 522 additions and 511 deletions.
3 changes: 3 additions & 0 deletions cmake/install_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ MACRO (INSTALL_DSYM_DIRECTORIES targets)
GET_TARGET_PROPERTY(type ${target} TYPE)
# 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(DEBUG_EXTNAME)
STRING(REGEX REPLACE "/mysqld$" "/mysqld-debug" location ${location})
ENDIF()
IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY")
INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${ARG_DESTINATION} COMPONENT Debuginfo)
ENDIF()
Expand Down
8 changes: 2 additions & 6 deletions scripts/wsrep_sst_xtrabackup-v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ read_cnf()
ekeyfile=$(parse_cnf sst encrypt-key-file "")
fi
rlimit=$(parse_cnf sst rlimit "")
uextra=$(parse_cnf sst use_extra 0)
uextra=$(parse_cnf sst use-extra 0)
speciald=$(parse_cnf sst sst-special-dirs 1)
iopts=$(parse_cnf sst inno-backup-opts "")
iapts=$(parse_cnf sst inno-apply-opts "")
Expand Down Expand Up @@ -647,10 +647,6 @@ then
[[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
[[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE

if [[ $speciald -eq 1 ]];then
wsrep_log_info "WARNING: sst-special-dirs feature requires PXC 2.1.6 or latter."
fi

if [[ $speciald -eq 1 ]];then
ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "")
ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "")
Expand Down Expand Up @@ -827,7 +823,7 @@ then

if [[ $incremental -eq 1 ]];then
# Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues.
INNOAPPLY="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} \
INNOAPPLY="${INNOBACKUPEX_BIN} $disver --defaults-file=${WSREP_SST_OPT_CONF} \
--ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log"
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/wsrep_sst_xtrabackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
# Make sure to read that before proceeding!




. $(dirname $0)/wsrep_sst_common

ealgo=""
Expand Down Expand Up @@ -609,8 +611,6 @@ then
if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \
"exit codes: ${RC[@]}"
wsrep_log_error "Data directory ${DATA} needs to be empty for SST:" \
"Manual intervention required in that case"
exit 32
fi
done
Expand Down
23 changes: 21 additions & 2 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,27 @@ int ha_prepare(THD *thd)
{
if ((err= ht->prepare(ht, thd, all)))
{
#ifdef WITH_WSREP
if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP)
{
error= 1;
/* avoid sending error, if we need to replay */
if (thd->wsrep_conflict_state!= MUST_REPLAY)
{
my_error(ER_LOCK_DEADLOCK, MYF(0), err);
}
}
else
{
/* not wsrep hton, bail to native mysql behavior */
#endif
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
ha_rollback_trans(thd, all);
error=1;
break;
#ifdef WITH_WSREP
}
#endif
}
}
else
Expand Down Expand Up @@ -1419,7 +1436,7 @@ int ha_commit_trans(THD *thd, bool all)
my_error(ER_LOCK_DEADLOCK, MYF(0), err);
}
}
lse
else
/* not wsrep hton, bail to native mysql behavior */
#endif /* WITH_WSREP */
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
Expand Down Expand Up @@ -5666,7 +5683,9 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
table->s->cached_row_logging_check &&
(thd->variables.option_bits & OPTION_BIN_LOG) &&
#ifdef WITH_WSREP
((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
/* applier and replayer should not binlog */
((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) ||
mysql_bin_log.is_open()));
#else
mysql_bin_log.is_open());
#endif
Expand Down
11 changes: 6 additions & 5 deletions sql/mdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <mysql/plugin.h>
#include <mysql/service_thd_wait.h>
#include <mysql/psi/mysql_stage.h>
#include <my_murmur3.h>

#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
#include "wsrep_thd.h"
Expand All @@ -34,7 +36,6 @@ extern bool
wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
MDL_ticket *ticket);
#endif /* WITH_WSREP */

#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_map_mutex;
static PSI_mutex_key key_MDL_wait_LOCK_wait_status;
Expand Down Expand Up @@ -1482,7 +1483,7 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
DBUG_ASSERT(ticket->get_lock());
#ifdef WITH_WSREP
if ((this == &(ticket->get_lock()->m_waiting)) &&
wsrep_thd_is_BF((void *)(ticket->get_ctx()->get_thd()), false))
wsrep_thd_is_BF((void *)(ticket->get_ctx()->wsrep_get_thd()), false))
{
Ticket_iterator itw(ticket->get_lock()->m_waiting);
Ticket_iterator itg(ticket->get_lock()->m_granted);
Expand All @@ -1493,7 +1494,7 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)

while ((waiting= itw++) && !added)
{
if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->get_thd()), true))
if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->wsrep_get_thd()), true))
{
WSREP_DEBUG("MDL add_ticket inserted before: %lu %s",
wsrep_thd_thread_id(waiting->get_ctx()->wsrep_get_thd()),
Expand Down Expand Up @@ -1894,7 +1895,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
ticket->is_incompatible_when_granted(type_arg))
#ifdef WITH_WSREP
{
if (wsrep_thd_is_BF((void *)(requestor_ctx->get_thd()), false) &&
if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()),false) &&
key.mdl_namespace() == MDL_key::GLOBAL)
{
WSREP_DEBUG("global lock granted for BF: %lu %s",
Expand Down Expand Up @@ -1935,7 +1936,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
#ifdef WITH_WSREP
else
{
if (wsrep_thd_is_BF((void *)(requestor_ctx->get_thd()), false) &&
if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()), false) &&
key.mdl_namespace() == MDL_key::GLOBAL)
{
WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s",
Expand Down
103 changes: 57 additions & 46 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
#include "wsrep_var.h"
#include "wsrep_thd.h"
#include "wsrep_sst.h"
ulong wsrep_running_threads = 0; // # of currently running wsrep threads
#endif
#include "sql_callback.h"
#include "threadpool.h"
Expand Down Expand Up @@ -4876,42 +4875,8 @@ will be ignored as the --log-bin option is not defined.");
}
#endif

#ifdef WITH_WSREP /* WSREP BEFORE SE */
if (!wsrep_recovery)
{
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality
{
wsrep_provider_init(WSREP_NONE);
if (wsrep_init()) unireg_abort(1);
}
else // full wsrep initialization
{
// add basedir/bin to PATH to resolve wsrep script names
char* const tmp_path((char*)alloca(strlen(mysql_home) +
strlen("/bin") + 1));
if (tmp_path)
{
strcpy(tmp_path, mysql_home);
strcat(tmp_path, "/bin");
wsrep_prepend_PATH(tmp_path);
}
else
{
WSREP_ERROR("Could not append %s/bin to PATH", mysql_home);
}
DBUG_ASSERT(!opt_bin_log || opt_bin_logname);

if (wsrep_before_SE())
{
#ifndef EMBEDDED_LIBRARY
set_ports(); // this is also called in network_init() later but we need
// to know mysqld_port now - lp:1071882
#endif /* !EMBEDDED_LIBRARY */
wsrep_init_startup(true);
}
}
}
#endif /* WITH_WSREP */
if (opt_bin_log)
{
/* Reports an error and aborts, if the --log-bin's path
Expand Down Expand Up @@ -4959,10 +4924,67 @@ a file name for --log-bin-index option", opt_binlog_index_name);
{
opt_bin_logname= my_once_strdup(buf, MYF(MY_WME));
}
#ifdef WITH_WSREP /* WSREP BEFORE SE */
/*
Wsrep initialization must happen at this point, because:
- opt_bin_logname must be known when starting replication
since SST may need it
- SST may modify binlog index file, so it must be opened
after SST has happened
*/
}
if (!wsrep_recovery)
{
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality
{
wsrep_provider_init(WSREP_NONE);
if (wsrep_init()) unireg_abort(1);
}
else // full wsrep initialization
{
// add basedir/bin to PATH to resolve wsrep script names
char* const tmp_path((char*)alloca(strlen(mysql_home) +
strlen("/bin") + 1));
if (tmp_path)
{
strcpy(tmp_path, mysql_home);
strcat(tmp_path, "/bin");
wsrep_prepend_PATH(tmp_path);
}
else
{
WSREP_ERROR("Could not append %s/bin to PATH", mysql_home);
}

if (wsrep_before_SE())
{
set_ports(); // this is also called in network_init() later but we need
// to know mysqld_port now - lp:1071882
wsrep_init_startup(true);
}
}
}
if (opt_bin_log)
{
/*
Variable ln is not defined at this scope. We use opt_bin_logname instead.
It should be the same as ln since
- mysql_bin_log.generate_name() returns first argument if new log name
is not generated
- if new log name is generated, return value is assigned to ln and copied
to opt_bin_logname above
*/
if (mysql_bin_log.open_index_file(opt_binlog_index_name, opt_bin_logname,
TRUE))
{
unireg_abort(1);
}
#else
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE))
{
unireg_abort(1);
}
#endif /* WITH_WSREP */
}

/* call ha_init_key_cache() on all key caches to init them */
Expand Down Expand Up @@ -5304,21 +5326,10 @@ pthread_handler_t start_wsrep_THD(void *arg)
++connection_count;
mysql_mutex_unlock(&LOCK_connection_count);

mysql_mutex_lock(&LOCK_thread_count);
wsrep_running_threads++;
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);

processor(thd);

close_connection(thd, 0);

mysql_mutex_lock(&LOCK_thread_count);
wsrep_running_threads--;
WSREP_DEBUG("wsrep running threads now: %lu", wsrep_running_threads);
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);

// Note: We can't call THD destructor without crashing
// if plugins have not been initialized. However, in most of the
// cases this means that pre SE initialization SST failed and
Expand Down
16 changes: 16 additions & 0 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,10 @@ extern "C" void wsrep_thd_awake(THD *thd, my_bool signal)
mysql_mutex_unlock(&LOCK_wsrep_replaying);
}
}
extern "C" int wsrep_thd_retry_counter(THD *thd)
{
return(thd->wsrep_retry_counter);
}

extern int
wsrep_trx_order_before(void *thd1, void *thd2)
Expand Down Expand Up @@ -2127,7 +2131,19 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
(e.g. see partitioning code).
*/
if (!thd_table->needs_reopen())
#ifdef WITH_WSREP
{
signalled|= mysql_lock_abort_for_thread(this, thd_table);
if (this && WSREP(this) && wsrep_thd_is_BF((void *)this, FALSE))
{
WSREP_DEBUG("remove_table_from_cache: %llu",
(unsigned long long) this->real_id);
wsrep_abort_thd((void *)this, (void *)in_use, FALSE);
}
}
#else
signalled|= mysql_lock_abort_for_thread(this, thd_table);
#endif
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
Expand Down
2 changes: 1 addition & 1 deletion sql/wsrep_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len)
error:
if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
{
WSREP_ERROR("failed to initialize io-cache");
WSREP_WARN("failed to initialize io-cache");
}
cleanup:
my_free(*buf);
Expand Down
1 change: 1 addition & 0 deletions sql/wsrep_mysqld.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ extern "C" char * wsrep_thd_query(THD *thd);
extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd);
extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
extern "C" void wsrep_thd_awake(THD *thd, my_bool signal);
extern "C" int wsrep_thd_retry_counter(THD *thd);


extern void wsrep_close_client_connections(my_bool wait_to_end);
Expand Down
Loading

0 comments on commit b5871a5

Please sign in to comment.