Bug #115608 Inplace ALTER TABLE might cause lost rows if concurrent purge
| Submitted: | 16 Jul 2024 13:10 | Modified: | 16 Jan 2025 16:53 |
|---|---|---|---|
| Reporter: | Dmitry Lenev (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
| Version: | 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[16 Jul 2024 13:10]
Dmitry Lenev
[16 Jul 2024 13:35]
MySQL Verification Team
Hi Mr. Lenev,
Thank you for your bug report.
We already had a debug mysqld binary built with the same DBUG_SYNC as in the previous bug, so we just ran the test.
We repeated your results:
--------------------------------------------------
ogging: ./mysql-test-run.pl t/dmitry_115608.test
mysqld(4334,0x7ff850649fc0) malloc: nano zone abandoned due to inability to reserve vm space.
MySQL Version 8.0.38
Checking supported features
- Binaries are debug compiled
mysqltest(4336,0x7ff850649fc0) malloc: nano zone abandoned due to inability to reserve vm space.
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '...../mysql-test/var'
Installing system database
Using parallel: 1
==============================================================================
TEST NAME RESULT TIME (ms) COMMENT
------------------------------------------------------------------------------
[ 50%] main.dmitry_115608 [ fail ] Found warnings/errors in error log file!
Test ended at 2024-07-16 16:29:08
include/load_error_log.inc
line
Mysqltest client output from logfile
----------- MYSQLTEST OUTPUT START -----------
CREATE TABLE t1 (pk CHAR(5) PRIMARY KEY);
INSERT INTO t1 VALUES ('aaaaa'), ('bbbbb'), ('bbbcc'), ('ccccc'), ('ddddd'), ('eeeee');
set global innodb_purge_stop_now=ON;
DELETE FROM t1 WHERE pk = 'bbbcc';
SET DEBUG='+d,ddl_buf_add_two';
SET DEBUG_SYNC='ddl_bulk_inserter_latches_released SIGNAL latches_released WAIT_FOR go';
ALTER TABLE t1 ENGINE=InnoDB, ALGORITHM=INPLACE;
SET DEBUG_SYNC='now WAIT_FOR latches_released';
SET GLOBAL innodb_purge_run_now=ON;
SET DEBUG_SYNC='now SIGNAL go';
SELECT * FROM t1;
pk
aaaaa
bbbbb
ccccc
eeeee
SET DEBUG='-d,ddl_buf_add_two';
DROP TABLE t1;
------------ MYSQLTEST OUTPUT END -----------
- the logfile can be found in ......./log/main.dmitry_115608/dmitry_115608.log'
[100%] shutdown_report [ pass ]
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 0.000 of 58 seconds executing testcases
Completed: Failed 1/2 tests, 50.00% were successful.
Failing test(s): main.dmitry_115608
--------------------------------------------------
This bug is now verified for 8.0, 8.4 and 9.0
Thank you for your contribution.
Many regards .......
[18 Jul 2024 21:54]
Dmitry Lenev
Tentative fix for the lost rows problem. (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: ps-9144-bug115608-contrib.patch (text/x-patch), 10.55 KiB.
[18 Jul 2024 21:57]
Dmitry Lenev
Hello! I am adding a patch with tentative fix to the problem described in this bug above. It would be nice if this area/code got some attention from the MySQL team as it seems that there are more bugs lurking there.
[18 Jul 2024 21:58]
Dmitry Lenev
Forgot to add that the submitted patch is against MySQL Server 8.0.38 sources.
[19 Jul 2024 9:45]
MySQL Verification Team
Thank you, Mr. Lenev, for your contribution.
[12 Dec 2024 4:13]
Rahul Sisondia
Posted by developer: Thank you Dmitry for the contribution along with beautiful test case. Updates: This bug is fixed in upcoming 8.0.41 release.
[12 Dec 2024 11:02]
MySQL Verification Team
Thank you, Rahul. It is our opinion that this bug report can be closed now ......
[16 Jan 2025 16:53]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Server 8.0.41, 8.4.4, and 9.2.0 releases, and here's the proposed changelog entry from the documentation team for review: An ALTER TABLE operation that rebuilt an InnoDB table using the INPLACE algorithm potentially led to losing a row of data if a concurrent purge happened on the altered table that contained a clustered or spatial index. Our thanks to Dmitry Lenev and the team at Percona for contributing to this fix. Thank you for the bug report.
[16 Jan 2025 17:06]
MySQL Verification Team
Thank you, Philip.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.066 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.