Skip to content

MDEV-39675 mariadb_upgrade utility failed when path=nonexist#5106

Open
grooverdan wants to merge 1 commit into
MariaDB:12.3from
grooverdan:MDEV-39675
Open

MDEV-39675 mariadb_upgrade utility failed when path=nonexist#5106
grooverdan wants to merge 1 commit into
MariaDB:12.3from
grooverdan:MDEV-39675

Conversation

@grooverdan
Copy link
Copy Markdown
Member

The upgrade SQL assumes the functions will resolve.

With a non-default path this isn't true and results in:

ERROR 1305 (42000) at line 3211: FUNCTION extract_schema_from_file_name does not exist

Resolve by setting PATH = 'CURRENT_SCHEMA' for the upgrade.

Idea thanks to Sergei Golubchik

The upgrade SQL assumes the functions will resolve.

With a non-default path this isn't true and results in:

ERROR 1305 (42000) at line 3211: FUNCTION extract_schema_from_file_name does not exist

Resolve by setting PATH = 'CURRENT_SCHEMA' for the upgrade.

Idea thanks to Sergei Golubchik
@grooverdan grooverdan requested a review from vuvova May 21, 2026 08:48
@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label May 21, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses MDEV-39675 by ensuring the mariadb_upgrade utility handles non-existent paths correctly. It introduces a regression test and updates the system tables fix script. Reviewer feedback suggests using the assignment operator for consistency in SQL statements and fixing a typo in the test case.

set alter_algorithm='DEFAULT';
set use_stat_tables='NEVER';

set path 'CURRENT_SCHEMA';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the preceding lines in this script (lines 30-32), it is recommended to use the assignment operator = when setting the path variable. While SET PATH '...' is a valid statement syntax in MariaDB, using set path='...'; aligns better with the existing style of the file where system variables are assigned using the = operator.

set path='CURRENT_SCHEMA';
References
  1. Use the assignment operator = for system variables to maintain consistency with the existing style of the file. (link)

--echo #

set @old_path=@@global.path;
set global path='non-existant';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a minor typo in the string 'non-existant'. It should be 'non-existent'. Although this is a test value, correcting it improves the overall quality of the test suite. Note that the corresponding .result file should also be updated to avoid a test failure.

set global path='non-existent';

# MDEV-39675 mariadb_upgrade utility failed when path=nonexist
#
set @old_path=@@global.path;
set global path='non-existant';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Correcting the typo 'non-existant' to 'non-existent' to maintain consistency with the suggested change in the .test file.

set global path='non-existent';

@gengtianuiowa
Copy link
Copy Markdown
Contributor

I have one concern for adding set path 'CURRENT_SCHEMA';.

Is there any use case when users use mariadb_upgrade from 12.3+ to upgrade a server below 12.3?

In this case, PATH variable won't exist in the server. This line will fail.

To be more safe, is it better to just add sys. before the function call?

@vuvova
Copy link
Copy Markdown
Member

vuvova commented May 21, 2026

@gengtianuiowa , I think either will work. When one downgrades from 12.3 to 11.8 and runs mariadb-upgrade it will be mariadb-upgrade from 11.8 that does not have SET PATH statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

3 participants