[MDEV-22292] Auto-repair doesn't work under LOCK TABLES Created: 2020-04-18  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Locking, Server
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Patched myisam_recover.test (attached patch u.diff)


Attachments: File u.diff    
Issue Links:
Blocks
blocks MDEV-23639 Auto-create does not work under LOCK ... Closed
Duplicate
is duplicated by MDEV-23639 Auto-create does not work under LOCK ... Closed
Relates
relates to MDEV-15939 Locked_tables_list::reopen_tables is ... Open

 Description   

Reproduce

Patch myisam_recover.test and run

--- a/mysql-test/t/myisam_recover.test
+++ b/mysql-test/t/myisam_recover.test
@@ -88,6 +88,8 @@ flush table t1;
 --remove_file $MYSQLD_DATADIR/test/t1.MYI
 --copy_file $MYSQLD_DATADIR/test/t1_copy.MYI $MYSQLD_DATADIR/test/t1.MYI
 --remove_file $MYSQLD_DATADIR/test/t1_copy.MYI
+lock tables t1 write, t1_mrg write;
+flush table t1;
 --echo # check table is needed to mark the table as crashed.
 check table t1;
 --echo #
@@ -100,6 +102,8 @@ select * from t1_mrg;
 --echo #
 --echo # Cleanup
 --echo #
+unlock tables;
+select * from t1_mrg;
 drop table t1, t1_mrg;
 connection con1;
 unlock tables;

Result

--- /home/midenok/src/mariadb/10.2/src/mysql-test/r/myisam_recover.result       2019-11-07 10:25:52.814204742 +0300
+++ /home/midenok/src/mariadb/10.2/src/mysql-test/r/myisam_recover.reject       2020-04-18 18:38:52.040652191 +0300
@@ -66,6 +66,8 @@
 flush table t1;
 insert into  t1 (a) values (4), (5), (6);
 flush table t1;
+lock tables t1 write, t1_mrg write;
+flush table t1;
 # check table is needed to mark the table as crashed.
 check table t1;
 Table  Op      Msg_type        Msg_text
@@ -86,13 +88,22 @@
 4
 5
 6
-Warnings:
-Error  145     Table 't1' is marked as crashed and should be repaired
-Error  1194    Table 't1' is marked as crashed and should be repaired
-Error  1034    Number of rows changed from 3 to 6
 #
 # Cleanup
 #
+unlock tables;
+select * from t1_mrg;
+a
+1
+2
+3
+4
+5
+6
+Warnings:
+Error  145     Table './test/t1' is marked as crashed and should be repaired
+Error  1194    Table 't1' is marked as crashed and should be repaired
+Error  1034    Number of rows changed from 3 to 6
 drop table t1, t1_mrg;
 connection con1;
 unlock tables;

As we see auto-repair moved from original SELECT to the next one executed after table is unlocked.


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