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

wsrep_sst_mariabackup get_footprint() portability and accuracy fix

Details

    Description

      Two issues with the get_footprint() function within the wsrep_sst_mariabackup shell script, both centered on its use of the "du" command to get the size of the files to be transferred:

      1) The --files0-from and --block-size options to du are Linux-specific, and don't work on (for example) BSD systems.

      2) On Linux, it needs the --apparent-size option, or perhaps the --bytes option in place of --block-size. This becomes important if the database is on ZFS with compression enabled – without --apparent-size, it will report the compressed size instead of the uncompressed size. BSD's "du" does the same thing, and there's an -A option there to compensate. This is particularly obvious with files like ibdata1 on a fairly fresh install, as it tends to be full of 0x00 initially.

      I have a preliminary patch for both issues, based on the version in MariaDB 11.4.3, but have not yet tested it.

      If you're impatient, one possible replacement for the du + awk construct on at least FreeBSD is to use xargs + stat + awk:

      xargs -0 stat -f '%z' | awk '

      { sum += $1 }

      END

      { print sum }

      '

      Attachments

        Activity

          bit0mike Mike Andrews added a comment -

          Diffs attached. More testing is needed, though!

          There is one small additional change: $findopts adds -L for FreeBSD also, as that flag does appear to be portable.

          bit0mike Mike Andrews added a comment - Diffs attached. More testing is needed, though! There is one small additional change: $findopts adds -L for FreeBSD also, as that flag does appear to be portable.

          bit0mike Many thanks for the suggested improvements, I have integrated your changes into the main branch. As for the "-LE" option for FreeBSD, it is already taken into account - there the "-E" option is added to the string that already contains "-L".

          sysprg Julius Goryavsky added a comment - bit0mike Many thanks for the suggested improvements, I have integrated your changes into the main branch. As for the "-LE" option for FreeBSD, it is already taken into account - there the "-E" option is added to the string that already contains "-L".
          sysprg Julius Goryavsky added a comment - Fixed, https://github.com/MariaDB/server/commit/3e34e4c161477bd56d0cf2fff377051253500880

          People

            sysprg Julius Goryavsky
            bit0mike Mike Andrews
            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.