summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/wsrep/include/check_galera_version.inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/suite/wsrep/include/check_galera_version.inc
parentInitial commit. (diff)
downloadmariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz
mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/wsrep/include/check_galera_version.inc')
-rw-r--r--mysql-test/suite/wsrep/include/check_galera_version.inc47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc
new file mode 100644
index 00000000..7a58e657
--- /dev/null
+++ b/mysql-test/suite/wsrep/include/check_galera_version.inc
@@ -0,0 +1,47 @@
+# ==== Purpose ====
+# Enable tests to check the galera library version.
+#
+# ==== Usage ====
+# --let $galera_version=3.6
+# source include/check_galera_lib_version.inc;
+#
+# Parameters:
+# $galera_version
+# Version of the galera library required by the test.
+#
+
+--disable_query_log
+
+# Required Version
+
+eval SET @GALERA_VERSION='$galera_version';
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @GALERA_MINOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3') AS UNSIGNED) INTO @GALERA_RELEASE_VERSION;
+
+# Actual
+SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
+--enable_query_log
+
+# For testing
+#SELECT @GALERA_MAJOR_VERSION;
+#SELECT @GALERA_MINOR_VERSION;
+#SELECT @GALERA_RELEASE_VERSION;
+#SELECT @ACTUAL_GALERA_MAJOR_VERSION;
+#SELECT @ACTUAL_GALERA_MINOR_VERSION;
+#SELECT @ACTUAL_GALERA_RELEASE_VERSION;
+
+if (!`SELECT (@ACTUAL_GALERA_MAJOR_VERSION >= @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
+ (@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND
+ @ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
+ @ACTUAL_GALERA_RELEASE_VERSION >= @GALERA_RELEASE_VERSION)
+ `)
+{
+ skip Test requires Galera library version >= $galera_version;
+}
+
+--echo # Correct Galera library found
+