From 6422d276fa8d1217aa68be1d90c712efa4d71409 Mon Sep 17 00:00:00 2001 From: Seppo Jaakola Date: Tue, 26 Nov 2013 22:09:14 +0200 Subject: bzr merge -r3895..3903 lp:codership-mysql/5.5 This is just before 5.5.34 merge in wsrep-5.5 branch --- sql/wsrep_thd.cc | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'sql/wsrep_thd.cc') diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 35f5a9bca6a..c25281b7a77 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -93,8 +93,6 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) thd->net.vio= 0; thd->clear_error(); - thd->variables.option_bits|= OPTION_NOT_AUTOCOMMIT; - shadow->tx_isolation = thd->variables.tx_isolation; thd->variables.tx_isolation = ISO_READ_COMMITTED; thd->tx_isolation = ISO_READ_COMMITTED; @@ -140,6 +138,11 @@ void wsrep_replay_transaction(THD *thd) (long long)wsrep_thd_trx_seqno(thd)); struct wsrep_thd_shadow shadow; wsrep_prepare_bf_thd(thd, &shadow); + + /* From trans_begin() */ + thd->variables.option_bits|= OPTION_BEGIN; + thd->server_status|= SERVER_STATUS_IN_TRANS; + int rcode = wsrep->replay_trx(wsrep, &thd->wsrep_ws_handle, (void *)thd); @@ -161,6 +164,14 @@ void wsrep_replay_transaction(THD *thd) { WSREP_WARN("replay ok, thd has reported status"); } + else if (thd->get_stmt_da()->is_set()) + { + if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK) + { + WSREP_WARN("replay ok, thd has error status %d", + thd->get_stmt_da()->status()); + } + } else { my_ok(thd); @@ -186,6 +197,9 @@ void wsrep_replay_transaction(THD *thd) unireg_abort(1); break; } + + wsrep_cleanup_transaction(thd); + mysql_mutex_lock(&LOCK_wsrep_replaying); wsrep_replaying--; WSREP_DEBUG("replaying decreased: %d, thd: %lu", @@ -204,6 +218,10 @@ static void wsrep_replication_process(THD *thd) struct wsrep_thd_shadow shadow; wsrep_prepare_bf_thd(thd, &shadow); + /* From trans_begin() */ + thd->variables.option_bits|= OPTION_BEGIN; + thd->server_status|= SERVER_STATUS_IN_TRANS; + rcode = wsrep->recv(wsrep, (void *)thd); DBUG_PRINT("wsrep",("wsrep_repl returned: %d", rcode)); @@ -371,21 +389,24 @@ void wsrep_create_rollbacker() extern "C" int wsrep_thd_is_brute_force(void *thd_ptr) { + /* + Brute force: + Appliers and replaying are running in REPL_RECV mode. TOI statements + in TOTAL_ORDER mode. Locally committing transaction that has got + past wsrep->pre_commit() without error is running in LOCAL_COMMIT mode. + + Everything else is running in LOCAL_STATE and should not be considered + brute force. + */ if (thd_ptr) { switch (((THD *)thd_ptr)->wsrep_exec_mode) { - case LOCAL_STATE: - { - if (((THD *)thd_ptr)->wsrep_conflict_state== REPLAYING) - { - return 1; - } - return 0; - } + case LOCAL_STATE: return 0; case REPL_RECV: return 1; case TOTAL_ORDER: return 2; case LOCAL_COMMIT: return 3; } } + DBUG_ASSERT(0); return 0; } -- cgit v1.2.1