Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22292

Auto-repair doesn't work under LOCK TABLES

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2, 10.3, 10.4, 10.5
    • Fix Version/s: 10.2, 10.3, 10.4, 10.5
    • Component/s: Locking, Server
    • Labels:
      None
    • Environment:
      Patched myisam_recover.test (attached patch u.diff)

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: