Commit 0b98d2fd authored by Nirbhay Choubey's avatar Nirbhay Choubey

bzr merge -r4065..4088 codership/5.6

parent 0903e2b7
...@@ -128,5 +128,5 @@ else ...@@ -128,5 +128,5 @@ else
wsrep_log_info "Bypassing state dump." wsrep_log_info "Bypassing state dump."
echo $SET_START_POSITION | $MYSQL echo $SET_START_POSITION | $MYSQL
fi fi
wsrep_cleanup_progress_file
# #
...@@ -860,10 +860,27 @@ then ...@@ -860,10 +860,27 @@ then
fi fi
fi fi
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
# To avoid comparing data directory and BINLOG_DIRNAME
mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true
pushd $BINLOG_DIRNAME &>/dev/null
for bfiles in $(ls -1 ${BINLOG_FILENAME}.*);do
echo ${BINLOG_DIRNAME}/${bfiles} >> ${BINLOG_FILENAME}.index
done
popd &> /dev/null
fi
if [[ $incremental -eq 1 ]];then if [[ $incremental -eq 1 ]];then
# Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues.
INNOAPPLY="${INNOBACKUPEX_BIN} $disver --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" --ibbackup=xtrabackup_56 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log"
fi fi
wsrep_log_info "Preparing the backup at ${DATA}" wsrep_log_info "Preparing the backup at ${DATA}"
......
...@@ -62,7 +62,6 @@ err: ...@@ -62,7 +62,6 @@ err:
#include "rpl_rli.h" // class Relay_log_info; #include "rpl_rli.h" // class Relay_log_info;
#include "sql_base.h" // close_temporary_table() #include "sql_base.h" // close_temporary_table()
static inline void static inline void
wsrep_set_apply_format(THD* thd, Format_description_log_event* ev) wsrep_set_apply_format(THD* thd, Format_description_log_event* ev)
{ {
...@@ -94,7 +93,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd, ...@@ -94,7 +93,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
int rcode= 0; int rcode= 0;
int event= 1; int event= 1;
DBUG_ENTER("wsrep_apply_rbr"); DBUG_ENTER("wsrep_apply_events");
if (thd->killed == KILL_CONNECTION) if (thd->killed == KILL_CONNECTION)
{ {
...@@ -118,7 +117,6 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd, ...@@ -118,7 +117,6 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
Log_event* ev= wsrep_read_log_event(&buf, &buf_len, Log_event* ev= wsrep_read_log_event(&buf, &buf_len,
wsrep_get_apply_format(thd)); wsrep_get_apply_format(thd));
if (!ev) if (!ev)
{ {
WSREP_ERROR("applier could not read binlog event, seqno: %lld, len: %zu", WSREP_ERROR("applier could not read binlog event, seqno: %lld, len: %zu",
...@@ -126,6 +124,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd, ...@@ -126,6 +124,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
rcode= 1; rcode= 1;
goto error; goto error;
} }
switch (ev->get_type_code()) { switch (ev->get_type_code()) {
case FORMAT_DESCRIPTION_EVENT: case FORMAT_DESCRIPTION_EVENT:
wsrep_set_apply_format(thd, (Format_description_log_event*)ev); wsrep_set_apply_format(thd, (Format_description_log_event*)ev);
...@@ -368,6 +367,7 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx, ...@@ -368,6 +367,7 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
return rcode; return rcode;
} }
wsrep_cb_status_t wsrep_unordered_cb(void* const ctx, wsrep_cb_status_t wsrep_unordered_cb(void* const ctx,
const void* const data, const void* const data,
size_t const size) size_t const size)
......
...@@ -46,6 +46,9 @@ int wsrep_write_cache (wsrep_t* wsrep, ...@@ -46,6 +46,9 @@ int wsrep_write_cache (wsrep_t* wsrep,
/* Dump replication buffer to disk */ /* Dump replication buffer to disk */
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len); void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len);
/* Dump replication buffer to disk without intermediate buffer */
void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache);
int wsrep_binlog_close_connection(THD* thd); int wsrep_binlog_close_connection(THD* thd);
int wsrep_binlog_savepoint_set(THD *thd, void *sv); int wsrep_binlog_savepoint_set(THD *thd, void *sv);
int wsrep_binlog_savepoint_rollback(THD *thd, void *sv); int wsrep_binlog_savepoint_rollback(THD *thd, void *sv);
......
...@@ -77,10 +77,10 @@ void wsrep_register_hton(THD* thd, bool all) ...@@ -77,10 +77,10 @@ void wsrep_register_hton(THD* thd, bool all)
trans_register_ha(thd, all, wsrep_hton); trans_register_ha(thd, all, wsrep_hton);
/* follow innodb read/write settting /* follow innodb read/write settting
* but, as an exception: CTAS with empty result set will not be * but, as an exception: CTAS with empty result set will not be
* replicated unless we declare wsrep hton as read/write here * replicated unless we declare wsrep hton as read/write here
*/ */
if (i->is_trx_read_write() || if (i->is_trx_read_write() ||
(thd->lex->sql_command == SQLCOM_CREATE_TABLE && (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
thd->wsrep_exec_mode == LOCAL_STATE)) thd->wsrep_exec_mode == LOCAL_STATE))
{ {
...@@ -104,7 +104,7 @@ void wsrep_post_commit(THD* thd, bool all) ...@@ -104,7 +104,7 @@ void wsrep_post_commit(THD* thd, bool all)
if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle)) if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
{ {
DBUG_PRINT("wsrep", ("set committed fail")); DBUG_PRINT("wsrep", ("set committed fail"));
WSREP_WARN("set committed fail: %llu %d", WSREP_WARN("set committed fail: %llu %d",
(long long)thd->real_id, thd->get_stmt_da()->status()); (long long)thd->real_id, thd->get_stmt_da()->status());
} }
wsrep_cleanup_transaction(thd); wsrep_cleanup_transaction(thd);
...@@ -202,7 +202,7 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all) ...@@ -202,7 +202,7 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
switch (thd->wsrep_exec_mode) switch (thd->wsrep_exec_mode)
{ {
case TOTAL_ORDER: case TOTAL_ORDER:
case REPL_RECV: case REPL_RECV:
mysql_mutex_unlock(&thd->LOCK_wsrep_thd); mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
WSREP_DEBUG("Avoiding wsrep rollback for failed DDL: %s", thd->query()); WSREP_DEBUG("Avoiding wsrep rollback for failed DDL: %s", thd->query());
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -280,7 +280,7 @@ wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all) ...@@ -280,7 +280,7 @@ wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all)
int replay_round= 0; int replay_round= 0;
if (thd->get_stmt_da()->is_error()) { if (thd->get_stmt_da()->is_error()) {
WSREP_ERROR("commit issue, error: %d %s", WSREP_ERROR("commit issue, error: %d %s",
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
} }
......
...@@ -443,7 +443,7 @@ static void wsrep_synced_cb(void* app_ctx) ...@@ -443,7 +443,7 @@ static void wsrep_synced_cb(void* app_ctx)
active_mi, active_mi,
master_info_file, master_info_file,
relay_log_info_file, relay_log_info_file,
SLAVE_SQL))) SLAVE_SQL)))
{ {
WSREP_WARN("Failed to create slave threads: %d", rcode); WSREP_WARN("Failed to create slave threads: %d", rcode);
} }
...@@ -1008,8 +1008,8 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd, ...@@ -1008,8 +1008,8 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd,
memset(&tmp_table, 0, sizeof(tmp_table)); memset(&tmp_table, 0, sizeof(tmp_table));
tmp_table.table_name= (char*)table; tmp_table.table_name= (char*)table;
tmp_table.db= (char*)db; tmp_table.db= (char*)db;
tmp_table.mdl_request.init(MDL_key::GLOBAL, (db) ? db : "", tmp_table.mdl_request.init(MDL_key::GLOBAL, (db) ? db : "",
(table) ? table : "", (table) ? table : "",
MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT); MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT);
if (!table || !find_temporary_table(thd, &tmp_table)) if (!table || !find_temporary_table(thd, &tmp_table))
...@@ -1149,8 +1149,8 @@ int wsrep_to_buf_helper( ...@@ -1149,8 +1149,8 @@ int wsrep_to_buf_helper(
/* if there is prepare query, add event for it */ /* if there is prepare query, add event for it */
if (!ret && thd->wsrep_TOI_pre_query) if (!ret && thd->wsrep_TOI_pre_query)
{ {
Query_log_event ev(thd, thd->wsrep_TOI_pre_query, Query_log_event ev(thd, thd->wsrep_TOI_pre_query,
thd->wsrep_TOI_pre_query_len, thd->wsrep_TOI_pre_query_len,
FALSE, FALSE, FALSE, 0); FALSE, FALSE, FALSE, 0);
if (ev.write(&tmp_io_cache)) ret= 1; if (ev.write(&tmp_io_cache)) ret= 1;
} }
......
...@@ -1937,6 +1937,10 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1937,6 +1937,10 @@ row_ins_scan_sec_index_for_duplicate(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(s_latch == rw_lock_own(&index->lock, RW_LOCK_SHARED)); ut_ad(s_latch == rw_lock_own(&index->lock, RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0)) return(DB_SUCCESS);
#endif /* WITH_WSREP */
n_unique = dict_index_get_n_unique(index); n_unique = dict_index_get_n_unique(index);
...@@ -2005,10 +2009,6 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -2005,10 +2009,6 @@ row_ins_scan_sec_index_for_duplicate(
lock_type, block, rec, index, offsets, thr); lock_type, block, rec, index, offsets, thr);
} else { } else {
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (!wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0))
#endif /* WITH_WSREP */
err = row_ins_set_shared_rec_lock( err = row_ins_set_shared_rec_lock(
lock_type, block, rec, index, offsets, thr); lock_type, block, rec, index, offsets, thr);
} }
......
...@@ -365,6 +365,7 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -365,6 +365,7 @@ wsrep_row_upd_check_foreign_constraints(
ulint n_ext; ulint n_ext;
dberr_t err; dberr_t err;
ibool got_s_lock = FALSE; ibool got_s_lock = FALSE;
ibool opened = FALSE;
if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) { if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) {
...@@ -412,6 +413,7 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -412,6 +413,7 @@ wsrep_row_upd_check_foreign_constraints(
dict_table_open_on_name( dict_table_open_on_name(
foreign->referenced_table_name_lookup, foreign->referenced_table_name_lookup,
FALSE, FALSE, DICT_ERR_IGNORE_NONE); FALSE, FALSE, DICT_ERR_IGNORE_NONE);
opened = TRUE;
} }
if (foreign->referenced_table) { if (foreign->referenced_table) {
...@@ -440,6 +442,11 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -440,6 +442,11 @@ wsrep_row_upd_check_foreign_constraints(
(foreign->referenced_table (foreign->referenced_table
->n_foreign_key_checks_running)--; ->n_foreign_key_checks_running)--;
if (opened == TRUE) {
dict_table_close(foreign->referenced_table, TRUE, FALSE);
opened = FALSE;
}
mutex_exit(&(dict_sys->mutex)); mutex_exit(&(dict_sys->mutex));
} }
......
...@@ -1949,6 +1949,10 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1949,6 +1949,10 @@ row_ins_scan_sec_index_for_duplicate(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(s_latch == rw_lock_own(&index->lock, RW_LOCK_SHARED)); ut_ad(s_latch == rw_lock_own(&index->lock, RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0)) return(DB_SUCCESS);
#endif /* WITH_WSREP */
n_unique = dict_index_get_n_unique(index); n_unique = dict_index_get_n_unique(index);
...@@ -2017,10 +2021,6 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -2017,10 +2021,6 @@ row_ins_scan_sec_index_for_duplicate(
lock_type, block, rec, index, offsets, thr); lock_type, block, rec, index, offsets, thr);
} else { } else {
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (!wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0))
#endif /* WITH_WSREP */
err = row_ins_set_shared_rec_lock( err = row_ins_set_shared_rec_lock(
lock_type, block, rec, index, offsets, thr); lock_type, block, rec, index, offsets, thr);
} }
......
...@@ -367,6 +367,7 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -367,6 +367,7 @@ wsrep_row_upd_check_foreign_constraints(
ulint n_ext; ulint n_ext;
dberr_t err; dberr_t err;
ibool got_s_lock = FALSE; ibool got_s_lock = FALSE;
ibool opened = FALSE;
if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) { if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) {
...@@ -414,6 +415,7 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -414,6 +415,7 @@ wsrep_row_upd_check_foreign_constraints(
dict_table_open_on_name( dict_table_open_on_name(
foreign->referenced_table_name_lookup, foreign->referenced_table_name_lookup,
FALSE, FALSE, DICT_ERR_IGNORE_NONE); FALSE, FALSE, DICT_ERR_IGNORE_NONE);
opened = TRUE;
} }
if (foreign->referenced_table) { if (foreign->referenced_table) {
...@@ -442,6 +444,11 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -442,6 +444,11 @@ wsrep_row_upd_check_foreign_constraints(
(foreign->referenced_table (foreign->referenced_table
->n_foreign_key_checks_running)--; ->n_foreign_key_checks_running)--;
if (opened == TRUE) {
dict_table_close(foreign->referenced_table, TRUE, FALSE);
opened = FALSE;
}
mutex_exit(&(dict_sys->mutex)); mutex_exit(&(dict_sys->mutex));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment