Skip to content

Commit 2704685

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: I3a455b9f9e4d3ce3a8799f55f7c67c924d619715
2 parents 5f72c55 + fb705ac commit 2704685

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

share/messages_to_error_log.txt

+3
Original file line numberDiff line numberDiff line change
@@ -12285,6 +12285,9 @@ ER_IB_MSG_DDL_FAIL_NO_BUILDER
1228512285
ER_GRP_RPL_MEMBER_INFO_DOES_NOT_EXIST
1228612286
eng "Member identified %s: '%s' does not exist on Group Replication membership during %s."
1228712287

12288+
ER_USAGE_DEPRECATION_COUNTER
12289+
eng "Deprecated '%s' used %s times, last time used '%s'."
12290+
1228812291
#
1228912292
# End of 8.0 error messages intended to be written to the server error log.
1229012293
#

sql/mysqld.cc

+25-1
Original file line numberDiff line numberDiff line change
@@ -11429,6 +11429,24 @@ static int show_telemetry_traces_support(THD * /*unused*/, SHOW_VAR *var,
1142911429
return 0;
1143011430
}
1143111431

11432+
static int show_deprecated_use_i_s_processlist_count(THD *, SHOW_VAR *var,
11433+
char *buf) {
11434+
var->type = SHOW_LONG;
11435+
var->value = buf;
11436+
*((long *)buf) = (long)(deprecated_use_i_s_processlist_count.load());
11437+
return 0;
11438+
}
11439+
11440+
static int show_deprecated_use_i_s_processlist_last_timestamp(THD *,
11441+
SHOW_VAR *var,
11442+
char *buf) {
11443+
var->type = SHOW_LONGLONG;
11444+
var->value = buf;
11445+
*((long long *)buf) =
11446+
(long long)(deprecated_use_i_s_processlist_last_timestamp.load());
11447+
return 0;
11448+
}
11449+
1143211450
SHOW_VAR status_vars[] = {
1143311451
{"Aborted_clients", (char *)&aborted_threads, SHOW_LONG, SHOW_SCOPE_GLOBAL},
1143411452
{"Aborted_connects", (char *)&show_aborted_connects, SHOW_FUNC,
@@ -11793,7 +11811,13 @@ SHOW_VAR status_vars[] = {
1179311811
SHOW_FUNC, SHOW_SCOPE_GLOBAL},
1179411812
{"Tls_sni_server_name", (char *)&show_ssl_get_tls_sni_servername, SHOW_FUNC,
1179511813
SHOW_SCOPE_SESSION},
11796-
{NullS, NullS, SHOW_LONG, SHOW_SCOPE_ALL}};
11814+
{"Deprecated_use_i_s_processlist_count",
11815+
(char *)&show_deprecated_use_i_s_processlist_count, SHOW_FUNC,
11816+
SHOW_SCOPE_GLOBAL},
11817+
{"Deprecated_use_i_s_processlist_last_timestamp",
11818+
(char *)&show_deprecated_use_i_s_processlist_last_timestamp, SHOW_FUNC,
11819+
SHOW_SCOPE_GLOBAL},
11820+
{NullS, NullS, SHOW_FUNC, SHOW_SCOPE_ALL}};
1179711821

1179811822
void add_terminator(vector<my_option> *options) {
1179911823
my_option empty_element = {nullptr, 0, nullptr, nullptr, nullptr,

sql/server_component/mysql_status_variable_reader_imp.cc

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2222

2323
#include "mysql_status_variable_reader_imp.h"
2424
#include <mysql/components/minimal_chassis.h> // mysql_components_handle_std_exception
25+
#include <sql/mysqld.h> // server_shutting_down
2526
#include <sql/sql_show.h>
2627
#include "mysql/components/services/log_builtins.h" // LogErr
2728
#include "storing_auto_thd.h"
@@ -35,6 +36,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
3536
DEFINE_BOOL_METHOD(mysql_status_variable_reader_imp::get,
3637
(MYSQL_THD hthd, const char *name, bool get_global,
3738
my_h_string *out_string)) {
39+
/* Cannot get status variable when server is shutting down. */
40+
rwlock_scoped_lock rdlock(&LOCK_server_shutting_down, false, __FILE__,
41+
__LINE__);
42+
43+
if (server_shutting_down) return true;
44+
3845
try {
3946
char buf[SHOW_VAR_FUNC_BUFF_SIZE + 1];
4047
size_t length = sizeof(buf);

sql/sql_show.cc

+12
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ bool iterate_all_dynamic_privileges(THD *thd,
152152
using std::max;
153153
using std::min;
154154

155+
/** Count number of times information_schema.processlist has been used. */
156+
std::atomic_ulong deprecated_use_i_s_processlist_count = 0;
157+
158+
/** Last time information_schema.processlist was used, as usec since epoch. */
159+
std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp = 0;
160+
155161
/**
156162
@class CSET_STRING
157163
@brief Character set armed LEX_CSTRING
@@ -2767,6 +2773,9 @@ class List_process_list : public Do_THD_Impl {
27672773
m_max_query_length(max_query_length) {
27682774
push_deprecated_warn(m_client_thd, "INFORMATION_SCHEMA.PROCESSLIST",
27692775
"performance_schema.processlist");
2776+
2777+
deprecated_use_i_s_processlist_last_timestamp = my_micro_time();
2778+
deprecated_use_i_s_processlist_count++;
27702779
}
27712780

27722781
void operator()(THD *inspect_thd) override {
@@ -2999,6 +3008,9 @@ class Fill_process_list : public Do_THD_Impl {
29993008
: m_client_thd(thd_value), m_tables(tables_value) {
30003009
push_deprecated_warn(m_client_thd, "INFORMATION_SCHEMA.PROCESSLIST",
30013010
"performance_schema.processlist");
3011+
3012+
deprecated_use_i_s_processlist_last_timestamp = my_micro_time();
3013+
deprecated_use_i_s_processlist_count++;
30023014
}
30033015

30043016
~Fill_process_list() override {

sql/sql_show.h

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ void show_sql_type(enum_field_types type, bool is_array, uint metadata,
148148
bool do_fill_information_schema_table(THD *thd, Table_ref *table_list,
149149
Item *condition);
150150

151+
extern std::atomic_ulong deprecated_use_i_s_processlist_count;
152+
extern std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp;
151153
extern TYPELIB grant_types;
152154

153155
/**

0 commit comments

Comments
 (0)