Skip to content

Commit 869e67c

Browse files
committed
cleanup: remove thd->stmt_changes_data
what is done in the plugin - stays in the plugin
1 parent 3781848 commit 869e67c

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

plugin/query_response_time/plugin.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ static void query_response_time_audit_notify(MYSQL_THD thd,
231231
if (event_general->event_subclass == MYSQL_AUDIT_GENERAL_STATUS &&
232232
query_response_time_should_log(thd))
233233
{
234-
QUERY_TYPE query_type= (thd->stmt_changes_data ? WRITE : READ);
234+
bool stmt_changes_data= is_update_query(thd->last_sql_command)
235+
|| thd->transaction->stmt.is_trx_read_write();
236+
QUERY_TYPE query_type= stmt_changes_data ? WRITE : READ;
235237
#ifndef DBUG_OFF
236238
if (THDVAR(thd, exec_time_debug))
237239
{

sql/handler.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5288,7 +5288,6 @@ void handler::mark_trx_read_write_internal()
52885288
if (table_share == NULL || table_share->tmp_table == NO_TMP_TABLE)
52895289
ha_info->set_trx_read_write();
52905290
}
5291-
thd->stmt_changes_data= 1;
52925291
}
52935292

52945293

sql/sql_class.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
661661
bootstrap(0),
662662
derived_tables_processing(FALSE),
663663
waiting_on_group_commit(FALSE), has_waiter(FALSE),
664-
spcont(NULL),
664+
last_sql_command(SQLCOM_END), spcont(NULL),
665665
m_parser_state(NULL),
666666
#ifndef EMBEDDED_LIBRARY
667667
audit_plugin_version(-1),
@@ -6034,7 +6034,6 @@ void THD::store_slow_query_state(Sub_statement_state *backup)
60346034
backup->tmp_tables_size= tmp_tables_size;
60356035
backup->tmp_tables_used= tmp_tables_used;
60366036
backup->handler_stats= handler_stats;
6037-
backup->stmt_changes_data= stmt_changes_data;
60386037
}
60396038

60406039
/* Reset variables related to slow query log */
@@ -6063,7 +6062,6 @@ void THD::reset_slow_query_state(Sub_statement_state *backup)
60636062
}
60646063
if ((variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_ENGINE))
60656064
handler_stats.reset();
6066-
stmt_changes_data= 0; // Can be used by audit plugins
60676065
}
60686066

60696067
/*
@@ -6095,7 +6093,6 @@ void THD::add_slow_query_state(Sub_statement_state *backup)
60956093
}
60966094
if ((variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_ENGINE))
60976095
handler_stats.add(&backup->handler_stats);
6098-
stmt_changes_data|= backup->stmt_changes_data;
60996096
}
61006097

61016098

sql/sql_class.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,6 @@ class Sub_statement_state
21222122
bool last_insert_id_used;
21232123
bool in_stored_procedure;
21242124
bool do_union;
2125-
bool stmt_changes_data;
21262125
enum enum_check_fields count_cuted_fields;
21272126
};
21282127

@@ -3863,7 +3862,6 @@ class THD: public THD_count, /* this must be first */
38633862
See comment above regarding transaction_isolation.
38643863
*/
38653864
bool tx_read_only;
3866-
bool stmt_changes_data;
38673865
enum_check_fields count_cuted_fields;
38683866

38693867
DYNAMIC_ARRAY user_var_events; /* For user variables replication */
@@ -3998,7 +3996,7 @@ class THD: public THD_count, /* this must be first */
39983996
execution stack when the event turns out to be ignored.
39993997
*/
40003998
int slave_expected_error;
4001-
enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command()
3999+
enum_sql_command last_sql_command; // Last sql_command executed in mysql_execute_command()
40024000

40034001
sp_rcontext *spcont; // SP runtime context
40044002

sql/sql_parse.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,8 +3515,6 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
35153515
like mysql_audit_plugin.
35163516
*/
35173517
thd->last_sql_command= lex->sql_command;
3518-
thd->stmt_changes_data|= (sql_command_flags[lex->sql_command] &
3519-
CF_CHANGES_DATA);
35203518

35213519
/*
35223520
Reset warning count for each query that uses tables

0 commit comments

Comments
 (0)