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

mariadbd-multi does not start a server when an overridden datadir= of its group cannot be created

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      mariadbd-multi start checks every datadir= of a server group, not only the last one, which is the one the server uses. In the test case below, [mysqld2] is written twice in one option file: the first sets a datadir= that cannot be created, the second a valid one. mariadbd-multi stops with FATAL ERROR: Cannot create data directory on the first one, and the server is not started

      Test case

      BASEDIR=/test/MD301026-mariadb-13.2.0-linux-x86_64-opt
      TMPDIR=/tmp/testdir   
      export HOME=$TMPDIR PATH=$BASEDIR/bin:$PATH
      unset MYSQL_HOME MARIADB_HOME
      mkdir -p $TMPDIR/itmp $TMPDIR/ro
      $BASEDIR/scripts/mariadb-install-db --no-defaults --basedir=$BASEDIR --datadir=$TMPDIR/d2 --tmpdir=$TMPDIR/itmp --auth-root-authentication-method=normal >/dev/null 2>&1
      chmod 555 $TMPDIR/ro                     # a datadir location the user cannot write to
      cat > $TMPDIR/multi.cnf <<EOC
      [mysqld_multi]
      mysqld=$BASEDIR/bin/mariadbd
      mysqladmin=$BASEDIR/bin/mariadb-admin
      user=root
      [mysqld2]
      datadir=$TMPDIR/ro/data2
      [mysqld2]
      datadir=$TMPDIR/d2
      socket=$TMPDIR/s2
      pid-file=$TMPDIR/p2
      log-error=$TMPDIR/e2.err
      skip-networking
      EOC
       
      mariadbd-multi --defaults-file=$TMPDIR/multi.cnf --no-log --silent start 2; echo "exit code: $?"; sleep 5
      [ -e $TMPDIR/p2 ] && echo "p2: server running" || echo "p2: no server"
       
      # Cleanup
      mariadb-admin --no-defaults -uroot --socket=$TMPDIR/s2 shutdown >/dev/null 2>&1; sleep 3; chmod 755 $TMPDIR/ro;
      rm -rf $TMPDIR
       
      

      Script output:

      mariadbd-multi log file version 3.0; run: Wed Nov 11 07:44:55 2026
       
      Starting MariaDB servers
      FATAL ERROR: Cannot create data directory /tmp/testdir/ro/data2: Permission denied
      exit code: 1
      p2: no server
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5h
                0.5h

                Git Integration

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