[MDEV-16886] mysqdump --master-data=N crashes when SELECT BINLOG_GTID_POS() returns NULL for current master coordinates, for whatever reason Created: 2018-08-02 Updated: 2022-02-22 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Backup, Scripts & Clients |
| Affects Version/s: | 10.2.11, 10.2.16 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Valerii Kravchuk | Assignee: | Brandon Nesterenko |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
RHEL with kernel 3.10.0-862.3.2.el7.x86_64 |
||
| Issue Links: |
|
||||||||
| Description |
|
Sometimes it happens so that SELECT BINLOG_GTID_POS() returns NULL for specific master coordinates that come from SHOW MASTER STATUS:
It seems the code of mysqldump is not ready for this, see https://github.com/MariaDB/server/blob/10.2/client/mysqldump.c#L1298:
As a result, it crashes with the following backtrace:
becasue src in strmake call is 0. This should be checked and crash should be prevented. It's better to generate CHANGE MASTER with normal binary log name and position coordinates (and output a warning about the problem with getting GTID) than just crash silently. |
| Comments |
| Comment by Valerii Kravchuk [ 2018-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Sorry, it seems my conclusions based on older code, but anyway, both SELECT @@GLOBAL.gtid_binlog_pos and SELECT @@GLOBAL.gtid_slave_pos may also return NULL.according to KB (see https://mariadb.com/kb/en/library/gtid/#gtid_binlog_pos), and it seems this case is not taken into account. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I don't see why gtid_binlog_pos would ever be NULL, so while crashing mysqldump doesn't look good, I'm afraid it's the least of our problems in this case. Maybe it's even beneficial that it crashed rather than write some garbage to the dump file and pretend that nothing happened. Let's find out first why it is NULL. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Valerii Kravchuk [ 2018-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I know at least one easy way to get NULL there:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It's not NULL, it's empty line. Empty lines are easy, but I don't expect them to cause any troubles. Do they? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Valerii Kravchuk [ 2018-08-03 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Indeed, it's empty string, '', and mysqldump works with that. So, we still have to figure out what exactly happens in that crashing case. Manual clearly states, though, that we may get the value of NULL, and mysqldump is not ready for that. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Valerii Kravchuk [ 2018-08-03 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Important details: this started to happen since kernel upgrade from kernel-3.10.0-327.18.2.el7.x86_64 to 3.10.0-862.3.2.el7.x86_64 (Meltdown related). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-08-03 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I'm assigning it to sachin.setiya.007 to fix the mysqldump crash, although I still think that it is merely a cosmetic issue – I agree, it doesn't look good when it crashes, but nothing bad really happens. It's not the server where each crash is a temporary DoS at least, and potential data corruption at worst; and on the bright side, with the failing mysqldump there are more chances that the problem won't be overlooked. The underlying issue, that BINLOG_GTID_POS and MASTER STATUS somehow went out of sync, seems much more severe. mysqldump, if it runs with options which make it be aware of master/slave status, must fail if such discrepancy occur, the only difference should be that it produces a proper error message. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2018-09-05 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This will solve the mysqldump issue , but why we are getting gtid null it will require more investigation
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-09-26 ] | ||||||||||||||||||||||||||||||||||||||||||
|
sachin.setiya.007 Something like
would make NULL out of the function.
where $i=1,2. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-10-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
To refine my previous comment, actually "physical" presence of gtid is not necessary and mere a reference SHOW STATUS LIKE 'binlog_snapshot_%' results which provide the functions' arguments. E.g in case the offset does not point at the end of an event (e.g to an non-existing "future" byte) the function indeed returns NULL. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2018-10-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Hi! Can you provide "Show binlog events " for latest binary log file | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-10-16 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Seeing the binlog file:pos as correct we shall suspect reading "dirty" data from binlog by SELECT BINLOG_GTID_POS() which seems to be possible through | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-10-16 ] | ||||||||||||||||||||||||||||||||||||||||||
|
'Relates to' is set only to retain the benefit of a doubt. |