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

Auto-repair doesn't work under LOCK TABLES

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5
    • Locking, Server
    • None
    • 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

            midenok Aleksey Midenkov created issue -
            midenok Aleksey Midenkov made changes -
            Field Original Value New Value
            Description h3. Reproduce
            Patch myisam_recover.test and run
            {code:diff}
            --- 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;
            {code}
            h3. Reproduce
            Patch *myisam_recover.test* and run
            {code:diff}
            --- 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;
            {code}

            h3. Result
            {code:diff}
            --- /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;
            {code}

            As we see auto-repair moved from original SELECT to the next one executed after table is unlocked.
            midenok Aleksey Midenkov made changes -
            Attachment u.diff [ 51324 ]
            midenok Aleksey Midenkov made changes -
            Attachment u.diff [ 51324 ]
            midenok Aleksey Midenkov made changes -
            Attachment u.diff [ 51325 ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 107388 ] MariaDB v4 [ 141896 ]
            midenok Aleksey Midenkov made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.2 [ 14601 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.3 [ 22126 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.4 [ 22408 ]
            midenok Aleksey Midenkov made changes -
            Priority Major [ 3 ] Minor [ 4 ]

            People

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

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.