Skip to content

Commit

Permalink
MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
Browse files Browse the repository at this point in the history
  • Loading branch information
abarkov committed Oct 8, 2019
1 parent 89bd562 commit 6ea5c2b
Show file tree
Hide file tree
Showing 27 changed files with 4,448 additions and 10 deletions.
34 changes: 34 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.result
@@ -0,0 +1,34 @@
CREATE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('::');
INSERT INTO t1 VALUES ('ffff::ffff');
PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
EXECUTE stmt USING CAST('::1' AS INET6);
EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS INET6);
DEALLOCATE PREPARE stmt;
BEGIN NOT ATOMIC
DECLARE a INET6 DEFAULT '::3';
INSERT INTO t1 VALUES (a);
END;
$$
DROP TABLE t1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INET6)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('ffff::ffff')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::1')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::2')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ( NAME_CONST('a','::3'))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
28 changes: 28 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.test
@@ -0,0 +1,28 @@
--source include/not_embedded.inc
--source include/have_binlog_format_statement.inc

--disable_query_log
reset master; # get rid of previous tests binlog
--enable_query_log

CREATE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('::');
INSERT INTO t1 VALUES ('ffff::ffff');

PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
EXECUTE stmt USING CAST('::1' AS INET6);
EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS INET6);
DEALLOCATE PREPARE stmt;

DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE a INET6 DEFAULT '::3';
INSERT INTO t1 VALUES (a);
END;
$$
DELIMITER ;$$

DROP TABLE t1;

--let $binlog_file = LAST
source include/show_binlog_events.inc;
17 changes: 17 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.result
@@ -0,0 +1,17 @@
include/master-slave.inc
[connection master]
#
# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
#
connection master;
CREATE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('::'),('ffff::ffff');
connection slave;
SELECT HEX(a), a FROM t1;
HEX(a) a
00000000000000000000000000000000 ::
FFFF000000000000000000000000FFFF ffff::ffff
connection master;
DROP TABLE t1;
connection slave;
include/rpl_end.inc
16 changes: 16 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.test
@@ -0,0 +1,16 @@
--source include/master-slave.inc

--echo #
--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
--echo #

connection master;
CREATE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('::'),('ffff::ffff');
sync_slave_with_master;
SELECT HEX(a), a FROM t1;
connection master;
DROP TABLE t1;
sync_slave_with_master;

--source include/rpl_end.inc
18 changes: 18 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result
@@ -0,0 +1,18 @@
#
# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
#
SET @old_debug_dbug=@@debug_dbug;
SET debug_dbug="+d,frm_data_type_info";
CREATE TABLE t1 (c01 INET6, c02 INET6);
Warnings:
Note 1105 build_frm_image: Field data type info length: 14
Note 1105 DBUG: [0] name='c01' type_info='inet6'
Note 1105 DBUG: [1] name='c02' type_info='inet6'
SET debug_dbug=@old_debug_dbug;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c01` inet6 DEFAULT NULL,
`c02` inet6 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
14 changes: 14 additions & 0 deletions plugin/type_inet/mysql-test/type_inet/type_inet6-debug.test
@@ -0,0 +1,14 @@
--source include/have_debug.inc

--echo #
--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
--echo #

SET @old_debug_dbug=@@debug_dbug;

SET debug_dbug="+d,frm_data_type_info";
CREATE TABLE t1 (c01 INET6, c02 INET6);
SET debug_dbug=@old_debug_dbug;

SHOW CREATE TABLE t1;
DROP TABLE t1;

0 comments on commit 6ea5c2b

Please sign in to comment.