summaryrefslogtreecommitdiff
path: root/sql/wsrep_thd.cc
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2013-11-26 22:09:14 +0200
committerSeppo Jaakola <seppo.jaakola@codership.com>2013-11-26 22:09:14 +0200
commit6422d276fa8d1217aa68be1d90c712efa4d71409 (patch)
tree67bc00215ac0bea9b6c14e51a0018a9d7f0cd886 /sql/wsrep_thd.cc
parent4a11e84414292e852a0968ef871dc90cbd24ae30 (diff)
downloadmariadb-git-6422d276fa8d1217aa68be1d90c712efa4d71409.tar.gz
bzr merge -r3895..3903 lp:codership-mysql/5.5
This is just before 5.5.34 merge in wsrep-5.5 branch
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r--sql/wsrep_thd.cc41
1 files changed, 31 insertions, 10 deletions
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;
}