mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-28263 mariadb-tzinfo-to-sql binlog fixes
The --skip-write-binlog message was confusing that it only had an effect if the galera was enabled. There are uses beyond galera so we apply SET SESSION SQL_LOG_BIN=0 as implied by the option without being conditional on the wsrep status. Remove wsrep.mysql_tzinfo_to_sql_symlink{,_skip} tests as they offered no additional coverage beyond main.mysql_tzinfo_to_sql_symlink as no server testing was done. Introduced a variant of the galera.mariadb_tzinfo_to_sql as galera.mysql_tzinfo_to_sql, which does testing using the mysql client rather than directly importing into the server via mysqltest. Update man page and mysql_tzinfo_to_sql to having a --skip-write-binlog option. merge notes: 10.4: - conflicts in tztime.cc can revert to this version of --help text. - tztime.cc - merge execute immediate @prep1, and leave %s%s trunc_tables, lock_tables after that. 10.6: - Need to remove the not_embedded.inc in mysql_tzinfo_to_sql.test and replace it with no_protocol.inc - leave both mysql_tzinfo_to_sql.test and mariadb_tzinfo_to_sql.sql tests. - sql/tztime.cc - keep entirely 10.6 version.
This commit is contained in:
156
mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test
Normal file
156
mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test
Normal file
@@ -0,0 +1,156 @@
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
# merge note: 10.6 change not_embedded.inc to no_protocol.inc
|
||||
|
||||
# Unlike the similar galera.mariadb_tzinfo_to_sql.test in 10.6+, this
|
||||
# tests that the output can be parsed by the mysql client.
|
||||
--echo #
|
||||
--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
|
||||
--echo #
|
||||
|
||||
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
|
||||
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
|
||||
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
|
||||
|
||||
--echo
|
||||
--echo # On node_1
|
||||
--connection node_1
|
||||
|
||||
CREATE TABLE time_zone LIKE mysql.time_zone;
|
||||
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
|
||||
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
|
||||
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
|
||||
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
|
||||
|
||||
--echo #
|
||||
--echo # Run on zoneinfo directory --skip-write-binlog
|
||||
--echo #
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
|
||||
|
||||
--echo
|
||||
--echo # Apply on node_1
|
||||
--echo
|
||||
--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
|
||||
--echo load timezones
|
||||
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
|
||||
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
|
||||
|
||||
if ($snap_pos == $new_snap_pos)
|
||||
{
|
||||
--echo 'binlog stationary as expected'
|
||||
}
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
--echo
|
||||
--echo # On node_2 (not replicated)
|
||||
--echo
|
||||
--connection node_2
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
--echo #
|
||||
--echo # Run on zoneinfo directory without --skip-write-binlog
|
||||
--echo #
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
|
||||
|
||||
--echo
|
||||
--echo # Apply on node_1
|
||||
--echo
|
||||
--connection node_1
|
||||
|
||||
--echo load timezones
|
||||
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
|
||||
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
|
||||
|
||||
if ($snap_pos < $new_snap_pos)
|
||||
{
|
||||
--echo 'binlog advanced as expected'
|
||||
}
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
--echo
|
||||
--echo # On node_2 (replicated via InnoDB)
|
||||
--echo
|
||||
--connection node_2
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
TRUNCATE TABLE time_zone;
|
||||
TRUNCATE TABLE time_zone_name;
|
||||
TRUNCATE TABLE time_zone_transition;
|
||||
TRUNCATE TABLE time_zone_transition_type;
|
||||
TRUNCATE TABLE time_zone_leap_second;
|
||||
|
||||
--echo
|
||||
--echo # Apply on node_1 (with wsrep_on=OFF)
|
||||
--echo
|
||||
--connection node_1
|
||||
|
||||
SET GLOBAL WSREP_ON=OFF;
|
||||
--let $snap_pos= $new_snap_pos
|
||||
--echo load timezones
|
||||
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
|
||||
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
|
||||
SET GLOBAL WSREP_ON=ON;
|
||||
|
||||
if ($snap_pos < $new_snap_pos)
|
||||
{
|
||||
--echo 'binlog advanced as expected'
|
||||
}
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
--echo
|
||||
--echo # On node_2 (Should not have been replicated)
|
||||
--echo
|
||||
--connection node_2
|
||||
|
||||
SELECT COUNT(*) FROM time_zone;
|
||||
SELECT COUNT(*) FROM time_zone_name;
|
||||
SELECT COUNT(*) FROM time_zone_transition;
|
||||
SELECT COUNT(*) FROM time_zone_transition_type;
|
||||
SELECT COUNT(*) FROM time_zone_leap_second;
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
--connection node_1
|
||||
--remove_file $MYSQL_TMP_DIR/tz.sql
|
||||
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
|
||||
DROP TABLE time_zone;
|
||||
DROP TABLE time_zone_name;
|
||||
DROP TABLE time_zone_transition;
|
||||
DROP TABLE time_zone_transition_type;
|
||||
DROP TABLE time_zone_leap_second;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
Reference in New Issue
Block a user