Commit b3093073 authored by Monty's avatar Monty

Changed my_thread_id to int64 to fix compilation problem with

my_atomic_add32_explicit on windows
Fixed that server_audit.c also works if one compiles with safemalloc
Fixed compiler warnings
parent 1ab711be
...@@ -672,7 +672,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr; ...@@ -672,7 +672,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
#define ESRCH 1 #define ESRCH 1
#endif #endif
typedef ulong my_thread_id; typedef int64 my_thread_id;
extern void my_threadattr_global_init(void); extern void my_threadattr_global_init(void);
extern my_bool my_thread_global_init(void); extern my_bool my_thread_global_init(void);
......
...@@ -97,7 +97,11 @@ static void closelog() {} ...@@ -97,7 +97,11 @@ static void closelog() {}
#define FLOGGER_NO_PSI #define FLOGGER_NO_PSI
/* How to access the pthread_mutex in mysql_mutex_t */ /* How to access the pthread_mutex in mysql_mutex_t */
#ifdef SAFE_MUTEX
#define mysql_mutex_real_mutex(A) &(A)->m_mutex.mutex
#else
#define mysql_mutex_real_mutex(A) &(A)->m_mutex #define mysql_mutex_real_mutex(A) &(A)->m_mutex
#endif
#define flogger_mutex_init(A,B,C) do{}while(0) #define flogger_mutex_init(A,B,C) do{}while(0)
#define flogger_mutex_destroy(A) do{}while(0) #define flogger_mutex_destroy(A) do{}while(0)
......
...@@ -49,15 +49,18 @@ static int validate(MYSQL_LEX_STRING *username, MYSQL_LEX_STRING *password) ...@@ -49,15 +49,18 @@ static int validate(MYSQL_LEX_STRING *username, MYSQL_LEX_STRING *password)
others < min_others; others < min_others;
} }
static void fix_min_length(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var *var, static void
void *var_ptr, const void *save) fix_min_length(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr, const void *save)
{ {
*((unsigned int *)var_ptr)= *((unsigned int *)save); *((unsigned int *)var_ptr)= *((unsigned int *)save);
if (min_length < min_digits + 2 * min_letters + min_others) if (min_length < min_digits + 2 * min_letters + min_others)
min_length= min_digits + 2 * min_letters + min_others; min_length= min_digits + 2 * min_letters + min_others;
} }
static MYSQL_SYSVAR_UINT(minimal_length, min_length, PLUGIN_VAR_RQCMDARG, static MYSQL_SYSVAR_UINT(minimal_length, min_length, PLUGIN_VAR_RQCMDARG,
"Minimal required password length", NULL, fix_min_length, 8, 0, 1000, 1); "Minimal required password length", NULL, fix_min_length, 8, 0, 1000, 1);
......
...@@ -1674,14 +1674,14 @@ static int binlog_close_connection(handlerton *hton, THD *thd) ...@@ -1674,14 +1674,14 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
uchar *buf; uchar *buf;
size_t len=0; size_t len=0;
wsrep_write_cache_buf(cache, &buf, &len); wsrep_write_cache_buf(cache, &buf, &len);
WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lu", WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lld",
len, thd->thread_id); len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
cache = cache_mngr->get_binlog_cache_log(false); cache = cache_mngr->get_binlog_cache_log(false);
wsrep_write_cache_buf(cache, &buf, &len); wsrep_write_cache_buf(cache, &buf, &len);
WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lu", WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lld",
len, thd->thread_id); len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
...@@ -10179,7 +10179,8 @@ IO_CACHE * get_trans_log(THD * thd) ...@@ -10179,7 +10179,8 @@ IO_CACHE * get_trans_log(THD * thd)
if (cache_mngr) if (cache_mngr)
return cache_mngr->get_binlog_cache_log(true); return cache_mngr->get_binlog_cache_log(true);
WSREP_DEBUG("binlog cache not initialized, conn :%ld", thd->thread_id); WSREP_DEBUG("binlog cache not initialized, conn: %lld",
(longlong) thd->thread_id);
return NULL; return NULL;
} }
...@@ -10217,7 +10218,8 @@ void thd_binlog_trx_reset(THD * thd) ...@@ -10217,7 +10218,8 @@ void thd_binlog_trx_reset(THD * thd)
void thd_binlog_rollback_stmt(THD * thd) void thd_binlog_rollback_stmt(THD * thd)
{ {
WSREP_DEBUG("thd_binlog_rollback_stmt :%ld", thd->thread_id); WSREP_DEBUG("thd_binlog_rollback_stmt connection: %lld",
(longlong) thd->thread_id);
binlog_cache_mngr *const cache_mngr= binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
if (cache_mngr) if (cache_mngr)
......
...@@ -707,7 +707,7 @@ inline query_id_t get_query_id() ...@@ -707,7 +707,7 @@ inline query_id_t get_query_id()
/* increment global_thread_id and return it. */ /* increment global_thread_id and return it. */
inline __attribute__((warn_unused_result)) my_thread_id next_thread_id() inline __attribute__((warn_unused_result)) my_thread_id next_thread_id()
{ {
return my_atomic_add32_explicit(&global_thread_id, 1, MY_MEMORY_ORDER_RELAXED); return my_atomic_add64_explicit(&global_thread_id, 1, MY_MEMORY_ORDER_RELAXED);
} }
#if defined(MYSQL_DYNAMIC_PLUGIN) && defined(_WIN32) #if defined(MYSQL_DYNAMIC_PLUGIN) && defined(_WIN32)
......
...@@ -1139,8 +1139,8 @@ void end_connection(THD *thd) ...@@ -1139,8 +1139,8 @@ void end_connection(THD *thd)
{ {
wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id); wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id);
if (rcode) { if (rcode) {
WSREP_WARN("wsrep failed to free connection context: %lu, code: %d", WSREP_WARN("wsrep failed to free connection context: %lld code: %d",
thd->thread_id, rcode); (longlong) thd->thread_id, rcode);
} }
} }
thd->wsrep_client_thread= 0; thd->wsrep_client_thread= 0;
......
...@@ -4343,8 +4343,9 @@ bool select_create::send_eof() ...@@ -4343,8 +4343,9 @@ bool select_create::send_eof()
mysql_mutex_lock(&thd->LOCK_wsrep_thd); mysql_mutex_lock(&thd->LOCK_wsrep_thd);
if (thd->wsrep_conflict_state != NO_CONFLICT) if (thd->wsrep_conflict_state != NO_CONFLICT)
{ {
WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", WSREP_DEBUG("select_create commit failed, thd: %lld err: %d %s",
thd->thread_id, thd->wsrep_conflict_state, thd->query()); (longlong) thd->thread_id, thd->wsrep_conflict_state,
thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd); mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
abort_result_set(); abort_result_set();
DBUG_RETURN(true); DBUG_RETURN(true);
......
...@@ -2830,7 +2830,8 @@ mysql_execute_command(THD *thd) ...@@ -2830,7 +2830,8 @@ mysql_execute_command(THD *thd)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
if (commit_failed) if (commit_failed)
{ {
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("implicit commit failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
} }
...@@ -4969,7 +4970,8 @@ mysql_execute_command(THD *thd) ...@@ -4969,7 +4970,8 @@ mysql_execute_command(THD *thd)
if (trans_begin(thd, lex->start_transaction_opt)) if (trans_begin(thd, lex->start_transaction_opt))
{ {
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("BEGIN failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
my_ok(thd); my_ok(thd);
...@@ -4988,7 +4990,8 @@ mysql_execute_command(THD *thd) ...@@ -4988,7 +4990,8 @@ mysql_execute_command(THD *thd)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
if (commit_failed) if (commit_failed)
{ {
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("COMMIT failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
/* Begin transaction with the same isolation level. */ /* Begin transaction with the same isolation level. */
...@@ -5035,7 +5038,8 @@ mysql_execute_command(THD *thd) ...@@ -5035,7 +5038,8 @@ mysql_execute_command(THD *thd)
if (rollback_failed) if (rollback_failed)
{ {
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("rollback failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
/* Begin transaction with the same isolation level. */ /* Begin transaction with the same isolation level. */
...@@ -5549,7 +5553,8 @@ mysql_execute_command(THD *thd) ...@@ -5549,7 +5553,8 @@ mysql_execute_command(THD *thd)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
if (commit_failed) if (commit_failed)
{ {
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("XA commit failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
/* /*
...@@ -5567,7 +5572,8 @@ mysql_execute_command(THD *thd) ...@@ -5567,7 +5572,8 @@ mysql_execute_command(THD *thd)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
if (rollback_failed) if (rollback_failed)
{ {
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id); WSREP_DEBUG("XA rollback failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error; goto error;
} }
/* /*
...@@ -5798,8 +5804,8 @@ mysql_execute_command(THD *thd) ...@@ -5798,8 +5804,8 @@ mysql_execute_command(THD *thd)
! thd->in_active_multi_stmt_transaction() && ! thd->in_active_multi_stmt_transaction() &&
thd->mdl_context.has_transactional_locks()) thd->mdl_context.has_transactional_locks())
{ {
WSREP_DEBUG("Forcing release of transactional locks for thd %lu", WSREP_DEBUG("Forcing release of transactional locks for thd: %lld",
thd->thread_id); (longlong) thd->thread_id);
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
...@@ -7165,10 +7171,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -7165,10 +7171,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
} }
else else
{ {
WSREP_DEBUG("%s, thd: %lu is_AC: %d, retry: %lu - %lu SQL: %s", WSREP_DEBUG("%s, thd: %lld is_AC: %d, retry: %lu - %lu SQL: %s",
(thd->wsrep_conflict_state == ABORTED) ? (thd->wsrep_conflict_state == ABORTED) ?
"BF Aborted" : "cert failure", "BF Aborted" : "cert failure",
thd->thread_id, is_autocommit, thd->wsrep_retry_counter, (longlong) thd->thread_id, is_autocommit,
thd->wsrep_retry_counter,
thd->variables.wsrep_retry_autocommit, thd->query()); thd->variables.wsrep_retry_autocommit, thd->query());
my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction");
thd->killed= NOT_KILLED; thd->killed= NOT_KILLED;
......
...@@ -3893,8 +3893,9 @@ Prepared_statement::execute_loop(String *expanded_query, ...@@ -3893,8 +3893,9 @@ Prepared_statement::execute_loop(String *expanded_query,
switch (thd->wsrep_conflict_state) switch (thd->wsrep_conflict_state)
{ {
case CERT_FAILURE: case CERT_FAILURE:
WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %ld err: %d", WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d",
thd->thread_id, thd->get_stmt_da()->sql_errno() ); (longlong) thd->thread_id,
thd->get_stmt_da()->sql_errno() );
thd->wsrep_conflict_state = NO_CONFLICT; thd->wsrep_conflict_state = NO_CONFLICT;
break; break;
......
...@@ -3525,7 +3525,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type) ...@@ -3525,7 +3525,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
{ {
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT; thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id); WSREP_DEBUG("autocommit, MDL TRX lock released: %lld",
(longlong) thd->thread_id);
return true; return true;
} }
/* /*
......
...@@ -269,8 +269,8 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx, ...@@ -269,8 +269,8 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
TABLE *tmp; TABLE *tmp;
while ((tmp = thd->temporary_tables)) while ((tmp = thd->temporary_tables))
{ {
WSREP_DEBUG("Applier %lu, has temporary tables: %s.%s", WSREP_DEBUG("Applier %lld, has temporary tables: %s.%s",
thd->thread_id, (longlong) thd->thread_id,
(tmp->s) ? tmp->s->db.str : "void", (tmp->s) ? tmp->s->db.str : "void",
(tmp->s) ? tmp->s->table_name.str : "void"); (tmp->s) ? tmp->s->table_name.str : "void");
close_temporary_table(thd, tmp, 1, 1); close_temporary_table(thd, tmp, 1, 1);
......
...@@ -319,9 +319,9 @@ int wsrep_write_cache(wsrep_t* const wsrep, ...@@ -319,9 +319,9 @@ int wsrep_write_cache(wsrep_t* const wsrep,
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len)
{ {
char filename[PATH_MAX]= {0}; char filename[PATH_MAX]= {0};
int len= snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld.log", int len= snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld.log",
wsrep_data_home_dir, thd->thread_id, wsrep_data_home_dir, (longlong) thd->thread_id,
(long long)wsrep_thd_trx_seqno(thd)); (longlong) wsrep_thd_trx_seqno(thd));
if (len >= PATH_MAX) if (len >= PATH_MAX)
{ {
WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len); WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len);
...@@ -374,9 +374,9 @@ int wsrep_binlog_savepoint_rollback(THD *thd, void *sv) ...@@ -374,9 +374,9 @@ int wsrep_binlog_savepoint_rollback(THD *thd, void *sv)
void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache) void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache)
{ {
char filename[PATH_MAX]= {0}; char filename[PATH_MAX]= {0};
int len= snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld.log", int len= snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld.log",
wsrep_data_home_dir, thd->thread_id, wsrep_data_home_dir, (longlong) thd->thread_id,
(long long)wsrep_thd_trx_seqno(thd)); (longlong) wsrep_thd_trx_seqno(thd));
size_t bytes_in_cache = 0; size_t bytes_in_cache = 0;
// check path // check path
if (len >= PATH_MAX) if (len >= PATH_MAX)
...@@ -448,8 +448,8 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, ...@@ -448,8 +448,8 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
Log_event_writer writer(&cache); Log_event_writer writer(&cache);
Format_description_log_event *ev= wsrep_get_apply_format(thd); Format_description_log_event *ev= wsrep_get_apply_format(thd);
int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld_v2.log", int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld_v2.log",
wsrep_data_home_dir, thd->thread_id, wsrep_data_home_dir, (longlong) thd->thread_id,
(long long) wsrep_thd_trx_seqno(thd)); (long long) wsrep_thd_trx_seqno(thd));
if (len >= PATH_MAX) if (len >= PATH_MAX)
......
...@@ -383,9 +383,9 @@ wsrep_run_wsrep_commit(THD *thd, bool all) ...@@ -383,9 +383,9 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
&wtime); &wtime);
if (replay_round++ % 100000 == 0) if (replay_round++ % 100000 == 0)
WSREP_DEBUG("commit waiting for replaying: replayers %d, thd: (%lu) " WSREP_DEBUG("commit waiting for replaying: replayers %d, thd: %lld "
"conflict: %d (round: %d)", "conflict: %d (round: %d)",
wsrep_replaying, thd->thread_id, wsrep_replaying, (longlong) thd->thread_id,
thd->wsrep_conflict_state, replay_round); thd->wsrep_conflict_state, replay_round);
mysql_mutex_unlock(&LOCK_wsrep_replaying); mysql_mutex_unlock(&LOCK_wsrep_replaying);
...@@ -449,11 +449,11 @@ wsrep_run_wsrep_commit(THD *thd, bool all) ...@@ -449,11 +449,11 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id) if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id)
{ {
WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %zu\n" WSREP_WARN("SQL statement was ineffective thd: %lld buf: %zu\n"
"schema: %s \n" "schema: %s \n"
"QUERY: %s\n" "QUERY: %s\n"
" => Skipping replication", " => Skipping replication",
thd->thread_id, data_len, (longlong) thd->thread_id, data_len,
(thd->db ? thd->db : "(null)"), thd->query()); (thd->db ? thd->db : "(null)"), thd->query());
rcode = WSREP_TRX_FAIL; rcode = WSREP_TRX_FAIL;
} }
...@@ -469,20 +469,22 @@ wsrep_run_wsrep_commit(THD *thd, bool all) ...@@ -469,20 +469,22 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
&thd->wsrep_trx_meta); &thd->wsrep_trx_meta);
if (rcode == WSREP_TRX_MISSING) { if (rcode == WSREP_TRX_MISSING) {
WSREP_WARN("Transaction missing in provider, thd: %ld, schema: %s, SQL: %s", WSREP_WARN("Transaction missing in provider, thd: %lld schema: %s SQL: %s",
thd->thread_id, (thd->db ? thd->db : "(null)"), thd->query()); (longlong) thd->thread_id,
(thd->db ? thd->db : "(null)"), thd->query());
rcode = WSREP_TRX_FAIL; rcode = WSREP_TRX_FAIL;
} else if (rcode == WSREP_BF_ABORT) { } else if (rcode == WSREP_BF_ABORT) {
WSREP_DEBUG("thd %lu seqno %lld BF aborted by provider, will replay", WSREP_DEBUG("thd: %lld seqno: %lld BF aborted by provider, will replay",
thd->thread_id, (long long)thd->wsrep_trx_meta.gtid.seqno); (longlong) thd->thread_id,
(longlong) thd->wsrep_trx_meta.gtid.seqno);
mysql_mutex_lock(&thd->LOCK_wsrep_thd); mysql_mutex_lock(&thd->LOCK_wsrep_thd);
thd->wsrep_conflict_state = MUST_REPLAY; thd->wsrep_conflict_state = MUST_REPLAY;
DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0); DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0);
mysql_mutex_unlock(&thd->LOCK_wsrep_thd); mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&LOCK_wsrep_replaying); mysql_mutex_lock(&LOCK_wsrep_replaying);
wsrep_replaying++; wsrep_replaying++;
WSREP_DEBUG("replaying increased: %d, thd: %lu", WSREP_DEBUG("replaying increased: %d, thd: %lld",
wsrep_replaying, thd->thread_id); wsrep_replaying, (longlong) thd->thread_id);
mysql_mutex_unlock(&LOCK_wsrep_replaying); mysql_mutex_unlock(&LOCK_wsrep_replaying);
} }
} else { } else {
...@@ -506,9 +508,9 @@ wsrep_run_wsrep_commit(THD *thd, bool all) ...@@ -506,9 +508,9 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
if (thd->wsrep_conflict_state != NO_CONFLICT) if (thd->wsrep_conflict_state != NO_CONFLICT)
{ {
WSREP_WARN("thd %lu seqno %lld: conflict state %d after post commit", WSREP_WARN("thd: %llu seqno: %lld conflict state %d after post commit",
thd->thread_id, (longlong) thd->thread_id,
(long long)thd->wsrep_trx_meta.gtid.seqno, (longlong) thd->wsrep_trx_meta.gtid.seqno,
thd->wsrep_conflict_state); thd->wsrep_conflict_state);
} }
thd->wsrep_exec_mode= LOCAL_COMMIT; thd->wsrep_exec_mode= LOCAL_COMMIT;
......
...@@ -1553,8 +1553,8 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ...@@ -1553,8 +1553,8 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (thd->wsrep_conflict_state == MUST_ABORT) if (thd->wsrep_conflict_state == MUST_ABORT)
{ {
WSREP_INFO("thread: %lu, schema: %s, query: %s has been aborted due to multi-master conflict", WSREP_INFO("thread: %lld schema: %s query: %s has been aborted due to multi-master conflict",
thd->thread_id, (longlong) thd->thread_id,
(thd->db ? thd->db : "(null)"), (thd->db ? thd->db : "(null)"),
thd->query()); thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd); mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
...@@ -1567,15 +1567,15 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ...@@ -1567,15 +1567,15 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (thd->global_read_lock.can_acquire_protection()) if (thd->global_read_lock.can_acquire_protection())
{ {
WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %lu", WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %lld",
thd->query(), thd->thread_id); thd->query(), (longlong) thd->thread_id);
return -1; return -1;
} }
if (wsrep_debug && thd->mdl_context.has_locks()) if (wsrep_debug && thd->mdl_context.has_locks())
{ {
WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu", WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lld",
thd->query(), thd->thread_id); thd->query(), (longlong) thd->thread_id);
} }
/* /*
...@@ -1638,13 +1638,13 @@ void wsrep_to_isolation_end(THD *thd) ...@@ -1638,13 +1638,13 @@ void wsrep_to_isolation_end(THD *thd)
WSREP_##severity( \ WSREP_##severity( \
"%s\n" \ "%s\n" \
"schema: %.*s\n" \ "schema: %.*s\n" \
"request: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \ "request: (%lld \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \
"granted: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \ "granted: (%lld \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \
msg, schema_len, schema, \ msg, schema_len, schema, \
req->thread_id, (long long)wsrep_thd_trx_seqno(req), \ (longlong) req->thread_id, (long long)wsrep_thd_trx_seqno(req), \
req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \ req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \
req->get_command(), req->lex->sql_command, req->query(), \ req->get_command(), req->lex->sql_command, req->query(), \
gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \ (longlong) gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \
gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \ gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \
gra->get_command(), gra->lex->sql_command, gra->query()); gra->get_command(), gra->lex->sql_command, gra->query());
...@@ -1922,8 +1922,8 @@ static bool have_client_connections() ...@@ -1922,8 +1922,8 @@ static bool have_client_connections()
I_List_iterator<THD> it(threads); I_List_iterator<THD> it(threads);
while ((tmp=it++)) while ((tmp=it++))
{ {
DBUG_PRINT("quit",("Informing thread %ld that it's time to die", DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
tmp->thread_id)); (longlong) tmp->thread_id));
if (is_client_connection(tmp) && tmp->killed == KILL_CONNECTION) if (is_client_connection(tmp) && tmp->killed == KILL_CONNECTION)
{ {
(void)abort_replicated(tmp); (void)abort_replicated(tmp);
...@@ -2007,8 +2007,8 @@ void wsrep_close_client_connections(my_bool wait_to_end) ...@@ -2007,8 +2007,8 @@ void wsrep_close_client_connections(my_bool wait_to_end)
I_List_iterator<THD> it(threads); I_List_iterator<THD> it(threads);
while ((tmp=it++)) while ((tmp=it++))
{ {
DBUG_PRINT("quit",("Informing thread %ld that it's time to die", DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
tmp->thread_id)); (longlong) tmp->thread_id));
/* We skip slave threads & scheduler on this first loop through. */ /* We skip slave threads & scheduler on this first loop through. */
if (!is_client_connection(tmp)) if (!is_client_connection(tmp))
continue; continue;
...@@ -2023,7 +2023,7 @@ void wsrep_close_client_connections(my_bool wait_to_end) ...@@ -2023,7 +2023,7 @@ void wsrep_close_client_connections(my_bool wait_to_end)
if (abort_replicated(tmp)) if (abort_replicated(tmp))
continue; continue;
WSREP_DEBUG("closing connection %ld", tmp->thread_id); WSREP_DEBUG("closing connection %lld", (longlong) tmp->thread_id);
wsrep_close_thread(tmp); wsrep_close_thread(tmp);
} }
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
...@@ -2044,7 +2044,7 @@ void wsrep_close_client_connections(my_bool wait_to_end) ...@@ -2044,7 +2044,7 @@ void wsrep_close_client_connections(my_bool wait_to_end)
!abort_replicated(tmp) && !abort_replicated(tmp) &&
!is_replaying_connection(tmp)) !is_replaying_connection(tmp))
{ {
WSREP_INFO("killing local connection: %ld",tmp->thread_id); WSREP_INFO("killing local connection: %lld", (longlong) tmp->thread_id);
close_connection(tmp,0); close_connection(tmp,0);
} }
#endif #endif
...@@ -2069,7 +2069,7 @@ void wsrep_close_client_connections(my_bool wait_to_end) ...@@ -2069,7 +2069,7 @@ void wsrep_close_client_connections(my_bool wait_to_end)
void wsrep_close_applier(THD *thd) void wsrep_close_applier(THD *thd)
{ {
WSREP_DEBUG("closing applier %ld", thd->thread_id); WSREP_DEBUG("closing applier %lld", (longlong) thd->thread_id);
wsrep_close_thread(thd); wsrep_close_thread(thd);
} }
...@@ -2082,12 +2082,12 @@ void wsrep_close_threads(THD *thd) ...@@ -2082,12 +2082,12 @@ void wsrep_close_threads(THD *thd)
I_List_iterator<THD> it(threads); I_List_iterator<THD> it(threads);
while ((tmp=it++)) while ((tmp=it++))
{ {
DBUG_PRINT("quit",("Informing thread %ld that it's time to die", DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
tmp->thread_id)); (longlong) tmp->thread_id));
/* We skip slave threads & scheduler on this first loop through. */ /* We skip slave threads & scheduler on this first loop through. */
if (tmp->wsrep_applier && tmp != thd) if (tmp->wsrep_applier && tmp != thd)
{ {
WSREP_DEBUG("closing wsrep thread %ld", tmp->thread_id); WSREP_DEBUG("closing wsrep thread %lld", (longlong) tmp->thread_id);
wsrep_close_thread (tmp); wsrep_close_thread (tmp);
} }
} }
......
...@@ -50,8 +50,8 @@ int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff, ...@@ -50,8 +50,8 @@ int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff,
/* must have (&thd->LOCK_wsrep_thd) */ /* must have (&thd->LOCK_wsrep_thd) */
void wsrep_client_rollback(THD *thd) void wsrep_client_rollback(THD *thd)
{ {
WSREP_DEBUG("client rollback due to BF abort for (%ld), query: %s", WSREP_DEBUG("client rollback due to BF abort for (%lld), query: %s",
thd->thread_id, thd->query()); (longlong) thd->thread_id, thd->query());
WSREP_ATOMIC_ADD_LONG(&wsrep_bf_aborts_counter, 1); WSREP_ATOMIC_ADD_LONG(&wsrep_bf_aborts_counter, 1);
...@@ -61,14 +61,16 @@ void wsrep_client_rollback(THD *thd) ...@@ -61,14 +61,16 @@ void wsrep_client_rollback(THD *thd)
if (thd->locked_tables_mode && thd->lock) if (thd->locked_tables_mode && thd->lock)
{ {
WSREP_DEBUG("unlocking tables for BF abort (%ld)", thd->thread_id); WSREP_DEBUG("unlocking tables for BF abort (%lld)",
(longlong) thd->thread_id);
thd->locked_tables_list.unlock_locked_tables(thd); thd->locked_tables_list.unlock_locked_tables(thd);
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
} }
if (thd->global_read_lock.is_acquired()) if (thd->global_read_lock.is_acquired())
{ {
WSREP_DEBUG("unlocking GRL for BF abort (%ld)", thd->thread_id); WSREP_DEBUG("unlocking GRL for BF abort (%lld)",
(longlong) thd->thread_id);
thd->global_read_lock.unlock_global_read_lock(thd); thd->global_read_lock.unlock_global_read_lock(thd);
} }
...@@ -80,7 +82,8 @@ void wsrep_client_rollback(THD *thd) ...@@ -80,7 +82,8 @@ void wsrep_client_rollback(THD *thd)
if (thd->get_binlog_table_maps()) if (thd->get_binlog_table_maps())
{ {
WSREP_DEBUG("clearing binlog table map for BF abort (%ld)", thd->thread_id); WSREP_DEBUG("clearing binlog table map for BF abort (%lld)",
(longlong) thd->thread_id);
thd->clear_binlog_table_maps(); thd->clear_binlog_table_maps();
} }
mysql_mutex_lock(&thd->LOCK_wsrep_thd); mysql_mutex_lock(&thd->LOCK_wsrep_thd);
...@@ -202,8 +205,8 @@ void wsrep_replay_transaction(THD *thd) ...@@ -202,8 +205,8 @@ void wsrep_replay_transaction(THD *thd)
close_thread_tables(thd); close_thread_tables(thd);
if (thd->locked_tables_mode && thd->lock) if (thd->locked_tables_mode && thd->lock)
{ {
WSREP_DEBUG("releasing table lock for replaying (%ld)", WSREP_DEBUG("releasing table lock for replaying (%lld)",
thd->thread_id); (longlong) thd->thread_id);
thd->locked_tables_list.unlock_locked_tables(thd); thd->locked_tables_list.unlock_locked_tables(thd);
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
} }
...@@ -242,8 +245,8 @@ void wsrep_replay_transaction(THD *thd) ...@@ -242,8 +245,8 @@ void wsrep_replay_transaction(THD *thd)
case WSREP_OK: case WSREP_OK:
thd->wsrep_conflict_state= NO_CONFLICT; thd->wsrep_conflict_state= NO_CONFLICT;
wsrep->post_commit(wsrep, &thd->wsrep_ws_handle); wsrep->post_commit(wsrep, &thd->wsrep_ws_handle);
WSREP_DEBUG("trx_replay successful for: %ld %llu", WSREP_DEBUG("trx_replay successful for: %lld %lld",
thd->thread_id, (long long)thd->real_id); (longlong) thd->thread_id, (longlong) thd->real_id);
if (thd->get_stmt_da()->is_sent()) if (thd->get_stmt_da()->is_sent())
{ {
WSREP_WARN("replay ok, thd has reported status"); WSREP_WARN("replay ok, thd has reported status");
...@@ -292,8 +295,8 @@ void wsrep_replay_transaction(THD *thd) ...@@ -292,8 +295,8 @@ void wsrep_replay_transaction(THD *thd)
mysql_mutex_lock(&LOCK_wsrep_replaying); mysql_mutex_lock(&LOCK_wsrep_replaying);
wsrep_replaying--; wsrep_replaying--;
WSREP_DEBUG("replaying decreased: %d, thd: %lu", WSREP_DEBUG("replaying decreased: %d, thd: %lld",
wsrep_replaying, thd->thread_id); wsrep_replaying, (longlong) thd->thread_id);
mysql_cond_broadcast(&COND_wsrep_replaying); mysql_cond_broadcast(&COND_wsrep_replaying);
mysql_mutex_unlock(&LOCK_wsrep_replaying); mysql_mutex_unlock(&LOCK_wsrep_replaying);
} }
...@@ -360,10 +363,10 @@ static void wsrep_replication_process(THD *thd) ...@@ -360,10 +363,10 @@ static void wsrep_replication_process(THD *thd)
TABLE *tmp; TABLE *tmp;
while ((tmp = thd->temporary_tables)) while ((tmp = thd->temporary_tables))
{ {
WSREP_WARN("Applier %lu, has temporary tables at exit: %s.%s", WSREP_WARN("Applier %lld, has temporary tables at exit: %s.%s",
thd->thread_id, (longlong) thd->thread_id,
(tmp->s) ? tmp->s->db.str : "void", (tmp->s) ? tmp->s->db.str : "void",
(tmp->s) ? tmp->s->table_name.str : "void"); (tmp->s) ? tmp->s->table_name.str : "void");
} }
wsrep_return_from_bf_mode(thd, &shadow); wsrep_return_from_bf_mode(thd, &shadow);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -470,8 +473,9 @@ static void wsrep_rollback_process(THD *thd) ...@@ -470,8 +473,9 @@ static void wsrep_rollback_process(THD *thd)
mysql_mutex_lock(&aborting->LOCK_wsrep_thd); mysql_mutex_lock(&aborting->LOCK_wsrep_thd);
wsrep_client_rollback(aborting); wsrep_client_rollback(aborting);
WSREP_DEBUG("WSREP rollbacker aborted thd: (%lu %llu)", WSREP_DEBUG("WSREP rollbacker aborted thd: (%lld %lld)",
aborting->thread_id, (long long)aborting->real_id); (longlong) aborting->thread_id,
(longlong) aborting->real_id);
mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); mysql_mutex_unlock(&aborting->LOCK_wsrep_thd);
set_current_thd(thd); set_current_thd(thd);
......
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