server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-26231:mysql_upgrade attempts to remove plugins which it failed to install

Open an3l opened this issue 1 year ago • 1 comments

When allocating array for installed MYSQL_JSON plugin, size is set. When uninstalling the plugin, check string instead of size.

Basing the PR against the correct MariaDB version

  • [ ] This is a new feature and the PR is based against the latest MariaDB development branch.
  • [ x] This is a bug fix and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • [ x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • [x ] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

an3l avatar Nov 14 '23 12:11 an3l

HI @cvicentiu , yes I have updated now to catch error for query plugin and properly skip uninstall phase if there is no plugin installed at all. Results:

  • Simulate wrong query:
if(!run_query("INSTALL SONAME 'type_mysql_json1'", &ds_result, TRUE))

Check clients

# No plugin installed
MariaDB [test]> show create table t;
ERROR 4161 (HY000): Unknown data type: 'MYSQL_JSON'

# mariadb_upgrade
$ sudo ./client/mysql_upgrade -uroot -S /tmp/mysql.sock --force
Phase 2/7: Installing used storage engines... Skipped
installing plugin for MYSQL_JSON data type
Failed to install the plugin 'type_mysql_json' for MYSQL_JSON data type
FATAL ERROR: Upgrade failed

an3l avatar Nov 30 '23 14:11 an3l