Uploaded image for project: 'Percona XtraBackup'
  1. Percona XtraBackup
  2. PXB-1870

xtrabackup prepare get stuck if ib_sdi_get return DB_OUT_OF_MEMORY

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 8.0.6
    • Fix Version/s: 8.0.7
    • Component/s: None
    • Labels:
      None

      Description

      xtrabackup --prepare will get stuck in this stack
      ```
      #0 ib_sdi_get()
      #1 dict_load_tables_from_space_id()
      #2 dict_load_from_spaces_sdi ()
      #3 innodb_init()
      #4 xtrabackup_prepare_func()
      #5 main()
      ```
      when ib_sdi_get return DB_OUT_OF_MEMORY.

      How to reproduce:

      1. create table table as

      CREATE TABLE `user` (
        `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
        `cid` int(11) NOT NULL DEFAULT '0',
        `uid` int(11) NOT NULL DEFAULT '0',
        `gold` int(11) NOT NULL DEFAULT '0',
        `coin` int(11) NOT NULL DEFAULT '0',
        `price` int(11) NOT NULL DEFAULT '0',
        `time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
        `type` int(11) NOT NULL DEFAULT '0',
        `chapterid` int(11) NOT NULL DEFAULT '0',
        `platformid` int(11) NOT NULL,
        `productlineid` int(11) NOT NULL,
        PRIMARY KEY (`id`,`uid`)
      ) ENGINE=InnoDB
      /*!50100 PARTITION BY HASH (`uid`) 
      PARTITIONS 3000 */;
      

      2. use xtrabackup 8.0 backup and prepare

      Suggest fix:

      diff --git a/storage/innobase/xtrabackup/src/xtrabackup.cc b/storage/innobase/xtrabackup/src/xtrabackup.cc
      index ac81b5ede70..61dd1af08c1 100644
      --- a/storage/innobase/xtrabackup/src/xtrabackup.cc
      +++ b/storage/innobase/xtrabackup/src/xtrabackup.cc
      @@ -2134,8 +2134,9 @@ dberr_t dict_load_tables_from_space_id(space_id_t space_id, THD *thd,
             err = ib_sdi_get(space_id, &ib_key, compressed_sdi, &compressed_sdi_len,
                              &uncompressed_sdi_len, trx);
             if (err == DB_OUT_OF_MEMORY) {
      -        compressed_buf_len = compressed_sdi_len;
      -        uncompressed_buf_len = uncompressed_sdi_len;
      +        compressed_sdi_len = uncompressed_sdi_len;
      +        compressed_buf_len = compressed_sdi_len + 1;
      +        uncompressed_buf_len = uncompressed_sdi_len + 1;
               compressed_sdi =
                   static_cast<byte *>(ut_realloc(compressed_sdi, compressed_buf_len));
               sdi = static_cast<byte *>(ut_realloc(sdi, uncompressed_buf_len));
      

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sergei.glushchenko Sergei Glushchenko (Inactive)
                Reporter:
                fungo Fungo Wang
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 2 hours, 30 minutes
                    2h 30m