MDEV-26231:mysql_upgrade attempts to remove plugins which it failed to install - #2840
Open
an3l wants to merge 1 commit into
Open
Conversation
cvicentiu
suggested changes
Nov 28, 2023
cvicentiu
left a comment
Contributor
There was a problem hiding this comment.
Hi @an3l!
I don't understand what this patch changes.
ds_plugin_data_types only has its length member != 0 if installing a plugin succeded.
First initialization of the dynamic string is here:
int main(int argc, char **argv)
{
[...]
if (init_dynamic_string(&ds_args, "", 512, 256) ||
init_dynamic_string(&conn_args, "", 512, 256) ||
init_dynamic_string(&ds_plugin_data_types, "", 512, 256))
die("Out of memory");This sets the length of the string to 0, but it pre-allocates. Fine.
Then the only place that changes the ds_plugin_data_types string is:
if(!run_query("INSTALL SONAME 'type_mysql_json'", NULL, TRUE))
{
dynstr_append(&ds_plugin_data_types, "'type_mysql_json'");
dynstr_append(&ds_plugin_data_types, "\n");
break;
}So my question then is:
Does run_query return success even if the executed query threw an error? In that case, the bug should be fixed there, because the length checking of ds_plugin_data_types seems fine to me.
an3l
added a commit
to an3l/server
that referenced
this pull request
Nov 30, 2023
…o install - Protect plugin uninstall in case plugin didn't installed at all, what may happen if query returned and error. - Closes PR MariaDB#2840 - Reviewer: <cvicentiu@mariadb.org>
an3l
force-pushed
the
bb-10.5-anel-MDEV-26231-mysql_upgrade_remove_failed_plugins
branch
from
November 30, 2023 14:16
2702228 to
dc105f2
Compare
Contributor
Author
|
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.
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 |
…o install - Protect plugin uninstall in case plugin didn't installed at all, what may happen if query returned and error. - Closes PR MariaDB#2840 - Reviewer: <cvicentiu@mariadb.org>
an3l
force-pushed
the
bb-10.5-anel-MDEV-26231-mysql_upgrade_remove_failed_plugins
branch
from
March 7, 2024 11:50
dc105f2 to
7d63e08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When allocating array for installed
MYSQL_JSONplugin, size is set.When uninstalling the plugin, check string instead of size.
Basing the PR against the correct MariaDB version
PR quality check