Commit 4849b73c authored by Jan Lindström's avatar Jan Lindström Committed by Sergei Golubchik

MDEV-30120 Update the wsrep_provider_options read_only value in the system_variables table.

When wsrep-provider-options plugin is initialized we need to update
wsrep-provider-options variable as READ_ONLY.
parent 79d0194e
......@@ -11,7 +11,7 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_repl_max_ws_size=1;
SHOW VARIABLES LIKE 'wsrep_provider_repl_max_ws_size';
--error ER_ERROR_DURING_COMMIT
--error ER_UNKNOWN_ERROR
INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_provider_repl_max_ws_size=DEFAULT;
......@@ -31,3 +31,8 @@ DROP TABLE t1;
CALL mtr.add_suppression("transaction size limit");
CALL mtr.add_suppression("rbr write fail");
#
# MDEV-30120 :Update the wsrep_provider_options read_only value in the system_variables table.
#
SELECT VARIABLE_NAME,READ_ONLY FROM information_schema.system_variables where VARIABLE_NAME like '%wsrep_provider_options%';
......@@ -38,7 +38,8 @@ IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
wsrep_schema.cc
wsrep_plugin.cc
service_wsrep.cc
)
)
MYSQL_ADD_PLUGIN(wsrep_provider ${WSREP_SOURCES} DEFAULT NOT_EMBEDDED LINK_LIBRARIES wsrep-lib wsrep_api_v26)
MYSQL_ADD_PLUGIN(wsrep ${WSREP_SOURCES} MANDATORY NOT_EMBEDDED LINK_LIBRARIES wsrep-lib wsrep_api_v26)
IF(VISIBILITY_HIDDEN_FLAG AND TARGET wsrep)
# wsrep_info plugin needs some wsrep symbols from inside mysqld
......
......@@ -134,6 +134,8 @@ class sys_var: protected Value_source // for double_from_string_with_check
return system_charset_info;
}
bool is_readonly() const { return flags & READONLY; }
void update_flags(int new_flags) { flags = new_flags; }
int get_flags() const { return flags; }
/**
the following is only true for keycache variables,
that support the syntax @@keycache_name.variable_name
......
......@@ -20,6 +20,11 @@
in favor of single options which are initialized from provider.
*/
#include "sql_plugin.h"
#include "sql_priv.h"
#include "sql_class.h"
#include "set_var.h"
#include "my_global.h"
#include "mysqld_error.h"
#include <mysql/plugin.h>
......@@ -272,12 +277,21 @@ static int wsrep_provider_plugin_init(void *p)
{
WSREP_DEBUG("wsrep_provider_plugin_init()");
provider_plugin_enabled= true;
// When plugin-wsrep-provider is enabled we set
// wsrep_provider_options parameter as READ_ONLY
sys_var *my_var= find_sys_var(current_thd, "wsrep_provider_options");
int flags= my_var->get_flags();
my_var->update_flags(flags |= (int)sys_var::READONLY);
return 0;
}
static int wsrep_provider_plugin_deinit(void *p)
{
WSREP_DEBUG("wsrep_provider_plugin_deinit()");
sys_var *my_var= find_sys_var(current_thd, "wsrep_provider_options");
int flags= my_var->get_flags();
my_var->update_flags(flags &= (int)~sys_var::READONLY);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment