summaryrefslogtreecommitdiff
path: root/mysql-test/extra/rpl_tests
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2018-10-03 21:45:05 +0300
committerAndrei Elkin <andrei.elkin@mariadb.com>2018-10-16 12:56:33 +0300
commit2308b9afec559cd8c5717007a7ad6821c374370d (patch)
treedce30fd30cb6a5b6952b8f505fafec49a8ed8dc8 /mysql-test/extra/rpl_tests
parent2d4075e1d9dba3dd8503d65fdb145a6dcc056c51 (diff)
downloadmariadb-git-2308b9afec559cd8c5717007a7ad6821c374370d.tar.gz
MDEV-17098 DATE -> DATETIME replication conversion not working, even in ALL_NON_LOSSY mode
Opened up MYSQL_TYPE _DATETIME{,2} <-> _NEWDATE conversions for replication.
Diffstat (limited to 'mysql-test/extra/rpl_tests')
-rw-r--r--mysql-test/extra/rpl_tests/check_type.inc8
-rw-r--r--mysql-test/extra/rpl_tests/type_conversions.test91
2 files changed, 99 insertions, 0 deletions
diff --git a/mysql-test/extra/rpl_tests/check_type.inc b/mysql-test/extra/rpl_tests/check_type.inc
index 97300753d38..baba7a21e86 100644
--- a/mysql-test/extra/rpl_tests/check_type.inc
+++ b/mysql-test/extra/rpl_tests/check_type.inc
@@ -24,11 +24,19 @@ connection master;
disable_warnings;
DROP TABLE IF EXISTS t1;
enable_warnings;
+if ($source_temp_format)
+{
+ --eval SET @@global.mysql56_temporal_format= $source_temp_format
+}
eval CREATE TABLE t1(
pk INT NOT NULL PRIMARY KEY,
a $source_type
) ENGINE=$engine_type;
sync_slave_with_master;
+if ($target_temp_format)
+{
+ --eval SET @@global.mysql56_temporal_format= $source_temp_format
+}
eval ALTER TABLE t1 MODIFY a $target_type;
connection master;
diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test
index b013d471f01..511d59e3633 100644
--- a/mysql-test/extra/rpl_tests/type_conversions.test
+++ b/mysql-test/extra/rpl_tests/type_conversions.test
@@ -1007,5 +1007,96 @@ source extra/rpl_tests/check_type.inc;
--echo # End of MDEV-15833
+--echo #
+--echo # MDEV-17098 DATE <-> DATETIME
+--echo #
+
+# NON-LOSSY
+let $source_temp_format= 1; # irrelevant with DATE though
+let $source_type= DATE;
+let $target_temp_format= 1; # to produce MYSQL_TYPE_DATETIME2
+let $target_type= DATETIME(6);
+let $source_value= '2018-10-11';
+let $target_value= '2018-10-11 00:00:00.000000';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_temp_format= 1;
+let $source_type= DATE;
+let $target_temp_format= 0; # to produce "old" MYSQL_TYPE_DATETIME
+let $target_type= DATETIME(6);
+let $source_value= '2018-10-11';
+let $target_value= '2018-10-11 00:00:00.000000';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_temp_format= 0;
+let $source_type= DATE;
+let $target_temp_format= 1;
+let $target_type= DATETIME(6);
+let $source_value= '2018-10-11';
+let $target_value= '2018-10-11 00:00:00.000000';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+# zero-precision test version
+let $source_temp_format= 1;
+let $source_type= DATE;
+let $target_temp_format= 1;
+let $target_type= DATETIME(0);
+let $source_value= '2018-10-11';
+let $target_value= '2018-10-11 00:00:00';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+# LOSSY
+let $source_temp_format= 1;
+let $source_type= DATETIME(6);
+let $target_temp_format= 1;
+let $target_type= DATE;
+let $source_value= '2018-10-11 00:00:00.000001';
+let $target_value= '2018-10-11';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_temp_format= 1;
+let $source_type= DATETIME(6);
+let $target_temp_format= 0;
+let $target_type= DATE;
+let $source_value= '2018-10-11 00:00:00.000001';
+let $target_value= '2018-10-11';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+# zero-precision test version
+let $source_temp_format= 1;
+let $source_type= DATETIME(0);
+let $target_temp_format= 1;
+let $target_type= DATE;
+let $source_value= '2018-10-11 00:00:00';
+let $target_value= '2018-10-11';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+# TODO: fix MDEV-17394 Row-based replication DATETIME(m) to
+# DATETIME(s) does not work or incorrect
+#
+#
+# let $source_temp_format= 0;
+# let $source_type= DATETIME(6);
+# let $target_temp_format= 1;
+# let $target_type= DATE;
+# ...
+# let $source_temp_format= 0;
+# let $source_type= DATETIME(6);
+# let $target_temp_format= 0;
+# let $target_type= DATE;
+# ...
+
+let $source_temp_format=;
+let $target_temp_format=;
+--echo # End of MDEV-17098
+
+
--source include/rpl_reset.inc
enable_query_log;