Commit 415823a4 authored by sjaakola's avatar sjaakola Committed by Nirbhay Choubey

Refs: MW-279

- fixes in innodb to skip wsrep processing (like kill victim) when running in native mysql mode
- similar fixes in mysql server side
- forcing tc_log_dummy in native mysql mode when no binlog used. wsrep hton messes up handler counter
  and used to lead in using tc_log_mmap instead. Bad news is that tc_log_mmap does not seem to work at all
parent fec296cc
......@@ -5288,8 +5288,15 @@ static int init_server_components()
tc_log= get_tc_log_implementation();
#ifdef WITH_WSREP
if (WSREP_ON && tc_log == &tc_log_mmap)
tc_log= &tc_log_dummy;
if (tc_log == &tc_log_mmap)
{
/*
wsrep hton raises total_ha_2pc count to 2, even in native mysql mode.
Have to force using tc_log_dummy here, as tc_log_mmap segfaults.
*/
if (WSREP_ON || total_ha_2pc <= 2)
tc_log= &tc_log_dummy;
}
WSREP_DEBUG("Initial TC log open: %s",
(tc_log == &mysql_bin_log) ? "binlog" :
......
......@@ -37,6 +37,8 @@ enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, handlerton *hton,
*/
void wsrep_cleanup_transaction(THD *thd)
{
if (!WSREP(thd)) return;
if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd);
thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
......@@ -112,13 +114,7 @@ void wsrep_register_hton(THD* thd, bool all)
*/
void wsrep_post_commit(THD* thd, bool all)
{
/*
TODO: It can perhaps be fixed in a more elegant fashion by turning off
wsrep_emulate_binlog if wsrep_on=0 on server start.
https://github.com/codership/mysql-wsrep/issues/112
*/
if (!WSREP_ON)
return;
if (!WSREP(thd)) return;
switch (thd->wsrep_exec_mode)
{
......
......@@ -1685,6 +1685,10 @@ wsrep_kill_victim(
{
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
if (!wsrep_on(trx->mysql_thd)) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
......@@ -1771,9 +1775,11 @@ lock_rec_other_has_conflicting(
#ifdef WITH_WSREP
if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) {
trx_mutex_enter(lock->trx);
wsrep_kill_victim(trx, lock);
trx_mutex_exit(lock->trx);
if (wsrep_on(trx->mysql_thd)) {
trx_mutex_enter(lock->trx);
wsrep_kill_victim(trx, lock);
trx_mutex_exit(lock->trx);
}
#else
if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) {
#endif /* WITH_WSREP */
......@@ -2067,7 +2073,9 @@ lock_rec_create(
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (c_lock &&
wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
......@@ -4630,10 +4638,10 @@ lock_table_create(
trx_mutex_exit(c_lock->trx);
}
} else {
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
}
#else
#endif /* WITH_WSREP */
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) {
......
......@@ -1695,6 +1695,10 @@ wsrep_kill_victim(
{
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
if (!wsrep_on(trx->mysql_thd)) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
......@@ -1781,9 +1785,11 @@ lock_rec_other_has_conflicting(
#ifdef WITH_WSREP
if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) {
trx_mutex_enter(lock->trx);
wsrep_kill_victim((trx_t *)trx, (lock_t *)lock);
trx_mutex_exit(lock->trx);
if (wsrep_on(trx->mysql_thd)) {
trx_mutex_enter(lock->trx);
wsrep_kill_victim(trx, lock);
trx_mutex_exit(lock->trx);
}
#else
if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) {
#endif /* WITH_WSREP */
......@@ -2089,7 +2095,9 @@ lock_rec_create(
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (c_lock &&
wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
......@@ -4667,10 +4675,10 @@ lock_table_create(
trx_mutex_exit(c_lock->trx);
}
} else {
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
}
#else
#endif /* WITH_WSREP */
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) {
......
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