enhanced binlog row verbose shown for the escape characters
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.1 |
Won't Fix
|
Wishlist
|
Unassigned | |||
5.5 |
Triaged
|
Wishlist
|
Unassigned | |||
5.6 |
Triaged
|
Wishlist
|
Unassigned | |||
5.7 |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
For mysqlbinlog client tool, when configured with -v (verbose) for row formatted binlog, the escape chars are shown with processed while not like the inserting buffer. Take examples below:
root@test 09:50:47>show create table tx;
+------
| Table | Create Table |
+------
| tx | CREATE TABLE `tx` (
`a` varchar(5) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+------
1 row in set (0.01 sec)
root@test 09:50:58>insert into tx values('a\'b');
Query OK, 1 row affected (0.01 sec)
root@test 09:56:47>insert into tx values('a\tb');
Query OK, 1 row affected (0.00 sec)
root@test 10:06:01>insert into tx values('a\bb');
Query OK, 1 row affected (0.00 sec)
root@test 10:06:04>insert into tx values('a\0b');
Query OK, 1 row affected (0.00 sec)
$sudo mysqlbinlog --no-defaults /u01/mysqld/
### INSERT INTO test.tx
### SET
### @1='a'b'
### INSERT INTO test.tx
### SET
### @1='a\x09b'
### INSERT INTO test.tx
### SET
### @1='a\x08b'
### INSERT INTO test.tx
### SET
### @1='a\x00b'
While we changed the @1 value shown as below:
$sudo mysqlbinlog --no-defaults /u01/mysqld/
### INSERT INTO test.tx
### SET
### @1='a\'b'
### INSERT INTO test.tx
### SET
### @1='a\tb'
### INSERT INTO test.tx
### SET
### @1='a\bb'
### INSERT INTO test.tx
### SET
### @1='a\0b'
There is no problem for the first shown, while we expect the later shown for two reasons:
1. more readable of column values for mysqlbinlog -v
2. for some special usage (extra string from ###@1 for another usage, like constructing SQL and applying to mysqld)
We changed the verbose shown for the second usage, and everything works well.
All test case passed, as well as the newly added one.
Patch is attached for review.
Changed in percona-server: | |
importance: | Undecided → Wishlist |
Tweaked with another two issues: description_ log_event ...
1. malformed binlog: it does not contain any Format_
It's a legal case while treated fatal error. detail could refer to #12354268
2. "(xxx)" for data type of bigint with negative numbers, which is unnecessary.
A compile switch is provided, that is BINLOG_ ROW_VERBOSE_ SHOW_LEGACY, which is undefined by default, therefore, the default behavior is making the patch enables.