summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2019-03-05 21:12:54 +1000
committerNikita Malyavin <nikitamalyavin@gmail.com>2019-06-12 22:11:45 +1000
commit5150dfd6ab3f992821a91ea67df14fba255efd60 (patch)
treef0bf139e50a85e9a2364804b4632dc3c1e7936f8
parentcf78b8c699d8394a52c55b38e67a865d6a44c500 (diff)
downloadmariadb-git-bb-10.3-MDEV-17891.tar.gz
MDEV-17891 Assertion failures in select_insert::abort_result_set and mysql_load upon attempt to replace into a full tablebb-10.3-MDEV-17891
* set modified_non_trans_table in one missed place
-rw-r--r--mysql-test/suite/versioning/r/partition.result23
-rw-r--r--mysql-test/suite/versioning/t/partition.test29
-rw-r--r--sql/sql_insert.cc2
3 files changed, 54 insertions, 0 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 3fcb59bdb40..99a297417d5 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -541,6 +541,29 @@ t1 CREATE TABLE `t1` (
PARTITION BY SYSTEM_TIME INTERVAL 7 SECOND
(PARTITION `ver_p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `ver_pn` CURRENT ENGINE = DEFAULT_ENGINE)
+set timestamp= default;
+# MDEV-17891 Assertion failures in select_insert::abort_result_set and
+# mysql_load upon attempt to replace into a full table
+set @@max_heap_table_size= 1024*1024;
+create or replace table t1 (
+pk integer auto_increment,
+primary key (pk),
+f varchar(45000)
+) with system versioning engine=memory
+partition by system_time interval 1 year (partition p1 history,
+partition pn current);
+# fill the table until full
+insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
+insert into t1 (f) select f from t1;
+ERROR HY000: The table 't1' is full
+# leave space for exactly one record in current partition
+delete from t1 where pk = 1;
+# copy all data into history partition
+replace into t1 select * from t1;
+replace into t1 select * from t1;
+ERROR HY000: The table 't1' is full
+drop table t1;
+set @@max_heap_table_size= 1048576;
# 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 d5c83b4d3bb..23768836efc 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -474,6 +474,7 @@ set timestamp=1523466002.799571;
insert into t1 values (11),(12);
set timestamp=1523466004.169435;
delete from t1 where pk in (11, 12);
+set timestamp= default;
--echo #
--echo # MDEV-18136 Server crashes in Item_func_dyncol_create::prepare_arguments
@@ -489,6 +490,34 @@ partition by system_time interval column_get(column_create(7,7), 7 as int) secon
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
+--echo # MDEV-17891 Assertion failures in select_insert::abort_result_set and
+--echo # mysql_load upon attempt to replace into a full table
+
+--let $max_heap_table_size_orig= `select @@max_heap_table_size;`
+set @@max_heap_table_size= 1024*1024;
+create or replace table t1 (
+ pk integer auto_increment,
+ primary key (pk),
+ f varchar(45000)
+) with system versioning engine=memory
+ partition by system_time interval 1 year (partition p1 history,
+ partition pn current);
+
+--echo # fill the table until full
+insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
+--error ER_RECORD_FILE_FULL
+insert into t1 (f) select f from t1;
+--echo # leave space for exactly one record in current partition
+delete from t1 where pk = 1;
+--echo # copy all data into history partition
+replace into t1 select * from t1;
+--error ER_RECORD_FILE_FULL
+replace into t1 select * from t1;
+
+# cleanup
+drop table t1;
+eval set @@max_heap_table_size= $max_heap_table_size_orig;
+
--echo # Test cleanup
drop database test;
create database test;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 1f3a70721fc..44502ea6704 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1953,6 +1953,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (likely(!error))
{
info->deleted++;
+ if (!table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->versioned(VERS_TIMESTAMP))
{
store_record(table, record[2]);