summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-09-24 15:07:42 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-09-28 12:52:09 +0530
commit15cd9195353282e54e109962d46e1900c9eff3d4 (patch)
tree9fe57d1e0e6a8aa4d9f1a163eada7f204c19dc01
parente0f5e7bc9ef306a76c5bf4e067ee5c1a9a7b6187 (diff)
downloadmariadb-git-15cd9195353282e54e109962d46e1900c9eff3d4.tar.gz
MDEV-22330: mysqlbinlog stops with an error Don't know how to handle column type: 255 meta: 4 (0004)
Analysis: ======== "mysqlbinlog -v" option will reconstruct row events and display them as commented SQL statements. If this option is given twice, the output includes comments to indicate column data types and some metadata. `log_event_print_value` is the function reponsible for printing values and their types. This function doesn't handle GEOMETRY type. Hence the above error gets printed. Fix: === Add support for GEOMETRY datatype.
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result56
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test14
-rw-r--r--sql/log_event.cc17
3 files changed, 80 insertions, 7 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 9a3f4751165..0b05c4f449f 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -339,7 +339,11 @@ a
123.47
999.99
DROP TABLE t1dec102;
-flush logs;
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (POINT(10,10));
+DROP TABLE t1;
+FLUSH LOGS;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -4623,6 +4627,56 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1dec102` /* generated by server */
/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-321 ddl
+/*!100001 SET @@session.gtid_seq_no=321*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL)
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-322
+/*!100001 SET @@session.gtid_seq_no=322*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=NULL /* GEOMETRY meta=4 nullable=1 is_null=1 */
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-323
+/*!100001 SET @@session.gtid_seq_no=323*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1='\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00$@\x00\x00\x00\x00\x00\x00$@' /* GEOMETRY meta=4 nullable=1 is_null=0 */
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-324 ddl
+/*!100001 SET @@session.gtid_seq_no=324*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
index 0c94d968338..93c26cc57a2 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
@@ -450,7 +450,19 @@ INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
DROP TABLE t1dec102;
-flush logs;
+
+#
+# MDEV-22330: mysqlbinlog stops with an error Don't know how to handle column
+# type: 255 meta: 4 (0004)
+# Check support for GEOMETRY type with verbose mode.
+#
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL);
+
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (POINT(10,10));
+DROP TABLE t1;
+
+FLUSH LOGS;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 4d7bb1726ed..3d28c249e21 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2575,13 +2575,20 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
"Not enough metadata to display the value. ");
break;
+ case MYSQL_TYPE_GEOMETRY:
+ strmake(typestr, "GEOMETRY", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= uint4korr(ptr);
+ my_b_write_quoted(file, ptr + meta, length);
+ return length + meta;
+
default:
{
- char tmp[5];
- my_snprintf(tmp, sizeof(tmp), "%04x", meta);
- my_b_printf(file,
- "!! Don't know how to handle column type=%d meta=%d (%s)",
- type, meta, tmp);
+ fprintf(stderr,
+ "\nError: Don't know how to handle column type: %d meta: %d (%04x)\n",
+ type, meta, meta);
}
break;
}