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

LP #1582456: Incremental restore in XB 2.4 requires 1+GB of RAM

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      **Reported in Launchpad by Andrey Galkin last update 11-07-2016 13:12:21

      Steps to reproduce:
      -------------------
      S1. Create a low memory VM e.g. <1GB (alternatively, limit with ulimit/cgroup)
      S2. Make sure swap is off
      S3. Create full backup + incremental backup
      S4. Try to restore
      S5. See a failure on incremental:
      ...
      Applying /db/mysql_mysrv1/data.incremental/ibdata1.delta to ./ibdata1...
      InnoDB: Retry attempts for reading partial data failed.
      InnoDB: Tried to read 16384 bytes at offset 0 was only able to read0
      InnoDB: Operating system error number 14 in a file operation.
      InnoDB: Error number 14 means 'Bad address'
      ...

      What is expected:
      -----------------
      W1. Make sure out-of-memory error is properly reported (check malloc() return)
      W2. Use smaller buffer of 64MB as before or even less, do not use UNIV_PAGE_SIZE_MAX in calculations
      W3. Obey --use-memory as much as possible

      Debug results:
      --------------
      D1. xtrabackup.cc:5844 (https://github.com/percona/percona-xtrabackup/blob/2.4/storage/innobase/xtrabackup/src/xtrabackup.cc#L5844)

      ...
      incremental_buffer_base = static_cast<byte *>
      (ut_malloc_nokey((UNIV_PAGE_SIZE_MAX / 4 + 1) *
      UNIV_PAGE_SIZE_MAX));
      incremental_buffer = static_cast<byte *>
      (ut_align(incremental_buffer_base,
      UNIV_PAGE_SIZE_MAX));
      ...

      D2. incremental_buffer_base & incremental_buffer are NOT checked other than for ut_free()

      D3. UNIV_PAGE_SIZE_MAX has changed due to change of UNIV_PAGE_SIZE_SHIFT_MAX from 14 to 16 in rev 717b4b2e

      #define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX)

      D4. Consequences memory usage for the buffer raised from ~64MB to ~1GB

      Attachments

        Activity

          People

            Unassigned Unassigned
            lpjirasync lpjirasync (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Smart Checklist