[MDEV-25444] mysql --binary-mode is not able to replay some mysqlbinlog outputs Created: 2021-04-18 Updated: 2022-01-04 Resolved: 2021-10-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.3.16, 10.3.23, 10.3.29, 10.2.40 |
| Fix Version/s: | 10.2.41, 10.3.32, 10.4.22, 10.5.13, 10.6.5, 10.7.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Valerii Kravchuk | Assignee: | Brandon Nesterenko |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
There are still cases when prepared statements (for example, from Java) generate binary logs that can not be replayed without errors like:
while doing point in time recovery with mysqlbinlog ... | mysql --binary-mode=1 ... command lines. Consider this example:
Java code is:
It was built this way:
The content of my ~/Documents that matters is attached. Nothe *.bin files (they all have the same content, but I can not reproduce easily without other files so far). |
| Comments |
| Comment by Valerii Kravchuk [ 2021-04-18 ] | |||||||||||||||||||||||||||
|
MariaDB server was started with mostly default options:
| |||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-04-19 ] | |||||||||||||||||||||||||||
|
valerii, and if you add -vvv to the mysql command line — what command causes the error? | |||||||||||||||||||||||||||
| Comment by Valerii Kravchuk [ 2021-04-19 ] | |||||||||||||||||||||||||||
|
I've executed: openxs@ao756:~/dbs/maria10.3$ bin/mysqlbinlog data/ao756-bin.000001 | bin/mysql -vvv -uroot --socket=/tmp/mariadb.sock --binary-mode=1 test and got this:
| |||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-11 ] | |||||||||||||||||||||||||||
|
I am able to hit the bug | |||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-11 ] | |||||||||||||||||||||||||||
|
Issue is with all.tgz file, If i only insert all.tgz I get this error
| |||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-12 ] | |||||||||||||||||||||||||||
|
So the end of insert query shown by mysqlbinlog
But when it goes to mariadb end of insert query
We can see some later query gets concatenated into the insert query, That is why we are getting syntax error | |||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-18 ] | |||||||||||||||||||||||||||
|
There is one common bytes in all the files where we are getting syntax error. (0x5c00) So If I do insert binary file into table `tb` with the data 5c00 And dump the binary logs and read from the binary logs , I am getting the same error | |||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-19 ] | |||||||||||||||||||||||||||
|
Branch bb-10.3-25444 | |||||||||||||||||||||||||||
| Comment by Brandon Nesterenko [ 2021-09-17 ] | |||||||||||||||||||||||||||
|
I agree with Sachin's findings, his patch is ready for review. Commit: 39599f3 Buildbot: bb-10.3-25444 | |||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2021-09-27 ] | |||||||||||||||||||||||||||
|
diego dupin: thank you for the tip! We're adding a test for that as well. | |||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2021-10-05 ] | |||||||||||||||||||||||||||
|
Thanks for this work including in-depth analysis. | |||||||||||||||||||||||||||
| Comment by Brandon Nesterenko [ 2021-10-05 ] | |||||||||||||||||||||||||||
|
Manual cherry-picking of these changes (commits 10cd281 from Sachin, and 1755ea4 as my refinements) resulted in no merge conflicts to any later version branches. |