Skip to content

Commit

Permalink
MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (…
Browse files Browse the repository at this point in the history
…0000)#

MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
  • Loading branch information
Alexander Barkov committed Jun 4, 2015
1 parent a8b8544 commit 9da8a8f
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 2 deletions.
21 changes: 21 additions & 0 deletions mysql-test/r/type_decimal.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
1 change: 1 addition & 0 deletions mysql-test/std_data/old_decimal/t1dec102.MYD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
� 123.45� 123.46� 123.47
Binary file added mysql-test/std_data/old_decimal/t1dec102.MYI
Binary file not shown.
Binary file added mysql-test/std_data/old_decimal/t1dec102.frm
Binary file not shown.
65 changes: 65 additions & 0 deletions mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
Original file line number Diff line number Diff line change
Expand Up @@ -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*/;
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions mysql-test/t/type_decimal.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
2 changes: 1 addition & 1 deletion sql/field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 6 additions & 0 deletions sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 9da8a8f

Please sign in to comment.