mariadb: 10.5.26, 10.6.19, 10.11.9, 11.4.3 (#334878)

* mariadb: 10.5.26, 10.6.19, 10.11.9, 11.4.3

* nixos/tests/automysqlbackup: nixfmt

* nixos/automysqlbackup: fix tests

* nixos/tests/mariadb-galera: nixfmt

* nixos/tests/mariadb-galera: fix test failing with new default IPv6 configuration
This commit is contained in:
Simon Hauser 2024-09-23 20:00:19 +02:00 committed by GitHub
parent 848b7926cd
commit 32cc042368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 314 additions and 460 deletions

View File

@ -118,15 +118,6 @@ in
name = user;
ensurePermissions = {
"*.*" = "SELECT, SHOW VIEW, TRIGGER, LOCK TABLES, EVENT";
# https://forums.mysql.com/read.php?10,668311,668315#msg-668315
"function sys.extract_table_from_file_name" = "execute";
"function sys.format_path" = "execute";
"function sys.format_statement" = "execute";
"function sys.extract_schema_from_file_name" = "execute";
"function sys.ps_thread_account" = "execute";
"function sys.format_time" = "execute";
"function sys.format_bytes" = "execute";
};
};

View File

@ -1,8 +1,8 @@
{
system ? builtins.currentSystem,
config ? {},
config ? { },
pkgs ? import ../../.. { inherit system config; },
lib ? pkgs.lib
lib ? pkgs.lib,
}:
let
@ -11,240 +11,263 @@ let
makeTest = import ./../make-test-python.nix;
# Common user configuration
makeGaleraTest = {
mariadbPackage,
name ? mkTestName mariadbPackage,
galeraPackage ? pkgs.mariadb-galera
}: makeTest {
name = "${name}-galera-mariabackup";
meta = {
maintainers = with lib.maintainers; [ izorkin ] ++ lib.teams.helsinki-systems.members;
makeGaleraTest =
{
mariadbPackage,
name ? mkTestName mariadbPackage,
galeraPackage ? pkgs.mariadb-galera,
}:
makeTest {
name = "${name}-galera-mariabackup";
meta = {
maintainers = with lib.maintainers; [ izorkin ] ++ lib.teams.helsinki-systems.members;
};
# The test creates a Galera cluster with 3 nodes and is checking if mariabackup-based SST works. The cluster is tested by creating a DB and an empty table on one node,
# and checking the table's presence on the other node.
nodes =
let
mkGaleraNode =
{
id,
method,
}:
let
address = "192.168.1.${toString id}";
isFirstClusterNode = id == 1 || id == 4;
in
{
users = {
users.testuser = {
isSystemUser = true;
group = "testusers";
};
groups.testusers = { };
};
networking = {
interfaces.eth1 = {
ipv4.addresses = [
{
inherit address;
prefixLength = 24;
}
];
ipv6.addresses = lib.mkForce [ ];
};
extraHosts = lib.concatMapStringsSep "\n" (i: "192.168.1.${toString i} galera_0${toString i}") (
lib.range 1 6
);
firewall.allowedTCPPorts = [
3306
4444
4567
4568
];
firewall.allowedUDPPorts = [ 4567 ];
};
systemd.services.mysql = with pkgs; {
path = with pkgs; [
bash
gawk
gnutar
gzip
inetutils
iproute2
netcat
procps
pv
rsync
socat
stunnel
which
];
};
services.mysql = {
enable = true;
package = mariadbPackage;
ensureDatabases = lib.mkIf isFirstClusterNode [ "testdb" ];
ensureUsers = lib.mkIf isFirstClusterNode [
{
name = "testuser";
ensurePermissions = {
"testdb.*" = "ALL PRIVILEGES";
};
}
];
initialScript = lib.mkIf isFirstClusterNode (
pkgs.writeText "mariadb-init.sql" ''
GRANT ALL PRIVILEGES ON *.* TO 'check_repl'@'localhost' IDENTIFIED BY 'check_pass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
''
);
settings = {
mysqld = {
bind_address = "0.0.0.0";
};
galera = {
wsrep_on = "ON";
wsrep_debug = "NONE";
wsrep_retry_autocommit = "3";
wsrep_provider = "${galeraPackage}/lib/galera/libgalera_smm.so";
wsrep_cluster_address =
"gcomm://"
+ lib.optionalString (id == 2 || id == 3) "galera_01,galera_02,galera_03"
+ lib.optionalString (id == 5 || id == 6) "galera_04,galera_05,galera_06";
wsrep_cluster_name = "galera";
wsrep_node_address = address;
wsrep_node_name = "galera_0${toString id}";
wsrep_sst_method = method;
wsrep_sst_auth = "check_repl:check_pass";
binlog_format = "ROW";
enforce_storage_engine = "InnoDB";
innodb_autoinc_lock_mode = "2";
};
};
};
};
in
{
galera_01 = mkGaleraNode {
id = 1;
method = "mariabackup";
};
galera_02 = mkGaleraNode {
id = 2;
method = "mariabackup";
};
galera_03 = mkGaleraNode {
id = 3;
method = "mariabackup";
};
galera_04 = mkGaleraNode {
id = 4;
method = "rsync";
};
galera_05 = mkGaleraNode {
id = 5;
method = "rsync";
};
galera_06 = mkGaleraNode {
id = 6;
method = "rsync";
};
};
testScript = ''
galera_01.start()
galera_01.wait_for_unit("mysql")
galera_01.wait_for_open_port(3306)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db1 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db1 values (37);'"
)
galera_02.start()
galera_02.wait_for_unit("mysql")
galera_02.wait_for_open_port(3306)
galera_03.start()
galera_03.wait_for_unit("mysql")
galera_03.wait_for_open_port(3306)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 37"
)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db2 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_02.succeed("systemctl stop mysql")
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db2 values (38);'"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db3 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db3 values (39);'"
)
galera_02.succeed("systemctl start mysql")
galera_02.wait_for_open_port(3306)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_cluster_size.*3'"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_local_state_comment.*Synced'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db3;' -N | grep 39"
)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db2;' -N | grep 38"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 37"
)
galera_01.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db3;'")
galera_02.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db2;'")
galera_03.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db1;'")
galera_01.crash()
galera_02.crash()
galera_03.crash()
galera_04.start()
galera_04.wait_for_unit("mysql")
galera_04.wait_for_open_port(3306)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db1 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db1 values (41);'"
)
galera_05.start()
galera_05.wait_for_unit("mysql")
galera_05.wait_for_open_port(3306)
galera_06.start()
galera_06.wait_for_unit("mysql")
galera_06.wait_for_open_port(3306)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 41"
)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db2 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_05.succeed("systemctl stop mysql")
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db2 values (42);'"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db3 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db3 values (43);'"
)
galera_05.succeed("systemctl start mysql")
galera_05.wait_for_open_port(3306)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_cluster_size.*3'"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_local_state_comment.*Synced'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db3;' -N | grep 43"
)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db2;' -N | grep 42"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 41"
)
galera_04.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db3;'")
galera_05.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db2;'")
galera_06.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db1;'")
'';
};
# The test creates a Galera cluster with 3 nodes and is checking if mariabackup-based SST works. The cluster is tested by creating a DB and an empty table on one node,
# and checking the table's presence on the other node.
nodes = let
mkGaleraNode = {
id,
method
}: let
address = "192.168.1.${toString id}";
isFirstClusterNode = id == 1 || id == 4;
in {
users = {
users.testuser = {
isSystemUser = true;
group = "testusers";
};
groups.testusers = { };
};
networking = {
interfaces.eth1 = {
ipv4.addresses = [
{ inherit address; prefixLength = 24; }
];
};
extraHosts = lib.concatMapStringsSep "\n" (i: "192.168.1.${toString i} galera_0${toString i}") (lib.range 1 6);
firewall.allowedTCPPorts = [ 3306 4444 4567 4568 ];
firewall.allowedUDPPorts = [ 4567 ];
};
systemd.services.mysql = with pkgs; {
path = with pkgs; [
bash
gawk
gnutar
gzip
inetutils
iproute2
netcat
procps
pv
rsync
socat
stunnel
which
];
};
services.mysql = {
enable = true;
package = mariadbPackage;
ensureDatabases = lib.mkIf isFirstClusterNode [ "testdb" ];
ensureUsers = lib.mkIf isFirstClusterNode [{
name = "testuser";
ensurePermissions = {
"testdb.*" = "ALL PRIVILEGES";
};
}];
initialScript = lib.mkIf isFirstClusterNode (pkgs.writeText "mariadb-init.sql" ''
GRANT ALL PRIVILEGES ON *.* TO 'check_repl'@'localhost' IDENTIFIED BY 'check_pass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
'');
settings = {
mysqld = {
bind_address = "0.0.0.0";
};
galera = {
wsrep_on = "ON";
wsrep_debug = "NONE";
wsrep_retry_autocommit = "3";
wsrep_provider = "${galeraPackage}/lib/galera/libgalera_smm.so";
wsrep_cluster_address = "gcomm://"
+ lib.optionalString (id == 2 || id == 3) "galera_01,galera_02,galera_03"
+ lib.optionalString (id == 5 || id == 6) "galera_04,galera_05,galera_06";
wsrep_cluster_name = "galera";
wsrep_node_address = address;
wsrep_node_name = "galera_0${toString id}";
wsrep_sst_method = method;
wsrep_sst_auth = "check_repl:check_pass";
binlog_format = "ROW";
enforce_storage_engine = "InnoDB";
innodb_autoinc_lock_mode = "2";
};
};
};
};
in {
galera_01 = mkGaleraNode {
id = 1;
method = "mariabackup";
};
galera_02 = mkGaleraNode {
id = 2;
method = "mariabackup";
};
galera_03 = mkGaleraNode {
id = 3;
method = "mariabackup";
};
galera_04 = mkGaleraNode {
id = 4;
method = "rsync";
};
galera_05 = mkGaleraNode {
id = 5;
method = "rsync";
};
galera_06 = mkGaleraNode {
id = 6;
method = "rsync";
};
};
testScript = ''
galera_01.start()
galera_01.wait_for_unit("mysql")
galera_01.wait_for_open_port(3306)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db1 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db1 values (37);'"
)
galera_02.start()
galera_02.wait_for_unit("mysql")
galera_02.wait_for_open_port(3306)
galera_03.start()
galera_03.wait_for_unit("mysql")
galera_03.wait_for_open_port(3306)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 37"
)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db2 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_02.succeed("systemctl stop mysql")
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db2 values (38);'"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db3 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db3 values (39);'"
)
galera_02.succeed("systemctl start mysql")
galera_02.wait_for_open_port(3306)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_cluster_size.*3'"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_local_state_comment.*Synced'"
)
galera_01.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db3;' -N | grep 39"
)
galera_02.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db2;' -N | grep 38"
)
galera_03.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 37"
)
galera_01.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db3;'")
galera_02.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db2;'")
galera_03.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db1;'")
galera_01.crash()
galera_02.crash()
galera_03.crash()
galera_04.start()
galera_04.wait_for_unit("mysql")
galera_04.wait_for_open_port(3306)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db1 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db1 values (41);'"
)
galera_05.start()
galera_05.wait_for_unit("mysql")
galera_05.wait_for_open_port(3306)
galera_06.start()
galera_06.wait_for_unit("mysql")
galera_06.wait_for_open_port(3306)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 41"
)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db2 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_05.succeed("systemctl stop mysql")
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db2 values (42);'"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; create table db3 (test_id INT, PRIMARY KEY (test_id)) ENGINE = InnoDB;'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; insert into db3 values (43);'"
)
galera_05.succeed("systemctl start mysql")
galera_05.wait_for_open_port(3306)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_cluster_size.*3'"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'show status' -N | grep 'wsrep_local_state_comment.*Synced'"
)
galera_04.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db3;' -N | grep 43"
)
galera_05.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db2;' -N | grep 42"
)
galera_06.succeed(
"sudo -u testuser mysql -u testuser -e 'use testdb; select test_id from db1;' -N | grep 41"
)
galera_04.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db3;'")
galera_05.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db2;'")
galera_06.succeed("sudo -u testuser mysql -u testuser -e 'use testdb; drop table db1;'")
'';
};
in
lib.mapAttrs (_: mariadbPackage: makeGaleraTest { inherit mariadbPackage; }) mariadbPackages
lib.mapAttrs (_: mariadbPackage: makeGaleraTest { inherit mariadbPackage; }) mariadbPackages

View File

@ -1,8 +1,8 @@
{
system ? builtins.currentSystem,
config ? {},
config ? { },
pkgs ? import ../../.. { inherit system config; },
lib ? pkgs.lib
lib ? pkgs.lib,
}:
let
@ -10,44 +10,52 @@ let
makeTest = import ./../make-test-python.nix;
makeAutobackupTest = {
package,
name ? mkTestName package,
}: makeTest {
name = "${name}-automysqlbackup";
meta.maintainers = [ lib.maintainers.aanderse ];
makeAutobackupTest =
{
package,
name ? mkTestName package,
}:
makeTest {
name = "${name}-automysqlbackup";
meta.maintainers = [ lib.maintainers.aanderse ];
nodes.machine = {
services.mysql = {
inherit package;
enable = true;
initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
nodes.machine = {
services.mysql = {
inherit package;
enable = true;
initialDatabases = [
{
name = "testdb";
schema = ./testdb.sql;
}
];
};
services.automysqlbackup.enable = true;
automysqlbackup.settings.mysql_dump_port = "";
};
services.automysqlbackup.enable = true;
};
testScript = ''
start_all()
testScript = ''
start_all()
# Need to have mysql started so that it can be populated with data.
machine.wait_for_unit("mysql.service")
# Need to have mysql started so that it can be populated with data.
machine.wait_for_unit("mysql.service")
with subtest("Wait for testdb to be fully populated (5 rows)."):
machine.wait_until_succeeds(
"mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5"
)
with subtest("Wait for testdb to be fully populated (5 rows)."):
machine.wait_until_succeeds(
"mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5"
)
with subtest("Do a backup and wait for it to start"):
machine.start_job("automysqlbackup.service")
machine.wait_for_job("automysqlbackup.service")
with subtest("Do a backup and wait for it to start"):
machine.start_job("automysqlbackup.service")
machine.wait_for_job("automysqlbackup.service")
with subtest("wait for backup file and check that data appears in backup"):
machine.wait_for_file("/var/backup/mysql/daily/testdb")
machine.succeed(
"${pkgs.gzip}/bin/zcat /var/backup/mysql/daily/testdb/daily_testdb_*.sql.gz | grep hello"
)
with subtest("wait for backup file and check that data appears in backup"):
machine.wait_for_file("/var/backup/mysql/daily/testdb")
machine.succeed(
"${pkgs.gzip}/bin/zcat /var/backup/mysql/daily/testdb/daily_testdb_*.sql.gz | grep hello"
)
'';
};
};
in
lib.mapAttrs (_: package: makeAutobackupTest { inherit package; }) mariadbPackages
lib.mapAttrs (_: package: makeAutobackupTest { inherit package; }) mariadbPackages

View File

@ -244,28 +244,26 @@ in
# see https://mariadb.org/about/#maintenance-policy for EOLs
mariadb_105 = self.callPackage generic {
# Supported until 2025-06-24
# TODO should be removed
version = "10.5.25";
hash = "sha256-lhnQ9R6GQ1dGayxjMBo0pT99/ZnxjE/UUvqyK/Obpk4=";
version = "10.5.26";
hash = "sha256-3V+ZodMK5HNl/Bix3u/23AqzishOfZ/ZyMBP9rAZYfE=";
inherit (self.darwin.apple_sdk.frameworks) CoreServices;
};
mariadb_106 = self.callPackage generic {
# Supported until 2026-07-06
version = "10.6.18";
hash = "sha256-aJihER9HEwcJ4ouix70aV+S7VxAfbhCeWX1R5tOFzxg=";
version = "10.6.19";
hash = "sha256-vOyw/3t5pBNEc2+plHEHh8FVFtUet3FfJ4w/D8t+hwM=";
inherit (self.darwin.apple_sdk.frameworks) CoreServices;
};
mariadb_1011 = self.callPackage generic {
# Supported until 2028-02-16
version = "10.11.8";
hash = "sha256-XwTz4z2fHL7/BeecVNQdMCYwUAyZWu5ysGOOL5383w8=";
version = "10.11.9";
hash = "sha256-CgAYCGTNAWGHyYb6q4AQ3iOhF7mnX5HWRWQh+JTkjSA=";
inherit (self.darwin.apple_sdk.frameworks) CoreServices;
};
mariadb_110 = self.callPackage generic {
# Supported until 2024-06-07
# TODO should be removed
version = "11.0.6";
hash = "sha256-AYnWKUbDfG20a/GkaLqVgLy6joDwWVjsSDwzh+zPmgA=";
mariadb_114 = self.callPackage generic {
# Supported until 2029-05-29
version = "11.4.3";
hash = "sha256-bwAXuZAbsYl94O7SHK75/6nWbvVZNFoNim8BEwhBPs4=";
inherit (self.darwin.apple_sdk.frameworks) CoreServices;
};
}

View File

@ -1,167 +0,0 @@
From 1f1ee5d3776af7ef56ffa3f4dcd22532c2c86c74 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Sun, 7 Jan 2024 10:19:54 +0100
Subject: [PATCH] Fix build with libxml2 2.12
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libxml2 2.12.0 made `xmlGetLastError()` return `const` pointer:
https://gitlab.gnome.org/GNOME/libxml2/-/commit/61034116d0a3c8b295c6137956adc3ae55720711
Clang 16 does not like this:
error: assigning to 'xmlErrorPtr' (aka '_xmlError *') from 'const xmlError *' (aka 'const _xmlError *') discards qualifiers
error: cannot initialize a variable of type 'xmlErrorPtr' (aka '_xmlError *') with an rvalue of type 'const xmlError *' (aka 'const _xmlError *')
Lets update the variables to `const`.
For older versions, it will be automatically converted.
But then `xmlResetError(xmlError*)` will not like the `const` pointer:
error: no matching function for call to 'xmlResetError'
note: candidate function not viable: 1st argument ('const xmlError *' (aka 'const _xmlError *')) would lose const qualifier
Lets replace it with `xmlResetLastError()`.
ALso remove `LIBXMLDOC::Xerr` protected member property.
It was introduced in 65b0e5455b547a3d574fa77b34cce23ae3bea0a0
along with the `xmlResetError` calls.
It does not appear to be used for anything.
---
storage/connect/libdoc.cpp | 39 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index e414aa88355..10edcbc3ffa 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -93,7 +93,6 @@ class LIBXMLDOC : public XMLDOCUMENT {
xmlXPathContextPtr Ctxp;
xmlXPathObjectPtr Xop;
xmlXPathObjectPtr NlXop;
- xmlErrorPtr Xerr;
char *Buf; // Temporary
bool Nofreelist;
}; // end of class LIBXMLDOC
@@ -327,7 +326,6 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
Ctxp = NULL;
Xop = NULL;
NlXop = NULL;
- Xerr = NULL;
Buf = NULL;
Nofreelist = false;
} // end of LIBXMLDOC constructor
@@ -365,8 +363,8 @@ bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
Encoding = (char*)Docp->encoding;
return false;
- } else if ((Xerr = xmlGetLastError()))
- xmlResetError(Xerr);
+ } else if (xmlGetLastError())
+ xmlResetLastError();
return true;
} // end of ParseFile
@@ -505,9 +503,9 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
#if 1
// This function does not crash (
if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) {
- xmlErrorPtr err = xmlGetLastError();
+ const xmlError *err = xmlGetLastError();
strcpy(g->Message, (err) ? err->message : "Error saving XML doc");
- xmlResetError(Xerr);
+ xmlResetLastError();
rc = -1;
} // endif Save
// rc = xmlDocDump(of, Docp);
@@ -546,8 +544,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
if (Nlist) {
xmlXPathFreeNodeSet(Nlist);
- if ((Xerr = xmlGetLastError()))
- xmlResetError(Xerr);
+ if (xmlGetLastError())
+ xmlResetLastError();
Nlist = NULL;
} // endif Nlist
@@ -555,8 +553,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
if (Xop) {
xmlXPathFreeObject(Xop);
- if ((Xerr = xmlGetLastError()))
- xmlResetError(Xerr);
+ if (xmlGetLastError())
+ xmlResetLastError();
Xop = NULL;
} // endif Xop
@@ -564,8 +562,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
if (NlXop) {
xmlXPathFreeObject(NlXop);
- if ((Xerr = xmlGetLastError()))
- xmlResetError(Xerr);
+ if (xmlGetLastError())
+ xmlResetLastError();
NlXop = NULL;
} // endif NlXop
@@ -573,8 +571,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
if (Ctxp) {
xmlXPathFreeContext(Ctxp);
- if ((Xerr = xmlGetLastError()))
- xmlResetError(Xerr);
+ if (xmlGetLastError())
+ xmlResetLastError();
Ctxp = NULL;
} // endif Ctxp
@@ -590,6 +588,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
/******************************************************************/
xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
{
+ const xmlError *xerr;
xmlNodeSetPtr nl;
if (trace(1))
@@ -649,11 +648,11 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
} else
xmlXPathFreeObject(Xop); // Caused node not found
- if ((Xerr = xmlGetLastError())) {
- strcpy(g->Message, Xerr->message);
- xmlResetError(Xerr);
+ if ((xerr = xmlGetLastError())) {
+ strcpy(g->Message, xerr->message);
+ xmlResetLastError();
return NULL;
- } // endif Xerr
+ } // endif xerr
} // endif Xop
@@ -1079,7 +1078,7 @@ void XML2NODE::AddText(PGLOBAL g, PCSZ txtp)
/******************************************************************/
void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
{
- xmlErrorPtr xerr;
+ const xmlError *xerr;
if (trace(1))
htrc("DeleteChild: node=%p\n", dnp);
@@ -1122,7 +1121,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
if (trace(1))
htrc("DeleteChild: errmsg=%-.256s\n", xerr->message);
- xmlResetError(xerr);
+ xmlResetLastError();
} // end of DeleteChild
/* -------------------- class XML2NODELIST ---------------------- */
--
2.42.0

View File

@ -969,6 +969,7 @@ mapAliases {
mailman-rss = throw "The mailman-rss package was dropped since it was unmaintained."; # Added 2024-06-21
mariadb_104 = throw "mariadb_104 has been removed from nixpkgs, please switch to another version like mariadb_106"; # Added 2023-09-11
mariadb_1010 = throw "mariadb_1010 has been removed from nixpkgs, please switch to another version like mariadb_1011"; # Added 2023-11-14
mariadb_110 = throw "mariadb_110 has been removed from nixpkgs, please switch to another version like mariadb_114"; # Added 2024-08-15
mariadb-client = hiPrio mariadb.client; #added 2019.07.28
markdown-pp = throw "markdown-pp was removed from nixpkgs, because the upstream archived it on 2021-09-02"; # Added 2023-07-22
markmind = throw "markmind has been removed from nixpkgs, because it depended on an old version of electron"; # Added 2023-09-12

View File

@ -25026,7 +25026,7 @@ with pkgs;
mariadb_105
mariadb_106
mariadb_1011
mariadb_110
mariadb_114
;
mariadb = mariadb_1011;
mariadb-embedded = mariadb.override { withEmbedded = true; };