summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-04-03 23:55:48 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-04-03 23:55:48 +0300
commitaa7f2578fcf2ddceef89e9cac5c9a8eb98873540 (patch)
treef91ec7bc00011e3d18a609dbd0b3ce39aeff7db9
parent198af54bb9410b31a4ac1cf50c72a5c430bf54ad (diff)
downloadmariadb-git-aa7f2578fcf2ddceef89e9cac5c9a8eb98873540.tar.gz
MDEV-21471 ER_CRASHED_ON_USAGE upon UPDATE FOR PORTION on Aria table
Turn read cache off for periodic update. Like 498a96a4 says: Aria with row_format=fixed uses IO_CACHE of type READ_CACHE for sequential read in update loop. When history row is inserted inside this loop the cache misses it and fails with error. This applicable to any additional row inserts on UPDATE. In this case it was initiated by UPDATE FOR PORTION. Related to MDEV-20441.
-rw-r--r--mysql-test/suite/period/r/update.result7
-rw-r--r--mysql-test/suite/period/t/update.test10
-rw-r--r--sql/sql_update.cc1
3 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/suite/period/r/update.result b/mysql-test/suite/period/r/update.result
index b86537fc9fb..05d1a2eb6d3 100644
--- a/mysql-test/suite/period/r/update.result
+++ b/mysql-test/suite/period/r/update.result
@@ -274,3 +274,10 @@ drop function f;
drop function g;
drop function h;
drop procedure log;
+#
+# MDEV-21471 ER_CRASHED_ON_USAGE upon UPDATE FOR PORTION on Aria table
+#
+create table t1 (s date, e date, period for app(s,e), f varchar(8)) engine=aria row_format=fixed;
+insert into t1 values ('2024-05-13','2026-03-25','foo');
+update t1 for portion of app from '2024-04-02' to '2026-03-15' set f = 'bar';
+drop table t1;
diff --git a/mysql-test/suite/period/t/update.test b/mysql-test/suite/period/t/update.test
index 5730387dfda..0f54dd80eec 100644
--- a/mysql-test/suite/period/t/update.test
+++ b/mysql-test/suite/period/t/update.test
@@ -163,3 +163,13 @@ drop function f;
drop function g;
drop function h;
drop procedure log;
+
+--echo #
+--echo # MDEV-21471 ER_CRASHED_ON_USAGE upon UPDATE FOR PORTION on Aria table
+--echo #
+create table t1 (s date, e date, period for app(s,e), f varchar(8)) engine=aria row_format=fixed;
+insert into t1 values ('2024-05-13','2026-03-25','foo');
+update t1 for portion of app from '2024-04-02' to '2026-03-15' set f = 'bar';
+
+# cleanup
+drop table t1;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index af09675d917..0d2860de19f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -465,6 +465,7 @@ int mysql_update(THD *thd,
my_error(ER_NOT_CONSTANT_EXPRESSION, MYF(0), "FOR PORTION OF");
DBUG_RETURN(true);
}
+ table->no_cache= true;
}
old_covering_keys= table->covering_keys; // Keys used in WHERE