Skip to content

Commit 4a577e5

Browse files
committed
BUG#24638038 - XPLUGIN PROCESS ID REALTED STATS NOT SHOWN IN PERFORMANCE SCHEMA.THREADS TABLE
Post push fix, toggling performance_schema_threads.test, performance_schema_unixsocket.test RB: 14267 Reviewed-by: Andrzej Religa <[email protected]>
1 parent 7711c65 commit 4a577e5

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,12 +2107,9 @@ class Command
21072107
return Continue;
21082108
}
21092109

2110-
static void compare_variable_to(bool &match, std::string expected_value, std::string value)
2110+
static void put_variable_to(std::string &result, const std::string &value)
21112111
{
2112-
if (expected_value == value)
2113-
{
2114-
match = true;
2115-
}
2112+
result = value;
21162113
}
21172114

21182115
static void try_result(Result result)
@@ -2147,28 +2144,36 @@ class Command
21472144
const int countdown_start_value = 30;
21482145
int countdown_retries = countdown_start_value;
21492146

2147+
std::string args_variables_replaced = args;
21502148
std::vector<std::string> vargs;
21512149

2152-
boost::split(vargs, args, boost::is_any_of("\t"), boost::token_compress_on);
2150+
replace_variables(args_variables_replaced);
2151+
boost::split(vargs, args_variables_replaced, boost::is_any_of("\t"), boost::token_compress_on);
21532152

21542153
if (2 != vargs.size())
21552154
{
21562155
std::cerr << "Specified invalid number of arguments for command wait_for:" << vargs.size() << " expecting 2\n";
21572156
return Stop_with_failure;
21582157
}
21592158

2159+
const std::string &expected_value = vargs[0];
2160+
std::string value;
2161+
21602162
try
21612163
{
2162-
while(!match && countdown_retries--)
2164+
do
21632165
{
21642166
Backup_and_restore<bool> backup_and_restore_fatal_errors(OPT_fatal_errors, true);
21652167
Backup_and_restore<bool> backup_and_restore_query(OPT_query, false);
21662168
Backup_and_restore<std::string> backup_and_restore_command_name(context.m_command_name, "sql");
21672169

21682170
try_result(cmd_stmtsql(context, vargs[1]));
2169-
try_result(cmd_recvresult(context, "", ngs::bind(&Command::compare_variable_to, ngs::ref(match), vargs[0], ngs::placeholders::_1)));
2171+
try_result(cmd_recvresult(context, "", ngs::bind(&Command::put_variable_to, ngs::ref(value), ngs::placeholders::_1)));
21702172
try_result(cmd_sleep(context,"1"));
2173+
2174+
match = (value == expected_value);
21712175
}
2176+
while(!match && --countdown_retries);
21722177
}
21732178
catch(const Result result)
21742179
{
@@ -2178,7 +2183,8 @@ class Command
21782183

21792184
if (!match)
21802185
{
2181-
std::cerr << "Query didn't return expected value, tried " << countdown_start_value << " retries\n";
2186+
std::cerr << "Query didn't return expected value, tried " << countdown_start_value << " times\n";
2187+
std::cerr << "Expected '" << expected_value << "', received '" << value << "'\n";
21822188
return Stop_with_failure;
21832189
}
21842190

rapid/plugin/x/tests/mtr/include/performance_schema_assert_empty_worker_threads.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
--echo #
1212
--echo # Get actual number of worker threads
1313
--echo #
14-
let $thread_entries=`SELECT COUNT(*) FROM performance_schema.threads
15-
WHERE name LIKE "thread/mysqlx/worker"`;
14+
15+
let $wait_condition= SELECT COUNT(*)>=@@mysqlx_min_worker_threads FROM performance_schema.threads
16+
WHERE name LIKE "thread/mysqlx/worker";
17+
source include/wait_condition_or_abort.inc;
18+
19+
let $thread_entries=`SELECT @@mysqlx_min_worker_threads`;
1620

1721
let $assert_text= X Plugin must have idle worker threads;
1822
let $assert_cond= [SELECT $thread_entries as `Result`, Result, 1] > 0;

rapid/plugin/x/tests/mtr/t/performance_schema_unixsockets.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
--write_file $MYSQL_TMP_DIR/performance_schema_socket_num.tmp
1212
-->macro check_xconnection_count %EXPECTED_NUM_OF_CONNECTIONS%
1313
-->echo Verify [Checking if X Plugin reports %EXPECTED_NUM_OF_CONNECTIONS% connections]
14-
-->stmtsql SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection'
15-
-->recvtovar %NUM%
16-
-->assert_eq %EXPECTED_NUM_OF_CONNECTIONS% %NUM%
14+
-->wait_for %EXPECTED_NUM_OF_CONNECTIONS% SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection'
1715
-->echo success
1816
-->endmacro
1917

0 commit comments

Comments
 (0)