From 7d63e08b95e3717645fec10b31913b4479b6ac18 Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Thu, 30 Nov 2023 15:13:11 +0100 Subject: [PATCH] MDEV-26231:mysql_upgrade attempts to remove plugins which it failed to install - Protect plugin uninstall in case plugin didn't installed at all, what may happen if query returned and error. - Closes PR #2840 - Reviewer: --- client/mysql_upgrade.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 36c73f69716c4..6923544045948 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1172,8 +1172,15 @@ static int install_used_plugin_data_types(void) if (strstr(line, "'MYSQL_JSON'")) { verbose("installing plugin for MYSQL_JSON data type"); - if(!run_query("INSTALL SONAME 'type_mysql_json'", NULL, TRUE)) + dynstr_set(&ds_result, ""); + if(!run_query("INSTALL SONAME 'type_mysql_json'", &ds_result, TRUE)) { + if (ds_result.length) + { + verbose("Failed to install the plugin 'type_mysql_json' for MYSQL_JSON data type"); + dynstr_free(&ds_result); + return 1; + } dynstr_append(&ds_plugin_data_types, "'type_mysql_json'"); dynstr_append(&ds_plugin_data_types, "\n"); break;