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

[Note] InnoDB: Resetting invalid page [page id: space=5, page number=3] type 17855 to 6.

Details

    Description

      SET sql_mode='',foreign_key_checks=0,unique_checks=0;
      SET GLOBAL innodb_checksum_algorithm=CRC32;
      SET SESSION AUTOCOMMIT=OFF;
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      INSERT INTO t (c) VALUES (0);
      

      Leads to (error log):

      10.7.0 57f14eab20ae2733eb341f3d293515a10a40bc48 (Debug)

      2021-07-09 19:47:31 4 [Note] InnoDB: Resetting invalid page [page id: space=5, page number=3] type 17855 to 6.
      

      Happens on debug+optimized. 10.6/7 Only.

      Attachments

        Issue Links

          Activity

            SET sql_mode= '';
            SET unique_checks=0;
            SET GLOBAL innodb_checksum_algorithm=strict_CRC32;
            CREATE TABLE t (c DOUBLE KEY,c2 BINARY (1),c3 TIMESTAMP);
            SET foreign_key_checks=0;
            INSERT INTO t VALUES ('','',''),('','','');
            

            Leads to:

            10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Debug)

            10.7.0-dbg>INSERT INTO t VALUES ('','',''),('','','');
            ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
            

            And:

            10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Debug)

            2021-08-21 10:15:09 4 [Note] InnoDB: Resetting invalid page [page id: space=5, page number=3] type 17855 to 6.
            

            Roel Roel Van de Paar added a comment - SET sql_mode= '' ; SET unique_checks=0; SET GLOBAL innodb_checksum_algorithm=strict_CRC32; CREATE TABLE t (c DOUBLE KEY ,c2 BINARY (1),c3 TIMESTAMP ); SET foreign_key_checks=0; INSERT INTO t VALUES ( '' , '' , '' ),( '' , '' , '' ); Leads to: 10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Debug) 10.7.0-dbg>INSERT INTO t VALUES ('','',''),('','',''); ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY' And: 10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Debug) 2021-08-21 10:15:09 4 [Note] InnoDB: Resetting invalid page [page id: space=5, page number=3] type 17855 to 6.

            I am unable to repeat this. What is the call stack of fil_block_reset_type()? You can add a breakpoint or an abort() to the start of the function.

            marko Marko Mäkelä added a comment - I am unable to repeat this. What is the call stack of fil_block_reset_type() ? You can add a breakpoint or an abort() to the start of the function.

            As far as I understand, only a call to fil_block_check_type() with the parameter FIL_PAGE_TYPE_SYS should be able to produce such messages. There are a few such calls on database startup, but only for the InnoDB system tablespace.

            marko Marko Mäkelä added a comment - As far as I understand, only a call to fil_block_check_type() with the parameter FIL_PAGE_TYPE_SYS should be able to produce such messages. There are a few such calls on database startup, but only for the InnoDB system tablespace.

            The stack trace definitely points to MDEV-515. The problem happens on the rollback of client disconnect. It was not obvious to me in the description that the client has to be disconnected. A minimal mtr test case (with explicit ROLLBACK instead of an implicit one on disconnect) would have been much more obvious. I can repeat this with the following change to an existing test case:

            diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
            index 8b885cb5b4f..e903b819928 100644
            --- a/mysql-test/suite/innodb/t/insert_into_empty.test
            +++ b/mysql-test/suite/innodb/t/insert_into_empty.test
            @@ -193,3 +193,16 @@ CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2;
             INSERT INTO t VALUES (0);
             INSERT INTO t VALUES (1),(0),(1);
             DROP TABLE t;
            +
            +--echo #
            +--echo # MDEV-26121 Resetting invalid page [... 3] type 17855 to 6
            +--echo #
            +SET @save_checksum_algorithm= @@GLOBAL.innodb_checksum_algorithm;
            +SET GLOBAL innodb_checksum_algorithm=crc32;
            +CREATE TABLE t(i INT) ENGINE=InnoDB;
            +BEGIN;
            +INSERT INTO t VALUES(0);
            +ROLLBACK;
            +DROP TABLE t;
            +
            +--echo # End of 10.6 tests
            diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
            index ac70923b446..8d4b8f5226b 100644
            --- a/storage/innobase/fsp/fsp0fsp.cc
            +++ b/storage/innobase/fsp/fsp0fsp.cc
            @@ -785,7 +785,7 @@ Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
             ATTRIBUTE_COLD
             void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr)
             {
            -	ib::info()
            +	ib::warn()
             		<< "Resetting invalid page " << block.page.id() << " type "
             		<< fil_page_get_type(block.frame) << " to " << type << ".";
             	mtr->write<2>(block, block.frame + FIL_PAGE_TYPE, type);
            

            innodb.insert_into_empty 'debug,innodb'  [ fail ]  Found warnings/errors in server log file!
                    Test ended at 2021-11-04 10:00:56
            line
            2021-11-04 10:00:56 4 [Warning] InnoDB: Resetting invalid page [page id: space=17, page number=3] type 17855 to 6.
            

            I think that the message indeed can be promoted to a warning.

            Also the test case variant with a duplicate key error during a multi-row INSERT is executing rollback and issuing the message there.

            marko Marko Mäkelä added a comment - The stack trace definitely points to MDEV-515 . The problem happens on the rollback of client disconnect. It was not obvious to me in the description that the client has to be disconnected. A minimal mtr test case (with explicit ROLLBACK instead of an implicit one on disconnect) would have been much more obvious. I can repeat this with the following change to an existing test case: diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 8b885cb5b4f..e903b819928 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -193,3 +193,16 @@ CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2; INSERT INTO t VALUES (0); INSERT INTO t VALUES (1),(0),(1); DROP TABLE t; + +--echo # +--echo # MDEV-26121 Resetting invalid page [... 3] type 17855 to 6 +--echo # +SET @save_checksum_algorithm= @@GLOBAL.innodb_checksum_algorithm; +SET GLOBAL innodb_checksum_algorithm=crc32; +CREATE TABLE t(i INT) ENGINE=InnoDB; +BEGIN; +INSERT INTO t VALUES(0); +ROLLBACK; +DROP TABLE t; + +--echo # End of 10.6 tests diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index ac70923b446..8d4b8f5226b 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -785,7 +785,7 @@ Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. ATTRIBUTE_COLD void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr) { - ib::info() + ib::warn() << "Resetting invalid page " << block.page.id() << " type " << fil_page_get_type(block.frame) << " to " << type << "."; mtr->write<2>(block, block.frame + FIL_PAGE_TYPE, type); innodb.insert_into_empty 'debug,innodb' [ fail ] Found warnings/errors in server log file! Test ended at 2021-11-04 10:00:56 line 2021-11-04 10:00:56 4 [Warning] InnoDB: Resetting invalid page [page id: space=17, page number=3] type 17855 to 6. I think that the message indeed can be promoted to a warning. Also the test case variant with a duplicate key error during a multi-row INSERT is executing rollback and issuing the message there.

            In dict_index_t::clear(), InnoDB frees all the page except root page.
            root page leaf segment has reset and does reinitialize again.

            mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
                           FSEG_HEADER_SIZE, 0);
                if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false,
                                root_block))
            

            But in fseg_create(), we do have the assumption that only {{FIL_PAGE_TYPE_TRX_SYS or FIL_PAGE_TYPE_TRX_SYS}}page should
            be re-created for non-full-crc32 format. IIUC, this assumption is wrong in case of rollback of bulk insert operation.

            thiru Thirunarayanan Balathandayuthapani added a comment - In dict_index_t::clear() , InnoDB frees all the page except root page. root page leaf segment has reset and does reinitialize again. mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF, FSEG_HEADER_SIZE, 0); if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false, root_block)) But in fseg_create() , we do have the assumption that only {{FIL_PAGE_TYPE_TRX_SYS or FIL_PAGE_TYPE_TRX_SYS}}page should be re-created for non-full-crc32 format. IIUC, this assumption is wrong in case of rollback of bulk insert operation.

            People

              thiru Thirunarayanan Balathandayuthapani
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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