diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-05-28 22:22:19 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-05-28 22:22:19 +0300 |
commit | dd9773b72380eeb98b9dabba219452f29ee5603b (patch) | |
tree | 5f2d64cf0c82f8532e8d3269f96fee1ea77a1d43 /mysql-test/suite/versioning/t/partition.test | |
parent | 3e9b96b6ff925f83427600956b86a984b726d3af (diff) | |
download | mariadb-git-dd9773b72380eeb98b9dabba219452f29ee5603b.tar.gz |
MDEV-22413 Server hangs upon UPDATE on a view reading from versioned partitioned table
UPDATE gets access to history records because versioning conditions
are not set for VIEW. This leads to endless loop of inserting history
records when clustered index is rebuilt and ha_rnd_next() returns
newly inserted history record.
Return back original behavior of failing on write-locked table in
historical query.
35b679b9 assumed that SELECT_LEX::lock_type influences anything, but
actually at this point table is already locked. Original bug report
was tempesta-tech/mariadb#102
Diffstat (limited to 'mysql-test/suite/versioning/t/partition.test')
-rw-r--r-- | mysql-test/suite/versioning/t/partition.test | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 6fee6f43847..6cd88caf1a9 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -583,7 +583,6 @@ update t1 left join t2 on a > b set b= 2 order by b; # cleanup drop table t1, t2; ---source suite/versioning/common_finish.inc --echo # --echo # MDEV-17091 Assertion `old_part_id == m_last_part' failed in --echo # ha_partition::update_row or `part_id == m_last_part' in @@ -605,6 +604,35 @@ update t1 set f=pk; delete from t1; drop table t1; ---echo # Test cleanup -drop database test; -create database test; +--echo # +--echo # MDEV-22413 Server hangs upon UPDATE/DELETE on a view reading from versioned partitioned table +--echo # +create or replace table t1 (f char(6)) engine innodb with system versioning; + +insert into t1 values (null); +update t1 set f= 'foo'; +update t1 set f= 'bar'; + +create or replace view v1 as select * from t1 for system_time all; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +update v1 set f = ''; + +create or replace table t1 (f char(6)) engine innodb with system versioning +partition by system_time limit 1 +(partition p1 history, partition p2 history, partition pn current); + +insert into t1 values (null); +update t1 set f= 'foo'; +update t1 set f= 'bar'; + +create or replace view v1 as select * from t1 for system_time all; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +update v1 set f= ''; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +delete from v1; + +# cleanup +drop view v1; +drop table t1; + +--source suite/versioning/common_finish.inc |