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

Debian postinstall chown or the datadir takes too long on servers with many files on the datadir

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 5.5.46, 10.0.22, 10.1.8
    • 10.2.3
    • Platform Debian
    • None
    • Debian

    Description

      I recently experienced a slow MariaDB upgrade/migration from MySQL 5.5 to MariaDB 5.5, after the server has been stopped it took maybe one or two minutes before starting the new one.

      A process doing a "chown mysql -R /var/lib/mysql" was runing for quite a long time.
      This particular server has about 350000 files on its datadir, while its far from being the best practice its not easy to change that (its a shared hosting server).

      Replacing the line on "mariadb-server-*.postinst" :

      chown -R mysql $mysql_datadir

      With something like (there is probably a better alternative) :

      find /var/lib/mysql/ ! -uid $(id -u mysql) -print0 |xargs -0 -r chown mysql

      It seems to be marginally slower (less than 1/100th of a second on my tests) on small directories but faster on directories with many files on it (about 20-40% faster on a directory with only 25k files on a software raid1 with 2* 7200k HDDs).

      Attachments

        Activity

          People

            otto Otto Kekäläinen
            jb-boin Jean Weisbuch
            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.