Skip to content

Commit 33e8455

Browse files
committed
MDEV-36839: Revert MDEV-7409
MDEV-6247 added PROCESSLIST states for when a Replication SQL thread processes Row events, including a WSRep variant that dynamically includes the Galera Sequence Number. MDEV-7409 further expanded on it by adding the table name to the states. However, PROCESSLIST __cannot__ support generated states. Because it loads the state texts asynchronously, only permanently static strings are safe. Even thread-local memory can become invalid when the thread terminates, which can happen in the middle of generating a PROCESSLIST. To prioritize memory safety, this commit reverts both variants to static strings as the non-WSRep variant was before MDEV-7409. * __Fully__ revert MDEV-7409 (d9898c9) * Remove the WSRep override from MDEV-6247 * Remove `THD::wsrep_info` and its compiler flag `WSREP_PROC_INFO` as they are now unused This commit also includes small optimizations from MDEV-36839’s previous draft, #4133. Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
1 parent 76c79d4 commit 33e8455

File tree

7 files changed

+10
-239
lines changed

7 files changed

+10
-239
lines changed

cmake/wsrep.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ Then restart the build.
4949
SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}"
5050
CACHE INTERNAL "WSREP version")
5151

52-
SET(WSREP_PROC_INFO ${WITH_WSREP})
53-
5452
SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}")
5553
if (NOT WITH_WSREP_ALL)
5654
SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */
549549
#ifndef EMBEDDED_LIBRARY
550550
#cmakedefine WSREP_INTERFACE_VERSION "@WSREP_INTERFACE_VERSION@"
551551
#cmakedefine WITH_WSREP 1
552-
#cmakedefine WSREP_PROC_INFO 1
553552
#endif
554553

555554
#if !defined(__STDC_FORMAT_MACROS)

mysql-test/suite/rpl/r/rpl_rbr_monitor.result

Lines changed: 0 additions & 43 deletions
This file was deleted.

mysql-test/suite/rpl/t/rpl_rbr_monitor.test

Lines changed: 0 additions & 76 deletions
This file was deleted.

sql/log_event_server.cc

Lines changed: 10 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -6212,6 +6212,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
62126212
table->in_use= thd;
62136213

62146214
error= do_exec_row(rgi);
6215+
THD_STAGE_INFO(thd, stage_executing);
62156216

62166217
if (unlikely(error))
62176218
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
@@ -8084,36 +8085,10 @@ int Rows_log_event::update_sequence()
80848085
int
80858086
Write_rows_log_event::do_exec_row(rpl_group_info *rgi)
80868087
{
8087-
DBUG_ASSERT(m_table != NULL);
8088-
const char *tmp= thd->get_proc_info();
8089-
char *message, msg[128];
8090-
const LEX_CSTRING &table_name= m_table->s->table_name;
8091-
const char quote_char=
8092-
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
8093-
my_snprintf(msg, sizeof msg,
8094-
"Write_rows_log_event::write_row() on table %c%.*s%c",
8095-
quote_char, int(table_name.length), table_name.str, quote_char);
8096-
message= msg;
80978088
int error;
8098-
8099-
#ifdef WSREP_PROC_INFO
8100-
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8101-
"Write_rows_log_event::write_row(%lld) on table %c%.*s%c",
8102-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8103-
int(table_name.length), table_name.str, quote_char);
8104-
message= thd->wsrep_info;
8105-
#endif /* WSREP_PROC_INFO */
8106-
8107-
thd_proc_info(thd, message);
8089+
thd_proc_info(thd, "Write_rows_log_event::write_row()");
81088090
error= write_row(rgi, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
8109-
thd_proc_info(thd, tmp);
8110-
8111-
if (unlikely(error) && unlikely(!thd->is_error()))
8112-
{
8113-
DBUG_ASSERT(0);
8114-
my_error(ER_UNKNOWN_ERROR, MYF(0));
8115-
}
8116-
8091+
DBUG_ASSERT(!error || thd->is_error());
81178092
return error;
81188093
}
81198094

@@ -8725,46 +8700,15 @@ Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability
87258700
int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
87268701
{
87278702
int error;
8728-
const char *tmp= thd->get_proc_info();
8729-
char *message, msg[128];
8730-
const LEX_CSTRING &table_name= m_table->s->table_name;
8731-
const char quote_char=
8732-
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
8733-
my_snprintf(msg, sizeof msg,
8734-
"Delete_rows_log_event::find_row() on table %c%.*s%c",
8735-
quote_char, int(table_name.length), table_name.str, quote_char);
8736-
message= msg;
8737-
const bool invoke_triggers= (m_table->triggers && do_invoke_trigger());
8738-
DBUG_ASSERT(m_table != NULL);
8739-
8740-
#ifdef WSREP_PROC_INFO
8741-
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8742-
"Delete_rows_log_event::find_row(%lld) on table %c%.*s%c",
8743-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8744-
int(table_name.length), table_name.str,
8745-
quote_char);
8746-
message= thd->wsrep_info;
8747-
#endif /* WSREP_PROC_INFO */
8748-
8749-
thd_proc_info(thd, message);
8703+
const bool invoke_triggers= m_table->triggers && do_invoke_trigger();
8704+
8705+
thd_proc_info(thd, "Delete_rows_log_event::find_row()");
87508706
if (likely(!(error= find_row(rgi))))
87518707
{
87528708
/*
87538709
Delete the record found, located in record[0]
87548710
*/
8755-
my_snprintf(msg, sizeof msg,
8756-
"Delete_rows_log_event::ha_delete_row() on table %c%.*s%c",
8757-
quote_char, int(table_name.length), table_name.str,
8758-
quote_char);
8759-
message= msg;
8760-
#ifdef WSREP_PROC_INFO
8761-
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8762-
"Delete_rows_log_event::ha_delete_row(%lld) on table %c%.*s%c",
8763-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8764-
int(table_name.length), table_name.str, quote_char);
8765-
message= thd->wsrep_info;
8766-
#endif
8767-
thd_proc_info(thd, message);
8711+
thd_proc_info(thd, "Delete_rows_log_event::ha_delete_row()");
87688712

87698713
if (invoke_triggers &&
87708714
unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)))
@@ -8791,7 +8735,6 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
87918735
error= HA_ERR_GENERIC; // in case if error is not set yet
87928736
m_table->file->ha_index_or_rnd_end();
87938737
}
8794-
thd_proc_info(thd, tmp);
87958738
return error;
87968739
}
87978740

@@ -8885,28 +8828,7 @@ int
88858828
Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
88868829
{
88878830
const bool invoke_triggers= (m_table->triggers && do_invoke_trigger());
8888-
const char *tmp= thd->get_proc_info();
8889-
DBUG_ASSERT(m_table != NULL);
8890-
char *message, msg[128];
8891-
const LEX_CSTRING &table_name= m_table->s->table_name;
8892-
const char quote_char=
8893-
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
8894-
my_snprintf(msg, sizeof msg,
8895-
"Update_rows_log_event::find_row() on table %c%.*s%c",
8896-
quote_char, int(table_name.length), table_name.str, quote_char);
8897-
message= msg;
8898-
8899-
#ifdef WSREP_PROC_INFO
8900-
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8901-
"Update_rows_log_event::find_row(%lld) on table %c%.*s%c",
8902-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8903-
int(table_name.length), table_name.str,
8904-
quote_char);
8905-
message= thd->wsrep_info;
8906-
#endif /* WSREP_PROC_INFO */
8907-
8908-
thd_proc_info(thd, message);
8909-
8831+
thd_proc_info(thd, "Update_rows_log_event::find_row()");
89108832
int error= find_row(rgi);
89118833
if (unlikely(error))
89128834
{
@@ -8916,7 +8838,6 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
89168838
*/
89178839
if ((m_curr_row= m_curr_row_end))
89188840
unpack_current_row(rgi, &m_cols_ai);
8919-
thd_proc_info(thd, tmp);
89208841
return error;
89218842
}
89228843

@@ -8939,20 +8860,8 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
89398860
store_record(m_table,record[1]);
89408861

89418862
m_curr_row= m_curr_row_end;
8942-
my_snprintf(msg, sizeof msg,
8943-
"Update_rows_log_event::unpack_current_row() on table %c%.*s%c",
8944-
quote_char, int(table_name.length), table_name.str, quote_char);
8945-
message= msg;
8946-
#ifdef WSREP_PROC_INFO
8947-
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8948-
"Update_rows_log_event::unpack_current_row(%lld) on table %c%.*s%c",
8949-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8950-
int(table_name.length), table_name.str, quote_char);
8951-
message= thd->wsrep_info;
8952-
#endif /* WSREP_PROC_INFO */
8953-
89548863
/* this also updates m_curr_row_end */
8955-
thd_proc_info(thd, message);
8864+
thd_proc_info(thd, "Update_rows_log_event::unpack_current_row()");
89568865
if (unlikely((error= unpack_current_row(rgi, &m_cols_ai))))
89578866
goto err;
89588867
if (m_table->s->long_unique_table)
@@ -8972,19 +8881,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
89728881
DBUG_DUMP("new values", m_table->record[0], m_table->s->reclength);
89738882
#endif
89748883

8975-
my_snprintf(msg, sizeof msg,
8976-
"Update_rows_log_event::ha_update_row() on table %c%.*s%c",
8977-
quote_char, int(table_name.length), table_name.str, quote_char);
8978-
message= msg;
8979-
#ifdef WSREP_PROC_INFO
8980-
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
8981-
"Update_rows_log_event::ha_update_row(%lld) on table %c%.*s%c",
8982-
(long long) wsrep_thd_trx_seqno(thd), quote_char,
8983-
int(table_name.length), table_name.str, quote_char);
8984-
message= thd->wsrep_info;
8985-
#endif /* WSREP_PROC_INFO */
8986-
8987-
thd_proc_info(thd, message);
8884+
thd_proc_info(thd, "Update_rows_log_event::ha_update_row()");
89888885
if (invoke_triggers &&
89898886
unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, TRUE)))
89908887
{
@@ -9016,9 +8913,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
90168913
unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)))
90178914
error= HA_ERR_GENERIC; // in case if error is not set yet
90188915

9019-
90208916
err:
9021-
thd_proc_info(thd, tmp);
90228917
m_table->file->ha_index_or_rnd_end();
90238918
return error;
90248919
}

sql/sql_class.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
915915

916916
#ifdef WITH_WSREP
917917
mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL);
918-
wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */
919918
#endif
920919
/* Call to init() below requires fully initialized Open_tables_state. */
921920
reset_open_tables_state();

sql/sql_class.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5553,7 +5553,6 @@ class THD: public THD_count, /* this must be first */
55535553
uint32 wsrep_rand;
55545554
rpl_group_info *wsrep_rgi;
55555555
bool wsrep_converted_lock_session;
5556-
char wsrep_info[128]; /* string for dynamic proc info */
55575556
ulong wsrep_retry_counter; // of autocommit
55585557
bool wsrep_PA_safe;
55595558
char* wsrep_retry_query;

0 commit comments

Comments
 (0)