Commit 5b6a4f25 authored by Jan Lindström's avatar Jan Lindström

Fixed issue on wsrep_kill_victim mutexing order error. Furthermore, fixed merge

errors found on mysql-test suite testing.
parent 86d47038
...@@ -3476,6 +3476,11 @@ innobase_commit_low( ...@@ -3476,6 +3476,11 @@ innobase_commit_low(
/*================*/ /*================*/
trx_t* trx) /*!< in: transaction handle */ trx_t* trx) /*!< in: transaction handle */
{ {
if (trx_is_started(trx)) {
trx_commit_for_mysql(trx);
}
#ifdef WITH_WSREP #ifdef WITH_WSREP
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0; const char* tmp = 0;
...@@ -3493,10 +3498,7 @@ innobase_commit_low( ...@@ -3493,10 +3498,7 @@ innobase_commit_low(
#endif /* WSREP_PROC_INFO */ #endif /* WSREP_PROC_INFO */
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
if (trx_is_started(trx)) {
trx_commit_for_mysql(trx);
}
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on((void*)thd)) { thd_proc_info(thd, tmp); } if (wsrep_on((void*)thd)) { thd_proc_info(thd, tmp); }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
......
...@@ -1582,17 +1582,17 @@ lock_rec_other_has_expl_req( ...@@ -1582,17 +1582,17 @@ lock_rec_other_has_expl_req(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#ifdef WITH_WSREP #ifdef WITH_WSREP
static void static void
wsrep_kill_victim(const trx_t * const trx, const lock_t *lock) { wsrep_kill_victim(const trx_t * const trx, const lock_t *lock) {
ut_ad(lock_mutex_own()); ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx)); ut_ad(trx_mutex_own(lock->trx));
int bf_this = wsrep_thd_is_brute_force(trx->mysql_thd); int bf_this = wsrep_thd_is_brute_force(trx->mysql_thd);
int bf_other = int bf_other = wsrep_thd_is_brute_force(lock->trx->mysql_thd);
wsrep_thd_is_brute_force(lock->trx->mysql_thd);
if ((bf_this && !bf_other) || if ((bf_this && !bf_other) ||
(bf_this && bf_other && wsrep_trx_order_before( (bf_this && bf_other && wsrep_trx_order_before(
trx->mysql_thd, lock->trx->mysql_thd))) { trx->mysql_thd, lock->trx->mysql_thd))) {
if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
if (wsrep_debug) if (wsrep_debug)
fprintf(stderr, "WSREP: BF victim waiting\n"); fprintf(stderr, "WSREP: BF victim waiting\n");
...@@ -4656,9 +4656,11 @@ lock_table_other_has_incompatible( ...@@ -4656,9 +4656,11 @@ lock_table_other_has_incompatible(
&& (wait || !lock_get_wait(lock))) { && (wait || !lock_get_wait(lock))) {
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_debug) if (wsrep_debug)
fprintf(stderr, "WSREP: table lock abort"); fprintf(stderr, "WSREP: table lock abort");
trx_mutex_enter(lock->trx);
wsrep_kill_victim((trx_t *)trx, (lock_t *)lock); wsrep_kill_victim((trx_t *)trx, (lock_t *)lock);
trx_mutex_exit(lock->trx);
#endif #endif
return(lock); return(lock);
......
...@@ -1277,21 +1277,21 @@ row_ins_foreign_check_on_constraint( ...@@ -1277,21 +1277,21 @@ row_ins_foreign_check_on_constraint(
cascade->state = UPD_NODE_UPDATE_CLUSTERED; cascade->state = UPD_NODE_UPDATE_CLUSTERED;
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
#ifdef WITH_WSREP #ifdef WITH_WSREP
err = wsrep_append_foreign_key( err = wsrep_append_foreign_key(
thr_get_trx(thr), thr_get_trx(thr),
foreign, foreign,
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE); FALSE, FALSE);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"WSREP: foreign key append failed: %d\n", err); "WSREP: foreign key append failed: %d\n", err);
} else } else
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
if (foreign->foreign_table->n_foreign_key_checks_running == 0) { if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
fprintf(stderr, fprintf(stderr,
"InnoDB: error: table %s has the counter 0" "InnoDB: error: table %s has the counter 0"
......
...@@ -5182,6 +5182,7 @@ row_check_index_for_mysql( ...@@ -5182,6 +5182,7 @@ row_check_index_for_mysql(
dtuple_get_nth_field(prev_entry, i))) { dtuple_get_nth_field(prev_entry, i))) {
contains_null = TRUE; contains_null = TRUE;
break;
} }
} }
......
...@@ -1590,11 +1590,14 @@ lock_rec_other_has_expl_req( ...@@ -1590,11 +1590,14 @@ lock_rec_other_has_expl_req(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#ifdef WITH_WSREP #ifdef WITH_WSREP
static void static void
wsrep_kill_victim(trx_t *trx, lock_t *lock) { wsrep_kill_victim(trx_t *trx, lock_t *lock) {
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
int bf_this = wsrep_thd_is_brute_force(trx->mysql_thd); int bf_this = wsrep_thd_is_brute_force(trx->mysql_thd);
int bf_other = int bf_other = wsrep_thd_is_brute_force(lock->trx->mysql_thd);
wsrep_thd_is_brute_force(lock->trx->mysql_thd);
if ((bf_this && !bf_other) || if ((bf_this && !bf_other) ||
(bf_this && bf_other && wsrep_trx_order_before( (bf_this && bf_other && wsrep_trx_order_before(
trx->mysql_thd, lock->trx->mysql_thd))) { trx->mysql_thd, lock->trx->mysql_thd))) {
......
...@@ -1277,19 +1277,21 @@ row_ins_foreign_check_on_constraint( ...@@ -1277,19 +1277,21 @@ row_ins_foreign_check_on_constraint(
cascade->state = UPD_NODE_UPDATE_CLUSTERED; cascade->state = UPD_NODE_UPDATE_CLUSTERED;
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (err == DB_SUCCESS) { err = (dberr_t)wsrep_append_foreign_key(
err = (dberr_t)wsrep_append_foreign_key( thr_get_trx(thr),
thr_get_trx(thr),
foreign, foreign,
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE); FALSE, FALSE);
}
if (err != DB_SUCCESS) {
fprintf(stderr,
"WSREP: foreign key append failed: %d\n", err);
} else
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
if (foreign->foreign_table->n_foreign_key_checks_running == 0) { if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
fprintf(stderr, fprintf(stderr,
......
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