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

mariadb-install-db fails to install under --old-mode="" causing ("max key length is 2300 bytes")

Details

    Description

      In the official MariaDB container image, the old_mode variable - when set at the command line - behaves inconsistently with a locally-installed version of MariaDB 10.6.11 on the same machine.

      In addition, the command-line argument handling is inconsistent for string-valued flags when setting them to the empty string.

      Environment:

      • Docker client and server: Docker Engine Community, 20.10.21
      • Host: Rocky Linux 8.7 on x64
      • MariaDB version: 10.6.11, installed via RPM or run inside a Docker container.

      docker run --rm -e=MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.6 --old-mode=""

      2022-11-29 11:05:05+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
      2022-11-29 11:05:05+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
      2022-11-29 11:05:05+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
      2022-11-29 11:05:05+00:00 [Note] [Entrypoint]: Initializing database files
      ERROR: 1071  Specified key was too long; max key length is 2300 bytes
      2022-11-29 11:05:05 0 [ERROR] Aborting
       
      Installation of system tables failed!  Examine the logs in
      /var/lib/mysql/ for more information.
       
      The problem could be conflicting information in an external
      my.cnf files. You can ignore these by doing:
       
          shell> /usr/bin/mariadb-install-db --defaults-file=~/.my.cnf
       
      You can also try to start the mysqld daemon with:
       
          shell> /usr/sbin/mariadbd --skip-grant-tables --general-log &
       
      and use the command line tool /usr/bin/mariadb
      to connect to the mysql database and look at the grant tables:
       
          shell> /usr/bin/mysql -u root mysql
          mysql> show tables;
       
      Try 'mysqld --help' if you have problems with paths.  Using
      --general-log gives you a log in /var/lib/mysql/ that may be helpful.
       
      The latest information about mysql_install_db is available at
      https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
      You can find the latest source at https://downloads.mariadb.org and
      the maria-discuss email list at https://launchpad.net/~maria-discuss
       
      Please check all of the above before submitting a bug report
      at https://mariadb.org/jira
      

      docker run --rm -e=MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.6 --old-mode ""

      2022-11-29 11:06:50+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
      2022-11-29 11:06:50+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
      2022-11-29 11:06:50+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
      2022-11-29 11:06:50+00:00 [Note] [Entrypoint]: Initializing database files
      2022-11-29 11:06:50 0 [ERROR] /usr/sbin/mariadbd: Error while setting value '--default-time-zone=SYSTEM' to 'old_mode'
       
      Installation of system tables failed!  Examine the logs in
      /var/lib/mysql/ for more information.
      [...]
      

      Despite the message given, no logs are left in /var/lib/mysql/ inside the container.

      The behaviour changes when the /var/lib/mysql directory is set as a mount inside the container. The first run fails with the "2300 bytes" error, while the second run with the same volume mounted succeeds. (e.g. docker run --mount=type=volume,source=mariadb-test,destination=/var/lib/mysql --rm -e=MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.6 --old-mode="")

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            Producable without containers:

            $ mkdir -p /tmp/${PWD##*/}-datadir && scripts/mysql_install_db --no-defaults --srcdir=$OLDPWD --builddir=$PWD --datadir=/tmp/${PWD##*/}-datadir --verbose --old-mode=
            Installing MariaDB/MySQL system tables in '/tmp/build-mariadb-server-10.6-datadir' ...
            2022-11-30 11:26:35 0 [Note] /home/dan/repos/build-mariadb-server-10.6/sql/mysqld (server 10.6.12-MariaDB) starting as process 383074 ...
            2022-11-30 11:26:35 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
            2022-11-30 11:26:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
            2022-11-30 11:26:35 0 [Note] InnoDB: Number of pools: 1
            2022-11-30 11:26:35 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
            2022-11-30 11:26:35 0 [Note] InnoDB: Using liburing
            2022-11-30 11:26:35 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
            2022-11-30 11:26:35 0 [Note] InnoDB: Completed initialization of buffer pool
            2022-11-30 11:26:35 0 [Note] InnoDB: Setting O_DIRECT on file ./ibdata1 failed
            2022-11-30 11:26:35 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ...
            2022-11-30 11:26:35 0 [Note] InnoDB: File './ibdata1' size is now 12 MB.
            2022-11-30 11:26:35 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100663296 bytes
            2022-11-30 11:26:35 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
            2022-11-30 11:26:35 0 [Note] InnoDB: New log file created, LSN=10313
            2022-11-30 11:26:35 0 [Note] InnoDB: Doublewrite buffer not found: creating new
            2022-11-30 11:26:35 0 [Note] InnoDB: Doublewrite buffer created
            2022-11-30 11:26:35 0 [Note] InnoDB: 128 rollback segments are active.
            2022-11-30 11:26:35 0 [Note] InnoDB: Creating shared tablespace for temporary tables
            2022-11-30 11:26:35 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
            2022-11-30 11:26:35 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
            2022-11-30 11:26:35 0 [Note] InnoDB: 10.6.12 started; log sequence number 0; transaction id 3
            2022-11-30 11:26:35 0 [Note] CONNECT: Version 1.07.0002 March 22, 2021
            ERROR: 1071  Specified key was too long; max key length is 2300 bytes
            

            danblack Daniel Black added a comment - Producable without containers: $ mkdir -p /tmp/${PWD##*/}-datadir && scripts/mysql_install_db --no-defaults --srcdir=$OLDPWD --builddir=$PWD --datadir=/tmp/${PWD##*/}-datadir --verbose --old-mode= Installing MariaDB/MySQL system tables in '/tmp/build-mariadb-server-10.6-datadir' ... 2022-11-30 11:26:35 0 [Note] /home/dan/repos/build-mariadb-server-10.6/sql/mysqld (server 10.6.12-MariaDB) starting as process 383074 ... 2022-11-30 11:26:35 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created! 2022-11-30 11:26:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2022-11-30 11:26:35 0 [Note] InnoDB: Number of pools: 1 2022-11-30 11:26:35 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions 2022-11-30 11:26:35 0 [Note] InnoDB: Using liburing 2022-11-30 11:26:35 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728 2022-11-30 11:26:35 0 [Note] InnoDB: Completed initialization of buffer pool 2022-11-30 11:26:35 0 [Note] InnoDB: Setting O_DIRECT on file ./ibdata1 failed 2022-11-30 11:26:35 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ... 2022-11-30 11:26:35 0 [Note] InnoDB: File './ibdata1' size is now 12 MB. 2022-11-30 11:26:35 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100663296 bytes 2022-11-30 11:26:35 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2022-11-30 11:26:35 0 [Note] InnoDB: New log file created, LSN=10313 2022-11-30 11:26:35 0 [Note] InnoDB: Doublewrite buffer not found: creating new 2022-11-30 11:26:35 0 [Note] InnoDB: Doublewrite buffer created 2022-11-30 11:26:35 0 [Note] InnoDB: 128 rollback segments are active. 2022-11-30 11:26:35 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2022-11-30 11:26:35 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2022-11-30 11:26:35 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2022-11-30 11:26:35 0 [Note] InnoDB: 10.6.12 started; log sequence number 0; transaction id 3 2022-11-30 11:26:35 0 [Note] CONNECT: Version 1.07.0002 March 22, 2021 ERROR: 1071 Specified key was too long; max key length is 2300 bytes
            danblack Daniel Black added a comment -

            seang Do you want a re-release of MariaDB containers to support the --old-mode=""? It will just be enforcing the default old value on mariadb-install-db.

            danblack Daniel Black added a comment - seang Do you want a re-release of MariaDB containers to support the --old-mode="" ? It will just be enforcing the default old value on mariadb-install-db .
            danblack Daniel Black added a comment -

            So tables that old-mode="" prevent creating:

            • column_stats
            • proxies_priv

            Server differences detected:

            2022-11-30 13:40:45 4 [Warning] InnoDB: Table mysql.innodb_index_stats has length mismatch in the column name stat_description. Please run mariadb-upgrade
            2022-11-30 13:40:45 4 [ERROR] Incorrect definition of table mysql.proc: expected the type of column 'db' at position 0 to have character set 'utf8mb3' but found character set 'utf8mb4'.
            2022-11-30 13:40:45 4 [Warning] InnoDB: Table mysql.innodb_table_stats has length mismatch in the column name database_name. Please run mariadb-upgrade
            2022-11-30 13:40:45 4 [ERROR] Incorrect definition of table mysql.event: expected the type of column 'db' at position 0 to have character set 'utf8mb3' but found character set 'utf8mb4'.
            

            danblack Daniel Black added a comment - So tables that old-mode="" prevent creating: column_stats proxies_priv Server differences detected: 2022-11-30 13:40:45 4 [Warning] InnoDB: Table mysql.innodb_index_stats has length mismatch in the column name stat_description. Please run mariadb-upgrade 2022-11-30 13:40:45 4 [ERROR] Incorrect definition of table mysql.proc: expected the type of column 'db' at position 0 to have character set 'utf8mb3' but found character set 'utf8mb4'. 2022-11-30 13:40:45 4 [Warning] InnoDB: Table mysql.innodb_table_stats has length mismatch in the column name database_name. Please run mariadb-upgrade 2022-11-30 13:40:45 4 [ERROR] Incorrect definition of table mysql.event: expected the type of column 'db' at position 0 to have character set 'utf8mb3' but found character set 'utf8mb4'.
            danblack Daniel Black added a comment -

            https://github.com/MariaDB/mariadb-docker/pull/479 prepared for release if you want it.

            danblack Daniel Black added a comment - https://github.com/MariaDB/mariadb-docker/pull/479 prepared for release if you want it.
            seang Sean Gebbett added a comment -

            Hi Daniel - thanks so much for looking at this so quickly!

            If you could release those changes that'd be wonderful, as this issue is preventing us properly testing a migration to utf8mb4 at the day job.

            seang Sean Gebbett added a comment - Hi Daniel - thanks so much for looking at this so quickly! If you could release those changes that'd be wonderful, as this issue is preventing us properly testing a migration to utf8mb4 at the day job.
            danblack Daniel Black added a comment -

            Ok, new container has been released:

            10.6 (aac2cf878de9)

            $ docker run --rm -e=MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.6 --old-mode=""
            2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
            2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
            2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started.
            2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Initializing database files
            ....
            2022-11-30 23:42:08 0 [Note] mariadbd: ready for connections.
            Version: '10.6.11-MariaDB-1:10.6.11+maria~ubu2004'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
            

            danblack Daniel Black added a comment - Ok, new container has been released: 10.6 (aac2cf878de9) $ docker run --rm -e=MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.6 --old-mode="" 2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started. 2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.11+maria~ubu2004 started. 2022-11-30 23:42:03+00:00 [Note] [Entrypoint]: Initializing database files .... 2022-11-30 23:42:08 0 [Note] mariadbd: ready for connections. Version: '10.6.11-MariaDB-1:10.6.11+maria~ubu2004' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
            seang Sean Gebbett added a comment -

            That's all working perfectly on my end too. Thanks again - I'm happy for this issue to be marked as resolved.

            seang Sean Gebbett added a comment - That's all working perfectly on my end too. Thanks again - I'm happy for this issue to be marked as resolved.
            danblack Daniel Black added a comment -

            This still needs to be fixed for the non-container case. After which the container work around won't been needed. Thanks for reporting and glad I could get you moving along.

            danblack Daniel Black added a comment - This still needs to be fixed for the non-container case. After which the container work around won't been needed. Thanks for reporting and glad I could get you moving along.

            People

              Unassigned Unassigned
              seang Sean Gebbett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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