running mariadb-upgrade on mariadb server with other user make it hangs forever (MDEV-27068)

[MDEV-27279] mariadb_upgrade add --check-if-upgrade-is-needed / restrict tests to major version Created: 2021-12-15  Updated: 2023-10-23  Resolved: 2022-01-20

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.2
Fix Version/s: 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2, 10.5.15

Type: Technical task Priority: Major
Reporter: Daniel Black Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-27068 running mariadb-upgrade on mariadb se... Closed
Problem/Incident
causes MDEV-27636 mariadb_upgrade --check-if-upgrade-is... Open
causes MDEV-28209 New mysql_upgrade message on minor-on... Open
Relates
relates to MDEV-30499 mariadb in-server upgrade Open

 Comments   
Comment by Faustin Lammler [ 2021-12-22 ]

Quoting: https://jira.mariadb.org/browse/MDEV-27068?focusedCommentId=208358

  • Add option '--check-if-upgrade-is-needed' to maria_upgrade the returns 0 or 1
    to the operating system (trough exit call) if a full maria_upgrade should be
    run.
  • Now we only check if the last run was done with the same MariaDB version as
    last time. Change the check so that we check if the major version has changed
    (10.1.xxx -> 10.2.xxx). Change the error message from: default one: "This
    installation of MariaDB is already upgraded to 10.7.2-MariaDB, use --force if
    you still need to run mysql_upgrade" to "This installation of MariaDB is
    already upgraded to 10.7, use --force if you still need to run mysql_upgrade"

When coding this, take into account that there is a small change that we
in the future may need to run mysql_upgrade for a minor version. We
should have a function that check the version against a minor version
(by default current_major_version.99, like 10.6.99) and if the internal
version is smaller, then we still need to run upgrade.

  • mysql_upgrade creates a 'mysql_upgrade_info' file in the data directory.
    When mysql_upgrade is started, take an advisory lock on the file
    (create it if it does not exists). This ensures we cannot have two
    mysql_upgrade run at the same time.

Future work:

  • Find out why why running two mysql_upgrade in parllel causes lockups.
    If we can identify this and fix it, things will be much better as
    there is a chance that mysql_upgrade will now lock also for other cases
    than just another mysql_upgrade running.
  • To make maria_upgrade faster, we should consider adding multiple thread
    support to mysql_check_table and run multiple check table & alter table in
    parallel. This should speed up mysql_upgrade for major version upgrades
    notable (in proportional to the number of CPU's in the system).
Generated at Thu Feb 08 09:51:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.