From 9149017bb838e9efbef40c5f2807894c38b3412f Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Thu, 2 Apr 2020 22:37:36 +1000 Subject: MDEV-17091 - Assertion failed after dropping versioning Assertion `old_part_id == m_last_part' failed in ha_partition::update_row or `part_id == m_last_part' in ha_partition::delete_row upon UPDATE/DELETE after dropping versioning PRIMARY KEY change hadn't been treated as partition reorganization in case of partitioning by KEY() (without parameters). * set `*partition_changed= true` in the described case. * since add/drop system versioning does not affect alter_info->key_list, it required separate attention --- mysql-test/suite/versioning/r/partition.result | 28 ++++++++++++++++++++++++++ mysql-test/suite/versioning/t/partition.test | 24 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) (limited to 'mysql-test/suite/versioning') diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index aa884743b2f..a75fa49c610 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -614,3 +614,31 @@ create table t2 (b int); insert into t2 values (1),(2); update t1, t2 set a = 1; drop table t1, t2; +# +# MDEV-17091 Assertion `old_part_id == m_last_part' failed in +# ha_partition::update_row or `part_id == m_last_part' in +# ha_partition::delete_row upon UPDATE/DELETE after dropping versioning +# +create or replace table t1 (pk int primary key, f int) engine=innodb +with system versioning +partition by key() partitions 2; +insert into t1 values (1,10),(2,20); +# expected to hit same partition +select * from t1 partition (p0); +pk f +1 10 +2 20 +alter table t1 drop system versioning; +# 1 and 2 are expected to be in different partitions +select * from t1 partition(p0); +pk f +1 10 +select * from t1 partition(p1); +pk f +2 20 +update t1 set f=pk; +delete from t1; +drop table t1; +# Test cleanup +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 8898088b1bc..282af4b5bc7 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -568,3 +568,27 @@ update t1, t2 set a = 1; 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 +--echo # ha_partition::delete_row upon UPDATE/DELETE after dropping versioning +--echo # +create or replace table t1 (pk int primary key, f int) engine=innodb + with system versioning + partition by key() partitions 2; +insert into t1 values (1,10),(2,20); +--echo # expected to hit same partition +select * from t1 partition (p0); +alter table t1 drop system versioning; + +--echo # 1 and 2 are expected to be in different partitions +select * from t1 partition(p0); +select * from t1 partition(p1); + +update t1 set f=pk; +delete from t1; +drop table t1; + +--echo # Test cleanup +drop database test; +create database test; -- cgit v1.2.1 From 44c6c7a9236dbbe35e8fda22b36466b6000038d6 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 2 Apr 2020 20:48:38 +0300 Subject: MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table SQL_SELECT::check_quick() returns error status only test_quick_select() returns -1. Fix error handling when lower frames throw error, but it is ignored by test_quick_select(). Fix return status for out-of-memory errors which are obviously must be processed as error in upper frames. --- mysql-test/suite/versioning/r/update.result | 7 +++++++ mysql-test/suite/versioning/t/update.test | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'mysql-test/suite/versioning') diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index a2ec02a7ec1..f7901d11d2a 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -312,3 +312,10 @@ ERROR 42S22: Unknown column 'xx' in 'field list' drop procedure sp; drop view v1; drop table t1; +# +# MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table +# +create or replace table t1 (f point, key(f)) with system versioning engine=myisam; +update t1 set f = null where f = 'foo'; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 71e946e6c2b..5b0a9eb5c42 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -235,4 +235,14 @@ drop procedure sp; drop view v1; drop table t1; +--echo # +--echo # MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table +--echo # +create or replace table t1 (f point, key(f)) with system versioning engine=myisam; +--error ER_CANT_CREATE_GEOMETRY_OBJECT +update t1 set f = null where f = 'foo'; + +# cleanup +drop table t1; + source suite/versioning/common_finish.inc; -- cgit v1.2.1 From ba34f409ad104471d1f642a86bf192f1d9c3537d Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 2 Apr 2020 20:48:38 +0300 Subject: MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table Earlier skip of history row. Cleanup of dead code for VTMD. --- mysql-test/suite/versioning/r/alter.result | 9 +++++++++ mysql-test/suite/versioning/t/alter.test | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'mysql-test/suite/versioning') diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 53e169812b4..bf125846ecf 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -684,3 +684,12 @@ add column c int without system versioning, change column c c int, change column b b int without system versioning; drop table t; +# +# MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table +# +create or replace table t1 (a int) with system versioning; +insert into t1 values (128); +delete from t1; +set statement system_versioning_alter_history=keep for +alter table t1 drop system versioning, modify column a tinyint; +drop table t1; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index ff33f2cf95b..9d8f0a1bb7b 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -580,3 +580,15 @@ alter table t change column b b int without system versioning; drop table t; + +--echo # +--echo # MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table +--echo # +create or replace table t1 (a int) with system versioning; +insert into t1 values (128); +delete from t1; +set statement system_versioning_alter_history=keep for +alter table t1 drop system versioning, modify column a tinyint; + +# cleanup +drop table t1; -- cgit v1.2.1 From 0932c5804d720e1e1ee1d632ad424883dddfeea0 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 2 Apr 2020 20:48:38 +0300 Subject: MDEV-20515 multi-update tries to position updated table by null reference Cause Join tmp table inserts null row because of OUTER JOIN, that's expected. Since `multi_update::prepare2()` converted `Item_temptable_rowid` into `Item_field` (28dbdf3) `multi_update::send_data()` accesses join tmp record directly and treats it as a normal row ignoring null status of ref field. NULL ref field is then treated as normal in `multi_update::do_updates()` which tries to position updated table by reference 0. Note that reference 0 may be valid reference and the first row of table can be wrongly updated (see multi_update.test). Fix Do not add row into multi-update tmp table in case of null ref field. Join tmp table does not have null_row status at this time (as well as `STATUS_NULL_ROW`) and cannot be skipped by these properties (see first comment in multi_update::send_data()). But it has all null fields (including the ref field). --- mysql-test/suite/versioning/r/partition.result | 11 +++++++++++ mysql-test/suite/versioning/t/partition.test | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'mysql-test/suite/versioning') diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index a75fa49c610..c4fedb08ad6 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -615,6 +615,17 @@ insert into t2 values (1),(2); update t1, t2 set a = 1; drop table t1, t2; # +# MDEV-20515 multi-update tries to position updated table by null reference +# +create or replace table t1 (a int); +insert into t1 values (0), (1); +create or replace table t2 (b int) with system versioning +partition by system_time +(partition p1 history, partition pn current); +insert into t2 values (0), (2); +update t1 left join t2 on a > b set b= 2 order by b; +drop table t1, t2; +# # MDEV-17091 Assertion `old_part_id == m_last_part' failed in # ha_partition::update_row or `part_id == m_last_part' in # ha_partition::delete_row upon UPDATE/DELETE after dropping versioning diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 282af4b5bc7..6fee6f43847 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -567,6 +567,22 @@ update t1, t2 set a = 1; # cleanup drop table t1, t2; +--echo # +--echo # MDEV-20515 multi-update tries to position updated table by null reference +--echo # +create or replace table t1 (a int); +insert into t1 values (0), (1); + +create or replace table t2 (b int) with system versioning +partition by system_time +(partition p1 history, partition pn current); + +insert into t2 values (0), (2); +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 -- cgit v1.2.1