mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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 (d9898c9a71
)
* 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>
This commit is contained in:
@@ -49,8 +49,6 @@ Then restart the build.
|
||||
SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}"
|
||||
CACHE INTERNAL "WSREP version")
|
||||
|
||||
SET(WSREP_PROC_INFO ${WITH_WSREP})
|
||||
|
||||
SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}")
|
||||
if (NOT WITH_WSREP_ALL)
|
||||
SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL
|
||||
|
@@ -549,7 +549,6 @@ this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
#cmakedefine WSREP_INTERFACE_VERSION "@WSREP_INTERFACE_VERSION@"
|
||||
#cmakedefine WITH_WSREP 1
|
||||
#cmakedefine WSREP_PROC_INFO 1
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_FORMAT_MACROS)
|
||||
|
@@ -1,43 +0,0 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection master;
|
||||
create table t1(a int primary key) engine=innodb;
|
||||
connection slave;
|
||||
connection slave1;
|
||||
begin;
|
||||
insert into t1(a) values(1);
|
||||
connection master;
|
||||
select * from t1;
|
||||
a
|
||||
insert into t1(a) values(1);
|
||||
#monitoring write rows
|
||||
connection slave;
|
||||
#monitoring update rows
|
||||
connection slave1;
|
||||
rollback;
|
||||
begin;
|
||||
select a from t1 for update;
|
||||
a
|
||||
1
|
||||
connection master;
|
||||
update t1 set a = a + 1 ;
|
||||
connection slave;
|
||||
#monitoring delete rows
|
||||
connection slave1;
|
||||
rollback;
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
a
|
||||
2
|
||||
connection master;
|
||||
delete from t1;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
connection slave1;
|
||||
rollback;
|
||||
connection master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
include/rpl_end.inc
|
@@ -1,76 +0,0 @@
|
||||
#
|
||||
# Mdev-7409 On RBR, extend the PROCESSLIST info to include at least the name of
|
||||
# the recently used table
|
||||
# This testcase create Write_rows_log_event , Update_rows_log_event and
|
||||
# Delete_rows_log_event which is blocked on slave and we will check whether
|
||||
# whether processinfo includes table name or not.
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/master-slave.inc
|
||||
--enable_connect_log
|
||||
|
||||
--connection master
|
||||
create table t1(a int primary key) engine=innodb;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave1
|
||||
begin;
|
||||
insert into t1(a) values(1);
|
||||
--connection master
|
||||
select * from t1;
|
||||
|
||||
insert into t1(a) values(1);
|
||||
--save_master_pos
|
||||
|
||||
--echo #monitoring write rows
|
||||
--connection slave
|
||||
|
||||
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE DB = 'test' AND STATE LIKE "Write_rows_log_event::write_row(%) on table %";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
|
||||
--echo #monitoring update rows
|
||||
--connection slave1
|
||||
rollback;
|
||||
--sync_with_master
|
||||
begin;
|
||||
select a from t1 for update;
|
||||
|
||||
--connection master
|
||||
update t1 set a = a + 1 ;
|
||||
--save_master_pos
|
||||
|
||||
--connection slave
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE DB = 'test' AND STATE LIKE "Update_rows_log_event::find_row(%) on table %";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo #monitoring delete rows
|
||||
--connection slave1
|
||||
rollback;
|
||||
--sync_with_master
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
|
||||
--connection master
|
||||
delete from t1;
|
||||
--save_master_pos
|
||||
|
||||
--connection slave
|
||||
select * from t1;
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE DB = 'test' AND STATE LIKE "Delete_rows_log_event::find_row(%) on table %";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
#CleanUp
|
||||
--connection slave1
|
||||
rollback;
|
||||
--sync_with_master
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
--source include/rpl_end.inc
|
@@ -6212,6 +6212,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
table->in_use= thd;
|
||||
|
||||
error= do_exec_row(rgi);
|
||||
THD_STAGE_INFO(thd, stage_executing);
|
||||
|
||||
if (unlikely(error))
|
||||
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
|
||||
@@ -8084,36 +8085,10 @@ int Rows_log_event::update_sequence()
|
||||
int
|
||||
Write_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
{
|
||||
DBUG_ASSERT(m_table != NULL);
|
||||
const char *tmp= thd->get_proc_info();
|
||||
char *message, msg[128];
|
||||
const LEX_CSTRING &table_name= m_table->s->table_name;
|
||||
const char quote_char=
|
||||
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Write_rows_log_event::write_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str, quote_char);
|
||||
message= msg;
|
||||
int error;
|
||||
|
||||
#ifdef WSREP_PROC_INFO
|
||||
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Write_rows_log_event::write_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str, quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif /* WSREP_PROC_INFO */
|
||||
|
||||
thd_proc_info(thd, message);
|
||||
thd_proc_info(thd, "Write_rows_log_event::write_row()");
|
||||
error= write_row(rgi, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
|
||||
thd_proc_info(thd, tmp);
|
||||
|
||||
if (unlikely(error) && unlikely(!thd->is_error()))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0));
|
||||
}
|
||||
|
||||
DBUG_ASSERT(!error || thd->is_error());
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -8725,46 +8700,15 @@ Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability
|
||||
int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
{
|
||||
int error;
|
||||
const char *tmp= thd->get_proc_info();
|
||||
char *message, msg[128];
|
||||
const LEX_CSTRING &table_name= m_table->s->table_name;
|
||||
const char quote_char=
|
||||
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Delete_rows_log_event::find_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str, quote_char);
|
||||
message= msg;
|
||||
const bool invoke_triggers= (m_table->triggers && do_invoke_trigger());
|
||||
DBUG_ASSERT(m_table != NULL);
|
||||
const bool invoke_triggers= m_table->triggers && do_invoke_trigger();
|
||||
|
||||
#ifdef WSREP_PROC_INFO
|
||||
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Delete_rows_log_event::find_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str,
|
||||
quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif /* WSREP_PROC_INFO */
|
||||
|
||||
thd_proc_info(thd, message);
|
||||
thd_proc_info(thd, "Delete_rows_log_event::find_row()");
|
||||
if (likely(!(error= find_row(rgi))))
|
||||
{
|
||||
/*
|
||||
Delete the record found, located in record[0]
|
||||
*/
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Delete_rows_log_event::ha_delete_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str,
|
||||
quote_char);
|
||||
message= msg;
|
||||
#ifdef WSREP_PROC_INFO
|
||||
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Delete_rows_log_event::ha_delete_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str, quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif
|
||||
thd_proc_info(thd, message);
|
||||
thd_proc_info(thd, "Delete_rows_log_event::ha_delete_row()");
|
||||
|
||||
if (invoke_triggers &&
|
||||
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)
|
||||
error= HA_ERR_GENERIC; // in case if error is not set yet
|
||||
m_table->file->ha_index_or_rnd_end();
|
||||
}
|
||||
thd_proc_info(thd, tmp);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -8885,28 +8828,7 @@ int
|
||||
Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
{
|
||||
const bool invoke_triggers= (m_table->triggers && do_invoke_trigger());
|
||||
const char *tmp= thd->get_proc_info();
|
||||
DBUG_ASSERT(m_table != NULL);
|
||||
char *message, msg[128];
|
||||
const LEX_CSTRING &table_name= m_table->s->table_name;
|
||||
const char quote_char=
|
||||
get_quote_char_for_identifier(thd, table_name.str, table_name.length);
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Update_rows_log_event::find_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str, quote_char);
|
||||
message= msg;
|
||||
|
||||
#ifdef WSREP_PROC_INFO
|
||||
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Update_rows_log_event::find_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str,
|
||||
quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif /* WSREP_PROC_INFO */
|
||||
|
||||
thd_proc_info(thd, message);
|
||||
|
||||
thd_proc_info(thd, "Update_rows_log_event::find_row()");
|
||||
int error= find_row(rgi);
|
||||
if (unlikely(error))
|
||||
{
|
||||
@@ -8916,7 +8838,6 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
*/
|
||||
if ((m_curr_row= m_curr_row_end))
|
||||
unpack_current_row(rgi, &m_cols_ai);
|
||||
thd_proc_info(thd, tmp);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -8939,20 +8860,8 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
store_record(m_table,record[1]);
|
||||
|
||||
m_curr_row= m_curr_row_end;
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Update_rows_log_event::unpack_current_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str, quote_char);
|
||||
message= msg;
|
||||
#ifdef WSREP_PROC_INFO
|
||||
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Update_rows_log_event::unpack_current_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str, quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif /* WSREP_PROC_INFO */
|
||||
|
||||
/* this also updates m_curr_row_end */
|
||||
thd_proc_info(thd, message);
|
||||
thd_proc_info(thd, "Update_rows_log_event::unpack_current_row()");
|
||||
if (unlikely((error= unpack_current_row(rgi, &m_cols_ai))))
|
||||
goto err;
|
||||
if (m_table->s->long_unique_table)
|
||||
@@ -8972,19 +8881,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
DBUG_DUMP("new values", m_table->record[0], m_table->s->reclength);
|
||||
#endif
|
||||
|
||||
my_snprintf(msg, sizeof msg,
|
||||
"Update_rows_log_event::ha_update_row() on table %c%.*s%c",
|
||||
quote_char, int(table_name.length), table_name.str, quote_char);
|
||||
message= msg;
|
||||
#ifdef WSREP_PROC_INFO
|
||||
my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
|
||||
"Update_rows_log_event::ha_update_row(%lld) on table %c%.*s%c",
|
||||
(long long) wsrep_thd_trx_seqno(thd), quote_char,
|
||||
int(table_name.length), table_name.str, quote_char);
|
||||
message= thd->wsrep_info;
|
||||
#endif /* WSREP_PROC_INFO */
|
||||
|
||||
thd_proc_info(thd, message);
|
||||
thd_proc_info(thd, "Update_rows_log_event::ha_update_row()");
|
||||
if (invoke_triggers &&
|
||||
unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, TRUE)))
|
||||
{
|
||||
@@ -9016,9 +8913,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
||||
unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)))
|
||||
error= HA_ERR_GENERIC; // in case if error is not set yet
|
||||
|
||||
|
||||
err:
|
||||
thd_proc_info(thd, tmp);
|
||||
m_table->file->ha_index_or_rnd_end();
|
||||
return error;
|
||||
}
|
||||
|
@@ -915,7 +915,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL);
|
||||
wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */
|
||||
#endif
|
||||
/* Call to init() below requires fully initialized Open_tables_state. */
|
||||
reset_open_tables_state();
|
||||
|
@@ -5553,7 +5553,6 @@ public:
|
||||
uint32 wsrep_rand;
|
||||
rpl_group_info *wsrep_rgi;
|
||||
bool wsrep_converted_lock_session;
|
||||
char wsrep_info[128]; /* string for dynamic proc info */
|
||||
ulong wsrep_retry_counter; // of autocommit
|
||||
bool wsrep_PA_safe;
|
||||
char* wsrep_retry_query;
|
||||
|
Reference in New Issue
Block a user