-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-28782: modify mariadb-tzinfo-to-sql to set 'wsrep*' variables appropriately in cases where Galera is not compiled in #2196
MDEV-28782: modify mariadb-tzinfo-to-sql to set 'wsrep*' variables appropriately in cases where Galera is not compiled in #2196
Conversation
|
@@ -3,7 +3,8 @@ | |||
--source include/not_windows.inc | |||
--source include/no_protocol.inc | |||
|
|||
let $is_embedded=`select version() like '%embedded%'`; | |||
# In certain build configurations (e.g. embedded server), these variables will have the value NULL. | |||
let $replace_wsrep_cols=`select @wsrep_is_on is NULL or @wsrep_cannot_replicate_tz`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately, the fact that these variables can be null comes from the way that they are defined, as of 13e7793:
Lines 2738 to 2743 in 13e7793
static const char *wsrep_is_on= | |
"select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON')" | |
" from information_schema.SYSTEM_VARIABLES"; | |
static const char *wsrep_cannot_replicate_tz= | |
"select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt)" | |
" from information_schema.SYSTEM_VARIABLES"; |
Lines 2767 to 2781 in 13e7793
printf("set @wsrep_is_on=(%s);\n", wsrep_is_on); | |
printf("SELECT concat('%%', GROUP_CONCAT(OPTION), '%%') INTO @replicate_opt " | |
" FROM" | |
" (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION" | |
" FROM information_schema.TABLES" | |
" WHERE TABLE_SCHEMA=DATABASE()" | |
" AND TABLE_NAME IN ('time_zone'," | |
" 'time_zone_name'," | |
" 'time_zone_transition'," | |
" 'time_zone_transition_type'," | |
" 'time_zone_leap_second')" | |
" AND ENGINE in ('MyISAM'," | |
" 'Aria')) AS o" | |
" ORDER BY OPTION DESC;\n"); | |
printf("set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (%s);\n", wsrep_cannot_replicate_tz); |
If Galera (aka "wsrep"?) is not compiled in, this variable doesn't exist at all, leading to @wsrep_is_on=NULL
→ @wsrep_cannot_replicate_tz=NULL
.
So the cleanest and most robust fix would be to change those initial definitions to include coalesce(…, 0)
, and then get rid of the special cases in the test.
@grooverdan, do you agree with that? Is there any reason that any consumer of the tzinfo SQL would actually need to differentiate between "Galera is OFF" and "Galera is not compiled in"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NULL
is also a false
behaviour in the sql standard, so I saw no need for coalesce
, but you're right in that didn't consider this in the test flexibility.
Please add select version() like '%embedded%'
into a or
condition of $replace_wsrep_cols
. I don't think you intentionally removed this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add
select version() like '%embedded%'
into aor
condition of$replace_wsrep_cols
. I don't think you intentionally removed this?
I did mean to remove that, actually. It seems to me to be error-prone and indirect to try to infer whether or not Galera is supported by looking at the version string, rather than simply looking at whether or not the Galera-related variables are populated (as I'm proposing here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grooverdan, in 0e4cf49 you modified the SELECT
query for wsrep_is_on
to work around issues in bootstrap mode:
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2726,11 +2726,11 @@ static const char *trunc_tables_const=
"TRUNCATE TABLE time_zone_transition;\n"
"TRUNCATE TABLE time_zone_transition_type;\n";
static const char *wsrep_is_on=
- "select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON')"
- " from information_schema.SYSTEM_VARIABLES";
+ "select sum(SESSION_VALUE='ON')"
+ " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'";
static const char *wsrep_cannot_replicate_tz=
- "select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt)"
- " from information_schema.SYSTEM_VARIABLES";
+ "select sum(GLOBAL_VALUE NOT LIKE @replicate_opt)"
+ " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'";
int
main(int argc, char **argv)
… however this same change is also what caused wsrep_is_on
to stop getting properly populated when Galera/wsrep is entirely removed from the build.
1ddceec
to
6d48c6a
Compare
@grooverdan |
please record test case results. |
6d48c6a
to
a738607
Compare
@grooverdan wrote:
Derp, thank you 🤦♂️. Fixed and repushed… |
…propriately in cases where Galera is not compiled in In 3b662c6, it was discovered that the values of the 'wsrep_is_on' and 'wsrep_cannot_replicate_tz' variables need to be overridden for embedded builds to pass However, there are other build configurations where these variables also have NULL values. The mariadb-tzinfo-to-sql script (implemented in sql/tztime.cc) can be slightly modified to set its 'wsrep_is_on' and 'wsrep_cannot_replicate_tz' variables more predictably in all such cases, thus allowing the mysql_tzinfo_to_sql_symlink.test test to pass without any special-casing for particular build types. See comments: - MariaDB@3b662c6#r78994411 - https://jira.mariadb.org/browse/MDEV-28782?focusedCommentId=230038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230038 All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
a738607
to
50b25dd
Compare
Description
In 3b662c6, @dr-m appears to have discovered that the values of the
wsrep_is_on
andwsrep_cannot_replicate_tz
variables need to be overridden for embedded builds.How can this PR be tested?
All MTR tests, including
mysql_tzinfo_to_sql_symlink.test
, should still be passing in Buildbot as well as GitLab-CI, including in configurations where thewsrep_on
andwsrep_mode
variables do not exist.Basing the PR against the correct MariaDB version
10.6 is the earliest upstream branch containing 13e7793 (which led to this issue) and 3b662c6 (partial fix for the embedded-server case), so it appears to be the correct place to apply this change.
Backward compatibility
This is a fix for compatibility of a test, and should be fully backward-compatible.
All new code of the whole pull request, including one or several files that
are either new files or modified ones, are contributed under the BSD-new
license. I am contributing on behalf of my employer Amazon Web Services,
Inc.