[MDEV-25730] maria.repair test fails with valgrind Created: 2021-05-19  Updated: 2021-06-02  Resolved: 2021-05-25

Status: Closed
Project: MariaDB Server
Component/s: Admin statements
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.39, 10.3.30, 10.4.20, 10.5.11

Type: Bug Priority: Major
Reporter: Sujatha Sivakumar (Inactive) Assignee: Sujatha Sivakumar (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 Description   

Post MDEV-22530 fix, maria.repair test fails.

To reproduce: ./mtr maria.repair --valgrind

CURRENT_TEST: maria.repair
--- /home/sujatha/bug_repo/MDEV-22530-10.3/mysql-test/suite/maria/repair.result	2021-05-18 15:46:14.541610374 +0530
+++ /home/sujatha/bug_repo/MDEV-22530-10.3/mysql-test/suite/maria/repair.reject	2021-05-19 17:32:11.008555697 +0530
@@ -30,11 +30,6 @@
 SET max_session_mem_used=50000;
 REPAIR LOCAL TABLE t1 USE_FRM;
 Table	Op	Msg_type	Msg_text
-t1	repair	error	Failed to open partially repaired table
-Warnings:
-Error	1290	The MariaDB server is running with the --max-thread-mem-used=50000 option so it cannot execute this statement
 REPAIR LOCAL TABLE t1;
 Table	Op	Msg_type	Msg_text
-test.t1	repair	Error	The MariaDB server is running with the --max-thread-mem-used=50000 option so it cannot execute this statement
-test.t1	repair	error	Corrupt
 DROP TABLE t1;



 Comments   
Comment by Sujatha Sivakumar (Inactive) [ 2021-05-19 ]

Post MDEV-22530 fix, admin commands will react to KILL signal.
'maria.repair' script makes use of 'max_session_mem_used' to set a limit on
memory, a single user session is allowed to allocate. During REPAIR command
execution memory is allocated for query, and it fails as memory requirement
exceeds the 'max_session_mem_used' limit. On this error thd->killed is set
to KILL_QUERY. Upon reaching 'mysql_admin_table' code 'thd->is_killed()' is
checked as a first step prior to the execution, if it is set the command
execution is skipped. Hence the above warnings will not be printed.

Comment by Sergei Golubchik [ 2021-05-19 ]

I've pushed a followup commit that makes OPTIMIZE/REPAIR kill handling consistent. Command execution can be skipped or not, depending on where the kill signal was discovered, but now it will always be reported as an error for the table, but not as an error for the whole statement.

Note that MDEV-22530 has one more issue — it's all or nothing and doesn't handle the case when kill signal arrives after optimize of t1 was successfully finished, but before optimize of t2 has started.

Comment by Sergei Golubchik [ 2021-05-19 ]

Note that c699505 is completely wrong, don't push it

Comment by Sujatha Sivakumar (Inactive) [ 2021-05-25 ]

cherry-pick commit: 1fff2398ef3dda1a7e8404f18e4e165823bd4e0a
(MDEV-22530 post push fixes from 10.6.)

Merge conflicts were there from 10.2 to 10.3.
'maria.repair' test needs additional changes to make it stable on valgrind builds.

Please find following patch
10.3 patch: https://github.com/MariaDB/server/commit/299bd87bfe6aff7893fe918245d1d1d713d127ea
10.4 patch: https://github.com/MariaDB/server/commit/04a0d6ddcb3ca203cd15bae9b1a3268f6794620f
10.5 patch: https://github.com/MariaDB/server/commit/a9d5b8bb190b346cd21d880975b2a0d26b7a0110

In 10.6 only 'maria.repair' test changes are required.

https://github.com/MariaDB/server/commit/ee8c99860c54280613b7c6266d47b8501b3ed52c

Generated at Thu Feb 08 09:39:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.