MariaDB Development
  1. MariaDB Development
  2. MDEV-628

LP:989055 - Querying myisam table metadata may corrupt the table

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.30
    • Labels:
    • Global Rank:
      1973

      Description

      This is related to bug lp:925377, but confirmed on the 5.3.6 release.

      Jervin R (viiin) wrote a reproducer which I have attached (myisam_crash.rb) and confirm causes the corrupt table message. We're seeing corrupt tables on our live databases as well.

      This bug appears to be present still on 5.3.6 - possibly not during ENABLE|DISABLE keys but immediately before drop. see my.cnf below and Ruby script for test case.

      [mysqld]
      basedir=/home/revin/Downloads/mariadb-5.3.6-Linux-x86_64/
      datadir=/var/lib/mysql
      socket=/var/lib/mysql/mysql.sock
      user=revin
      # Disabling symbolic-links is recommended to prevent assorted security risks
      symbolic-links=0
      
      collation_server = utf8_unicode_ci
      character_set_server = utf8
      skip-external-locking
      #fast_index_creation = false
      
      # 10MB ramdisk - can be ignored
      tmpdir = /tmpfs
      
      key_buffer = 276M
      innodb_buffer_pool_size = 276M
      max_allowed_packet = 16M
      thread_stack = 256K
      thread_cache_size = 128
      thread_concurrency = 8
      max_connections = 512
      table_cache = 2048
      myisam-recover = BACKUP
      query_cache_limit = 1M
      query_cache_size = 128M
      expire_logs_days = 10
      max_binlog_size = 100M
      
      [mysqld_safe]
      log-error=/var/log/mysqld.log
      pid-file=/var/run/mysqld/mysqld.pid
      

      Produces the output:
      120426 11:32:39 [ERROR] mysqld: Table './test/customerXX' is marked as crashed and should be repaired

      1. LPexportBug989055_myisam_crash.rb
        2 kB
        Rasmus Johansson
      2. LPexportBug989055.xml
        12 kB
        Rasmus Johansson

        Activity

        Hide
        Rasmus Johansson added a comment -

        Launchpad bug id: 989055

        Show
        Rasmus Johansson added a comment - Launchpad bug id: 989055
        Hide
        Michael Widenius added a comment -

        The problem was that ALTER TABLE ENABLE KEYS was not protecting against SHOW COMMANDS that opening the table.
        The same goes for REPAIR and OPTIMIZE TABLE.
        All of the above commands assumes (at least for MyISAM and Aria) that no one will access the storage engine handler until the repair has been done.

        I am now testing a fix that should solve this issue by having SHOW commands wait for an alter table or repair to finish.

        Show
        Michael Widenius added a comment - The problem was that ALTER TABLE ENABLE KEYS was not protecting against SHOW COMMANDS that opening the table. The same goes for REPAIR and OPTIMIZE TABLE. All of the above commands assumes (at least for MyISAM and Aria) that no one will access the storage engine handler until the repair has been done. I am now testing a fix that should solve this issue by having SHOW commands wait for an alter table or repair to finish.
        Hide
        Michael Widenius added a comment -

        Fixed and pushed into 5.5 tree

        Show
        Michael Widenius added a comment - Fixed and pushed into 5.5 tree
        Hide
        Elena Stepanova added a comment -

        Reopening for a moment to modify the 'Fix version' field

        Show
        Elena Stepanova added a comment - Reopening for a moment to modify the 'Fix version' field
        Hide
        Elena Stepanova added a comment -

        Since the fix was only pushed into 5.5, I removed 5.1/5.2/5.3 from 'Fix version'

        Show
        Elena Stepanova added a comment - Since the fix was only pushed into 5.5, I removed 5.1/5.2/5.3 from 'Fix version'

          People

          • Assignee:
            Unassigned
            Reporter:
            Jason Parrott
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: