Skip to content

MDEV-17746: perfschema.dml_threads failed in buildbot with wrong errno#5395

Open
gkodinov wants to merge 1 commit into
10.11from
10.11-MDEV-17746
Open

MDEV-17746: perfschema.dml_threads failed in buildbot with wrong errno#5395
gkodinov wants to merge 1 commit into
10.11from
10.11-MDEV-17746

Conversation

@gkodinov

Copy link
Copy Markdown
Member

The test was trying to update the performance_schema.threads row for the current connection. And if that row was not found there's nothing to update hence no update not allowed error.
If the maximum number of instrumented threads is hit the assumption that there's always a row in performance_schema.thread for the current thread does not hold. This can happen under heavy concurrent load. mtr sets the maximum number of instrumented threads to 400. This is not much.
Stabilized the test as follows:

  • Added a SELECT with the same conditon to ensure there's a row to be updated by the UPDATE following the select.
  • Increased the performance_schema_max_thread_instances to 10k for the test.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the dml_threads performance schema test to query the current connection's thread ID before attempting an invalid update, ensuring the target row exists. It also introduces a master option file setting performance_schema_max_thread_instances to 50,000. The reviewer pointed out that this value is higher than the 10,000 specified in the pull request description, which could cause unnecessary memory consumption, and recommended lowering it to 10,000 and adding a trailing newline.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mysql-test/suite/perfschema/t/dml_threads-master.opt Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Stabilizes the perfschema.dml_threads MTR test under heavy concurrency by ensuring the session’s performance_schema.threads row exists before running an UPDATE ... WHERE PROCESSLIST_ID=CONNECTION_ID() that is expected to error, and by increasing the PFS thread-instance sizing for this test run.

Changes:

  • Adds a deterministic SELECT (with --replace_column) to confirm a matching performance_schema.threads row exists before the error-expected update.
  • Increases performance_schema_max_thread_instances for the test via a new dml_threads-master.opt.
  • Updates the expected result output accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
mysql-test/suite/perfschema/t/dml_threads.test Adds a pre-check SELECT (with column replacement) before the error-expected update.
mysql-test/suite/perfschema/t/dml_threads-master.opt Sets a higher performance_schema_max_thread_instances for this test to reduce flakiness under load.
mysql-test/suite/perfschema/r/dml_threads.result Records the new SELECT output in the expected result.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mysql-test/suite/perfschema/t/dml_threads.test Outdated
Comment thread mysql-test/suite/perfschema/t/dml_threads-master.opt Outdated
The test was trying to update the performance_schema.threads row for
the current connection. And if that row was not found there's nothing
to update hence no update not allowed error.
If the maximum number of instrumented threads is hit the assumption
that there's always a row in performance_schema.thread for the current
thread does not hold. This can happen under heavy concurrent load.
mtr sets the maximum number of instrumented threads to 400. This is
not much.
Stabilized the test as follows:
 * Added a SELECT with the same conditon to ensure there's a row to
   be updated by the UPDATE following the select.
 * Increased the performance_schema_max_thread_instances to 50k
    for the test.
@vuvova

vuvova commented Jul 16, 2026

Copy link
Copy Markdown
Member

Looks strange. What do you mean "can happen under heavy concurrent load" ? There is no concurrent load in mtr, every test always runs on a dedicated server, "concurrent" mtr means many servers running concurrently, not all tests on a single server.

@gkodinov

Copy link
Copy Markdown
Member Author

Hitting that limit is the only possible explanation on why this particular query fails to update and the one prior to it is passing. What causes the thread depletion is a subject to a whole different study. But this bug is about stability of the test.

@svoj

svoj commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

./mtr perfschema.dml_threads --repeat=100 fails reliably with the fix on the second iteration.

@svoj

svoj commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Simplified test:

--source include/have_perfschema.inc

select NAME, processlist_id from performance_schema.threads where processlist_id=connection_id();
--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.threads
  set thread_id=12 where PROCESSLIST_ID=connection_id();

./mtr --repeat=2

select NAME, processlist_id from performance_schema.threads where processlist_id=connection_id();
NAME	processlist_id
thread/sql/one_connection	4
update performance_schema.threads
set thread_id=12 where PROCESSLIST_ID=connection_id();
ERROR HY000: Invalid performance_schema usage
main.AAA                                 [ pass ]      4
select NAME, processlist_id from performance_schema.threads where processlist_id=connection_id();
NAME	processlist_id
thread/sql/one_connection	8
update performance_schema.threads
set thread_id=12 where PROCESSLIST_ID=connection_id();
main.AAA                                 [ 2 fail ]
        Test ended at 2026-07-16 19:22:06

CURRENT_TEST: main.AAA
mysqltest: At line 5: query 'update performance_schema.threads
set thread_id=12 where PROCESSLIST_ID=connection_id()' succeeded - should have failed with error ER_WRONG_PERFSCHEMA_USAGE (1683)...

It demonstrates a valid row in the table whereas update still succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants