[MDEV-26671] Inconsistent SELECT View when modify a record added by another transaction Created: 2021-09-24  Updated: 2021-11-01

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.5.12
Fix Version/s: 10.5, 10.6

Type: Bug Priority: Major
Reporter: dinary Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 1
Labels: innodb
Environment:

OS: Ubuntu-20.04


Issue Links:
Relates
relates to MDEV-26642 Weird SELECT view when a record is mo... Confirmed
relates to MDEV-26643 Inconsistent behaviors of UPDATE unde... Open

 Description   

If a transaction modifies an inserted record by a concurrent transaction,
the visibility of this new record for the current transaction depends on the value of the inserted record.

This issue is similar to the issue reported in

https://jira.mariadb.org/browse/MDEV-26643

but the trigger conditions and behaviors of them are different.

How to repeat:

/* init */ drop table if exists t;
/* init */ create table t(a int, b int);
/* init */ insert into t values (0, 0), (1, 1);
 
/* s1 */ begin;
/* s1 */ select * from t; -- [(0, 0), (1, 1)]
/* s2 */ begin;
/* s2 */ insert into t values (10, 2);
/* s2 */ commit;
/* s1 */ select * from t; -- [(0, 0), (1, 1)]
/* s1 */ update t set a = 10 where true;
/* s1 */ select * from t;  -- [(10, 0), (10, 1)]
/* s1 */ commit;
 
-------------------------------------------------------------
 
/* init */ drop table if exists t;
/* init */ create table t(a int, b int);
/* init */ insert into t values (0, 0), (1, 1);
 
/* s1 */ begin;
/* s1 */ select * from t; -- [(0, 0), (1, 1)]
/* s2 */ begin;
/* s2 */ insert into t values (11, 2);
/* s2 */ commit;
/* s1 */ select * from t; -- [(0, 0), (1, 1)]
/* s1 */ update t set a = 10 where true;
/* s1 */ select * from t;  -- [(10, 0), (10, 1), (10, 2)]
/* s1 */ commit;



 Comments   
Comment by Marko Mäkelä [ 2021-11-01 ]

I suspect that the root cause of this the way how InnoDB read views work. I posted some explanation and executable test cases in MDEV-26642.

Generated at Thu Feb 08 09:47:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.