MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete
Multi-delete code invokes ha_rnd_end after applying deferred deletes, following the pattern as in multi-update. The CSV engine batches deletes made via calls to delete_row, then applies them all at once during ha_rnd_end. For each row batched, the CSV engine decrements an internal counter of the total rows in the table. The multi-delete code was not calling ha_rnd_end, so this internal counter was not consistent with the total number of rows in the table, triggering the assertion.
This commit is contained in:
parent
67e6fdee05
commit
b996aabd1a
@ -391,3 +391,37 @@ id v
|
||||
select * from t3;
|
||||
id v
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# Begin 11.8 tests
|
||||
#
|
||||
#
|
||||
# MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete
|
||||
#
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (v INT (1) NOT NULL) ENGINE=CSV;
|
||||
INSERT INTO t1 SELECT 1 away;
|
||||
SELECT COUNT(*) from t1;
|
||||
COUNT(*)
|
||||
1
|
||||
DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3;
|
||||
SELECT COUNT(*) from t1;
|
||||
COUNT(*)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (v VECTOR (1) NOT NULL) ENGINE=CSV;
|
||||
INSERT INTO t1 SELECT 1 away;
|
||||
Warnings:
|
||||
Warning 4078 Cannot cast 'int' as 'vector' in assignment of `test`.`t1`.`v`
|
||||
Warning 1292 Incorrect vector value: '1' for column `test`.`t1`.`v` at row 1
|
||||
SELECT COUNT(*) from t1;
|
||||
COUNT(*)
|
||||
1
|
||||
DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3;
|
||||
SELECT COUNT(*) from t1;
|
||||
COUNT(*)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End 11.8 tests
|
||||
#
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_csv.inc
|
||||
|
||||
create table t1 (id int primary key, v int);
|
||||
create table t2 (id int primary key, v int);
|
||||
@ -203,3 +204,30 @@ select * from t2;
|
||||
select * from t3;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
--echo # Begin 11.8 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete
|
||||
--echo #
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (v INT (1) NOT NULL) ENGINE=CSV;
|
||||
INSERT INTO t1 SELECT 1 away;
|
||||
SELECT COUNT(*) from t1;
|
||||
DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3;
|
||||
SELECT COUNT(*) from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (v VECTOR (1) NOT NULL) ENGINE=CSV;
|
||||
INSERT INTO t1 SELECT 1 away;
|
||||
SELECT COUNT(*) from t1;
|
||||
DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3;
|
||||
SELECT COUNT(*) from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End 11.8 tests
|
||||
--echo #
|
||||
|
@ -1647,6 +1647,10 @@ int multi_delete::rowid_table_deletes(TABLE *table, bool ignore)
|
||||
err:
|
||||
if (err_table)
|
||||
err_table->file->print_error(local_error,MYF(ME_FATAL));
|
||||
if (tmp_table->file->inited == handler::init_stat::RND)
|
||||
tmp_table->file->ha_rnd_end();
|
||||
if (table->file->inited == handler::init_stat::RND)
|
||||
table->file->ha_rnd_end();
|
||||
DBUG_RETURN(local_error);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user