Bug #100328 | Inconsistent behavior with isolation levels when binlog enabled | ||
---|---|---|---|
Submitted: | 27 Jul 2020 6:00 | Modified: | 23 Oct 2020 10:22 |
Reporter: | Pranay Motupalli | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
Version: | 5.6,5.7,8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[27 Jul 2020 6:00]
Pranay Motupalli
[27 Jul 2020 6:01]
Pranay Motupalli
Test outputs
Attachment: Test Ouputs.txt (text/plain), 17.65 KiB.
[27 Jul 2020 6:02]
Pranay Motupalli
Test Outputs formatted image
Attachment: image.png (image/png, text), 1.05 MiB.
[27 Jul 2020 6:12]
Pranay Motupalli
gdb and tracing.txt
Attachment: gdb and tracing.txt (text/plain), 8.30 KiB.
[30 Jul 2020 4:15]
MySQL Verification Team
Hello Pranay, Thank you for the report and test case. regards, Umesh
[13 Aug 2020 19:09]
Pedro Figueiredo
Posted by developer: Hi. AFAICS, this bug is also reproducible without binary logging enabled, more specifically, whenever the following conditions are met: 1. Two concurrent transactions, T1 and T2 want to update the same column of the same record. 2. T1 commits before T2 executes the update. 3. In T2 if the column being updated (in the `TABLE::write_set` bitmap) is also in the `TABLE::read_set` bitmap and the new column value provided in T2 is exactly the same as in T1. Please, check the attached diff `isolation_level_test_case.diff` (debug sync point and MTR test) for a more clear example. Execute MTR with `--mysqld=--skip-log-bin`: $ ./mtr --no-check-testcases --mysqld=--skip-log-bin isolation_level The issue is more visible with binary logging enabled since it changes write set and read set bitmaps, in some cases setting all bits to 1 in both. Since the issue only happens when the column updated value is the same in both transactions, it doesn't seem related to binary logging. Therefore, IMHO, analysis from the Optimizer team is needed in order to understand what is happening with the update plan. Thank you for your time. Regards,
[13 Aug 2020 19:11]
Pedro Figueiredo
isolation_level_test_case.diff
Attachment: isolation_level_test_case.diff (text/x-patch), 3.58 KiB.
[25 Aug 2020 13:56]
Pedro Figueiredo
Posted by developer: The problem is reproducible without artificially setting the column bit in `read_set` bitmap, as visible in the `isolation_level_02.test` file, attached. Regards,
[25 Aug 2020 13:57]
Pedro Figueiredo
isolation_level_02.test
Attachment: isolation_level_02.test (application/octet-stream, text), 2.40 KiB.
[23 Sep 2021 10:40]
Dmitry Lenev
Posted by developer: Hello! The following simple test case for MTR framework shows that the problem is repeatable without binary log enabled and without additional changes to code to adjust the read-set bitmap: --enable_connect_log create table t(a int, b int) engine=innodb; insert into t values (1, 0), (2, 1), (3, 2); set transaction isolation level repeatable read; begin; select * from t; connect (addconroot1, localhost, root,,); begin; update t set a = 10 where b = 1; commit; connection default; select * from t; update t set a = 10 where a; select * from t; # The above returns (which is wrong!) # a b # 10 0 # 2 1 # 10 2 commit; In fact with this test case the problem is repeatable even in 5.5 tree (for 5.5.65-git to be exact).
[23 Sep 2021 11:57]
Dmitry Lenev
Posted by developer: Bug #104986/#33385596 "Weird SELECT View when a record is modified to a same value by two transactions" has been marked as a duplicate of this one.
[17 Jul 2022 4:40]
MySQL Verification Team
Related: https://bugs.mysql.com/bug.php?id=107887
[19 Mar 12:55]
MySQL Verification Team
This bug is the original bug report for the following bug, as well: https://bugs.mysql.com/bug.php?id=114389