summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc29
-rw-r--r--sql/sql_plugin_services.ic3
-rw-r--r--sql/sys_vars.cc5
-rw-r--r--sql/transaction.cc4
-rw-r--r--sql/wsrep_applier.cc4
-rw-r--r--sql/wsrep_dummy.cc5
-rw-r--r--sql/wsrep_hton.cc1
-rw-r--r--sql/wsrep_mysqld.cc9
-rw-r--r--sql/wsrep_mysqld.h2
9 files changed, 52 insertions, 10 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index de456f703f1..e96ef669289 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1148,6 +1148,10 @@ static int prepare_or_error(handlerton *ht, THD *thd, bool all)
status_var_increment(thd->status_var.ha_prepare_count);
if (err)
{
+ WSREP_DEBUGX(2, "ha_commit_trans(): prepare failed, thd: %lu, applier: %d, "
+ "exec: %d, conf: %d, kill: %d, err: %d, hton: %d",
+ thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed, err, ht->db_type);
/* avoid sending error, if we're going to replay the transaction */
#ifdef WITH_WSREP
if (ht != wsrep_hton ||
@@ -1349,6 +1353,11 @@ int ha_commit_trans(THD *thd, bool all)
*/
if (is_real_trans)
thd->transaction.cleanup();
+
+ WSREP_DEBUGX(2, "ha_commit_trans(): no ha_info, thd: %lu, applier: %d, "
+ "exec: %d, conf: %d, kill: %d",
+ thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed);
DBUG_RETURN(0);
}
@@ -1366,6 +1375,10 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_PRINT("info", ("is_real_trans: %d rw_trans: %d rw_ha_count: %d",
is_real_trans, rw_trans, rw_ha_count));
+ WSREP_DEBUGX(3, "ha_commit_trans(): rw_trans: %d, ha_count: %d, thd: %lu, "
+ "applier: %d, exec: %d, conf: %d, kill: %d",
+ rw_trans, rw_ha_count, thd->thread_id, thd->wsrep_applier,
+ thd->wsrep_exec_mode, thd->wsrep_conflict_state, thd->killed);
if (rw_trans)
{
/*
@@ -1389,6 +1402,10 @@ int ha_commit_trans(THD *thd, bool all)
DEBUG_SYNC(thd, "ha_commit_trans_after_acquire_commit_lock");
}
+ else
+ {
+ WSREP_DEBUGX(2, "ha_commit_trans(): non rw_trans");
+ }
if (rw_trans &&
opt_readonly &&
@@ -1454,6 +1471,10 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_SUICIDE(););
error= commit_one_phase_2(thd, all, trans, is_real_trans) ? 2 : 0;
+ WSREP_DEBUGX(3, "ha_commit_trans(): commit_one_phase_2 returns %d, "
+ "thd: %lu, applier: %d, exec: %d, conf: %d, kill: %d",
+ error, thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed);
DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_SUICIDE(););
if (tc_log->unlog(cookie, xid))
@@ -1474,6 +1495,10 @@ done:
/* Come here if error and we need to rollback. */
err:
+ WSREP_DEBUGX(2, "ha_commit_trans(), returns with error, thd: %lu, "
+ "applier: %d, exec: %d, conf: %d, kill: %d",
+ thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed);
error= 1; /* Transaction was rolled back */
/*
In parallel replication, rollback is delayed, as there is extra replication
@@ -1557,6 +1582,10 @@ commit_one_phase_2(THD *thd, bool all, THD_TRANS *trans, bool is_real_trans)
{
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
error=1;
+ WSREP_DEBUGX(2, "commit_one_phase_2(): commit failed, thd: %lu, "
+ "applier: %d, exec: %d, conf: %d, kill: %d",
+ thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed);
}
/* Should this be done only if is_real_trans is set ? */
status_var_increment(thd->status_var.ha_commit_count);
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index c3dfde18ab6..5c9598472b0 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -138,7 +138,8 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_thd_ws_handle,
wsrep_trx_is_aborting,
wsrep_trx_order_before,
- wsrep_unlock_rollback
+ wsrep_unlock_rollback,
+ wsrep_thd_thread_id
};
static struct thd_specifics_service_st thd_specifics_handler=
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 306528c5c86..ea965d8ef9f 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -4779,9 +4779,10 @@ static Sys_var_charptr Sys_wsrep_dbug_option(
GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG),
IN_SYSTEM_CHARSET, DEFAULT(""));
-static Sys_var_mybool Sys_wsrep_debug(
+static Sys_var_int Sys_wsrep_debug(
"wsrep_debug", "To enable debug level logging",
- GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+ GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), VALID_RANGE(0,4), DEFAULT(0),
+ BLOCK_SIZE(1));
static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx(
"wsrep_convert_LOCK_to_trx", "To convert locking sessions "
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 8b188709ce6..0063a20ce52 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -224,6 +224,10 @@ bool trans_commit(THD *thd)
{
int res;
DBUG_ENTER("trans_commit");
+ WSREP_DEBUGX(3, "trans_commit(): thd: %lu, applier: %d, exec: %d, conf: %d, "
+ "kill: %d",
+ thd->thread_id, thd->wsrep_applier, thd->wsrep_exec_mode,
+ thd->wsrep_conflict_state, thd->killed);
if (trans_check(thd))
DBUG_RETURN(TRUE);
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 426789b4d38..728a47bde60 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -119,6 +119,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
}
typ= ev->get_type_code();
+ WSREP_DEBUGX(3, "wsrep_apply_events(): event type: %d", typ);
switch (typ) {
case FORMAT_DESCRIPTION_EVENT:
@@ -270,6 +271,7 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
{
wsrep_dump_rbr_buf_with_header(thd, buf, buf_len);
}
+ WSREP_DEBUGX(3, "wsrep_apply_cb(): rcode: %d, WS buf: %lu", rcode, buf_len);
TABLE *tmp;
while ((tmp = thd->temporary_tables))
@@ -296,7 +298,7 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd)
wsrep_cb_status_t const rcode(trans_commit(thd) ?
WSREP_CB_FAILURE : WSREP_CB_SUCCESS);
-
+ WSREP_DEBUGX(3, "wsrep_commit(): trans_commit returned with %d", rcode);
if (WSREP_CB_SUCCESS == rcode)
{
thd->wsrep_rgi->cleanup_context(thd, false);
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 0aa7f9b0aad..468bdd53785 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -38,7 +38,7 @@ struct wsrep *get_wsrep()
my_bool get_wsrep_certify_nonPK()
{ return 0; }
-my_bool get_wsrep_debug()
+int get_wsrep_debug()
{ return 0; }
my_bool get_wsrep_drupal_282555_workaround()
@@ -130,3 +130,6 @@ int wsrep_trx_is_aborting(THD *)
void wsrep_unlock_rollback()
{ }
+
+ulong wsrep_thd_thread_id(THD *)
+{ return 0; }
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 6e0fc11bfda..1b8853e996e 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -133,7 +133,6 @@ void wsrep_post_commit(THD* thd, bool all)
/*
Non-InnoDB statements may have populated events in stmt cache => cleanup
*/
- WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s", thd->query());
wsrep_cleanup_transaction(thd);
break;
}
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 776bf4a3ab2..4ca17ea2036 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -64,7 +64,7 @@ const char* wsrep_dbug_option = "";
long wsrep_slave_threads = 1; // # of slave action appliers wanted
int wsrep_slave_count_change = 0; // # of appliers to stop or start
-my_bool wsrep_debug = 0; // enable debug level logging
+int wsrep_debug = 0; // enable debug level logging
my_bool wsrep_convert_LOCK_to_trx = 1; // convert locking sessions to trx
ulong wsrep_retry_autocommit = 5; // retry aborted autocommit trx
my_bool wsrep_auto_increment_control = 1; // control auto increment variables
@@ -2328,6 +2328,11 @@ extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd)
return thd->wsrep_rand;
}
+extern "C" ulong wsrep_thd_thread_id(THD *thd)
+{
+ return (ulong) (thd) ? thd->thread_id : 0;
+}
+
longlong wsrep_thd_trx_seqno(THD *thd)
{
return (thd) ? thd->wsrep_trx_meta.gtid.seqno : WSREP_SEQNO_UNDEFINED;
@@ -2555,7 +2560,7 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
/***** callbacks for wsrep service ************/
-my_bool get_wsrep_debug()
+int get_wsrep_debug()
{
return wsrep_debug;
}
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 04ccc1a7e45..26c436d0a6e 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -143,8 +143,6 @@ extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode);
extern "C" void wsrep_thd_set_query_state(
THD *thd, enum wsrep_query_state state);
-extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id);
-
extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd);
extern "C" time_t wsrep_thd_query_start(THD *thd);
extern "C" query_id_t wsrep_thd_query_id(THD *thd);