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

[PATCH] Innodb in Mariadb-10.1.x is unable to start up with data files generated by older version

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.21
    • Environment:
    • Sprint:
      10.1.13

      Description

      The procedure to reproduce the issue as below, and analysis follows.

      1. Build and start up mariadb-10.0.10 to create a table with innodb storage engine, and insert some rows into it. Note that in my.cnf, set innodb-page-size to 4k.

      2. shutdown mysqld and keep the data directory intact.
      3. build and start up maraidb-10.1.9(the version I am using) and start up mysqld, using exactly the same my.cnf file and data directory as above.

      4. mysqld fails to startup with below error in mysqld.err:

      InnoDB: Error: Current page size 4096 !=  page size on page 16384
      2016-02-16 17:20:39 140521425086336 [ERROR] InnoDB: innodb-page-size mismatch in data file /my/data/dir/ibdata1
      2016-02-16 17:20:39 140521425086336 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf     back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contai    n your precious data!
      2016-02-16 17:20:39 140521425086336 [ERROR] Plugin 'InnoDB' init function returned error.
      2016-02-16 17:20:39 140521425086336 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      2016-02-16 17:20:39 140521425086336 [Note] Plugin 'FEEDBACK' is disabled.
      2016-02-16 17:20:39 140521425086336 [ERROR] Unknown/unsupported storage engine: innodb
      2016-02-16 17:20:39 140521425086336 [ERROR] Aborting
      

      The cause is that the newly added tablespace flags is wrongly placed: the PAGE_COMPRESSION, PAGE_COMPRESSION_LEVEL and ATOMIC_WRITES flags added in 10.1.x occupies the position of PAGE_SIZE, pushing PAGE_SIZE behind, so when new version mysqld reads the tablespace flags of old data file, the PAGE_SIZE is read as 0, so innodb thinks the default 16k is used, but UNIV_PAGE_SIZE is 4k as specified by my.cnf, hence the error.

      I have made a fix, please review. The patch passes all tests in mysql-test.

      I saw in latest release (mariadb-10.1.11) the relevant code keeps the same so the issue most probably exist in it too.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ratzpo Rasmus Johansson
                Reporter:
                DZW David Zhao
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: