← Back to team overview

maria-developers team mailing list archive

Please review MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (0000)#

 

Hi Sergei,

Please review a joint patch for:

MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (0000)#

MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL

Thanks.
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index f8649f0..cde8816 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -994,3 +994,24 @@ GROUP BY t2.col0
 WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
 1
 DROP TABLE t1, t2;
+#
+# Start of 5.5 tests
+#
+#
+# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+#
+SHOW CREATE TABLE t1dec102;
+Table	Create Table
+t1dec102	CREATE TABLE `t1dec102` (
+  `a` decimal(10,2)/*old*/ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW COLUMNS FROM t1dec102;
+Field	Type	Null	Key	Default	Extra
+a	decimal(10,2)/*old*/	YES		NULL	
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+COLUMN_NAME	DATA_TYPE	COLUMN_TYPE
+a	decimal	decimal(10,2)/*old*/
+DROP TABLE t1dec102;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYD b/mysql-test/std_data/old_decimal/t1dec102.MYD
new file mode 100644
index 0000000..59e4385
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.MYD
@@ -0,0 +1 @@
+ý      123.45ý      123.46ý      123.47
\ No newline at end of file
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYI b/mysql-test/std_data/old_decimal/t1dec102.MYI
new file mode 100644
index 0000000..e0b2d4a
Binary files /dev/null and b/mysql-test/std_data/old_decimal/t1dec102.MYI differ
diff --git a/mysql-test/std_data/old_decimal/t1dec102.frm b/mysql-test/std_data/old_decimal/t1dec102.frm
new file mode 100644
index 0000000..652cfc3
Binary files /dev/null and b/mysql-test/std_data/old_decimal/t1dec102.frm differ
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index fc22085..469e670 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
 INSERT INTO t2 SET b=1;
 UPDATE t1, t2 SET t1.a=10, t2.a=20;
 DROP TABLE t1,t2;
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+a
+-999.99
+0.00
+123.45
+123.46
+123.47
+999.99
+DROP TABLE t1dec102;
 flush logs;
 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -4131,6 +4143,59 @@ SET TIMESTAMP=1000000000/*!*/;
 DROP TABLE `t1`,`t2` /* generated by server */
 /*!*/;
 # at #
+#010909  4:46:40 server id 1  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909  4:46:40 server id 1  end_log_pos # 	Table_map: `test`.`t1dec102` mapped to number #
+#010909  4:46:40 server id 1  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+###   @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # 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 # 	Query	thread_id=#	exec_time=#	error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909  4:46:40 server id 1  end_log_pos # 	Table_map: `test`.`t1dec102` mapped to number #
+#010909  4:46:40 server id 1  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+###   @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # 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 # 	Query	thread_id=#	exec_time=#	error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909  4:46:40 server id 1  end_log_pos # 	Table_map: `test`.`t1dec102` mapped to number #
+#010909  4:46:40 server id 1  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+###   @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # 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 # 	Query	thread_id=#	exec_time=#	error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+DROP TABLE `t1dec102` /* 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 9b41c63..9609a9a 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
 UPDATE t1, t2 SET t1.a=10, t2.a=20;
 DROP TABLE t1,t2;
 
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+DROP TABLE t1dec102;
+
 flush logs;
 
-let $MYSQLD_DATADIR= `select @@datadir`;
 --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/
 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 1d4ef34..659e752 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -583,3 +583,27 @@ JOIN
 WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
 
 DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+SHOW CREATE TABLE t1dec102;
+SHOW COLUMNS FROM t1dec102;
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+DROP TABLE t1dec102;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/sql/field.cc b/sql/field.cc
index 52a4909..68daba3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2483,7 +2483,7 @@ void Field_decimal::sql_type(String &res) const
   if (dec)
     tmp--;
   res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
-			  "decimal(%d,%d)",tmp,dec));
+			  "decimal(%d,%d)/*old*/",tmp,dec));
   add_zerofill_and_unsigned(res);
 }
 
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d04ac1e..e63884e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2192,6 +2192,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
     my_snprintf(typestr, typestr_length, "STRING(%d)", length);
     return my_b_write_quoted_with_length(file, ptr, length);
 
+  case MYSQL_TYPE_DECIMAL:
+    my_b_printf(file,
+                "!! Old DECIMAL (mysql-4.1 or earlier). "
+                "Not enough metadata to display the value. ");
+    break;
+
   default:
     {
       char tmp[5];

Follow ups