Skip to content

Commit

Permalink
MDEV-30318: galera error messages in mariadb log without galera enabled
Browse files Browse the repository at this point in the history
Post-fix to MDEV-30318 and MDEV-22570-related changes:
unified handling of wsrep_provider by code so that "none"
is interpreted as case-insensitive everywhere and that
work with an empty string is supported everywhere.
  • Loading branch information
sysprg committed Feb 15, 2023
1 parent cc182ac commit 80b4fa5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion mysql-test/include/galera_variables_ok.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--disable_query_log

--let $galera_variables_ok = `SELECT COUNT(*) = 50 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`
--let $galera_variables_ok = `SELECT COUNT(*) = 51 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`

--if (!$galera_variables_ok) {
--skip Galera number of variables has changed!
Expand Down
16 changes: 14 additions & 2 deletions mysql-test/suite/wsrep/r/wsrep_provider_plugin_defaults.result
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# Correct Galera library found
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider%' AND VARIABLE_NAME NOT IN (
'wsrep_provider',
'wsrep_provider_options',
'wsrep_provider_base_dir',
'wsrep_provider_base_port',
'wsrep_provider_gcache_dir',
'wsrep_provider_dbug',
'wsrep_provider_gcache_debug',
'wsrep_provider_signal',
'wsrep_provider_gmcast_listen_addr');
COUNT(*)
89
83
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_provider_%' AND VARIABLE_NAME NOT IN (
'wsrep_provider',
'wsrep_provider_options',
'wsrep_provider_base_dir',
'wsrep_provider_base_port',
'wsrep_provider_gcache_dir',
'wsrep_provider_dbug',
'wsrep_provider_gcache_debug',
'wsrep_provider_signal',
'wsrep_provider_gmcast_listen_addr')
ORDER BY VARIABLE_NAME;
VARIABLE_NAME WSREP_PROVIDER_BASE_HOST
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/wsrep/t/variables_debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--let $galera_version=26.4.11
source include/check_galera_version.inc;

source include/galera_variables_ok.inc;
source include/galera_variables_ok_debug.inc;

--replace_column 2 #
SHOW GLOBAL STATUS LIKE 'wsrep%';
Expand Down
14 changes: 13 additions & 1 deletion mysql-test/suite/wsrep/t/wsrep_provider_plugin_defaults.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
--let $galera_version=26.4.14
source include/check_galera_version.inc;

SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider%' AND VARIABLE_NAME NOT IN (
'wsrep_provider',
'wsrep_provider_options',
'wsrep_provider_base_dir',
'wsrep_provider_base_port',
'wsrep_provider_gcache_dir',
'wsrep_provider_dbug',
'wsrep_provider_gcache_debug',
'wsrep_provider_signal',
'wsrep_provider_gmcast_listen_addr');

--vertical_results
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES
Expand All @@ -14,5 +23,8 @@ WHERE VARIABLE_NAME LIKE 'wsrep_provider_%' AND VARIABLE_NAME NOT IN (
'wsrep_provider_base_dir',
'wsrep_provider_base_port',
'wsrep_provider_gcache_dir',
'wsrep_provider_dbug',
'wsrep_provider_gcache_debug',
'wsrep_provider_signal',
'wsrep_provider_gmcast_listen_addr')
ORDER BY VARIABLE_NAME;
2 changes: 1 addition & 1 deletion sql/wsrep_check_opts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int wsrep_check_opts()
}
}

if (strcasecmp(wsrep_provider, "NONE"))
if (strcasecmp(wsrep_provider, WSREP_NONE))
{
if (global_system_variables.binlog_format != BINLOG_FORMAT_ROW)
{
Expand Down
9 changes: 5 additions & 4 deletions sql/wsrep_mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,8 @@ int wsrep_init()
wsrep_init_position();
wsrep_sst_auth_init();

if (strlen(wsrep_provider)== 0 ||
!strcmp(wsrep_provider, WSREP_NONE))
if (!*wsrep_provider ||
!strcasecmp(wsrep_provider, WSREP_NONE))
{
// enable normal operation in case no provider is specified
global_system_variables.wsrep_on= 0;
Expand Down Expand Up @@ -922,7 +922,7 @@ int wsrep_init()

/* Now WSREP is fully initialized */
global_system_variables.wsrep_on= 1;
WSREP_ON_= wsrep_provider && strcmp(wsrep_provider, WSREP_NONE);
WSREP_ON_= wsrep_provider && *wsrep_provider && strcasecmp(wsrep_provider, WSREP_NONE);
wsrep_service_started= 1;

wsrep_init_provider_status_variables();
Expand Down Expand Up @@ -991,7 +991,8 @@ void wsrep_init_startup (bool sst_first)
wsrep_plugins_pre_init();

/* Skip replication start if dummy wsrep provider is loaded */
if (!strcmp(wsrep_provider, WSREP_NONE)) return;
if (!wsrep_provider || !*wsrep_provider ||
!strcasecmp(wsrep_provider, WSREP_NONE)) return;

/* Skip replication start if no cluster address */
if (!wsrep_cluster_address_exists()) return;
Expand Down
3 changes: 2 additions & 1 deletion sql/wsrep_sst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type)

bool wsrep_before_SE()
{
return (wsrep_provider != NULL
return (wsrep_provider
&& *wsrep_provider
&& strcmp (wsrep_provider, WSREP_NONE)
&& strcmp (wsrep_sst_method, WSREP_SST_SKIP)
&& strcmp (wsrep_sst_method, WSREP_SST_MYSQLDUMP));
Expand Down
12 changes: 8 additions & 4 deletions sql/wsrep_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void wsrep_set_wsrep_on(THD* thd)
{
if (thd)
thd->wsrep_was_on= WSREP_ON_;
WSREP_PROVIDER_EXISTS_= wsrep_provider &&
strncasecmp(wsrep_provider, WSREP_NONE, FN_REFLEN);
WSREP_PROVIDER_EXISTS_= wsrep_provider && *wsrep_provider &&
strcasecmp(wsrep_provider, WSREP_NONE);
WSREP_ON_= global_system_variables.wsrep_on && WSREP_PROVIDER_EXISTS_;
}

Expand All @@ -114,10 +114,14 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{
my_bool saved_wsrep_on= global_system_variables.wsrep_on;

thd->variables.wsrep_on= global_system_variables.wsrep_on;
thd->variables.wsrep_on= saved_wsrep_on;

// If wsrep has not been inited we need to do it now
if (global_system_variables.wsrep_on && wsrep_provider && !wsrep_inited)
if (!wsrep_inited &&
saved_wsrep_on &&
wsrep_provider &&
*wsrep_provider &&
strcasecmp(wsrep_provider, WSREP_NONE))
{
// wsrep_init() rewrites provide if it fails
char* tmp= strdup(wsrep_provider);
Expand Down

0 comments on commit 80b4fa5

Please sign in to comment.