diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-04-19 22:34:52 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-04-19 22:35:39 +0300 |
commit | 40e5c33684e13de6548055b3841dbafcceecac19 (patch) | |
tree | bae52a1da60ed332c892185754a7199e4cd4cc8b | |
parent | b74c5f8e0767ab66a3b816e77b963bcc9545fc74 (diff) | |
download | mariadb-git-bb-10.5-midenok-MDEV-17554.tar.gz |
Buildbot fixesbb-10.5-midenok-MDEV-17554
-rw-r--r-- | mysql-test/suite/versioning/r/partition.result | 28 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/partition.test | 16 | ||||
-rw-r--r-- | sql/partition_info.cc | 4 | ||||
-rw-r--r-- | sql/sql_base.cc | 2 |
4 files changed, 46 insertions, 4 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index c0f74be8f27..4f230d43b2b 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1390,7 +1390,7 @@ t2 CREATE TABLE `t2` ( `y` int(11) DEFAULT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO -PARTITIONS 5 +PARTITIONS ok affected rows: 1 drop tables t1, t2; affected rows: 0 @@ -1492,6 +1492,32 @@ unlock tables; affected rows: 0 drop procedure sp; affected rows: 0 +set timestamp= unix_timestamp('2001-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day starts '2000-01-01 00:00:00'; +affected rows: 0 +insert into t1 values (0); +affected rows: 1 +set timestamp= unix_timestamp('2001-01-01 00:00:01'); +affected rows: 0 +prepare s from 'update t1 set i= i + 1'; +affected rows: 0 +info: Statement prepared +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 1 +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +set timestamp= unix_timestamp('2001-01-02 00:00:01'); +affected rows: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 1 +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +drop prepare s; +affected rows: 0 # Complex table set timestamp= unix_timestamp('2000-01-01 00:00:00'); affected rows: 0 diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index fe1d2e224de..33ef102fad1 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1018,7 +1018,10 @@ set timestamp= unix_timestamp('2000-01-01 03:00:00'); update t1, t2 set t1.x= 0 where t1.x< t2.y; --replace_result $default_engine DEFAULT_ENGINE show create table t1; ---replace_result $default_engine DEFAULT_ENGINE +# Multiupdate_prelocking_strategy::handle_end() is processed after table open. +# For PS it is possible to skip unneeded auto-creation because the above happens at +# prepare stage and auto-creation is done at execute stage. +--replace_result $default_engine DEFAULT_ENGINE 'PARTITIONS 4' 'PARTITIONS ok' 'PARTITIONS 5' 'PARTITIONS ok' show create table t2; drop tables t1, t2; @@ -1062,6 +1065,17 @@ show create table t1; unlock tables; drop procedure sp; +set timestamp= unix_timestamp('2001-01-01 00:00:00'); +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day starts '2000-01-01 00:00:00'; +insert into t1 values (0); +set timestamp= unix_timestamp('2001-01-01 00:00:01'); +prepare s from 'update t1 set i= i + 1'; +execute s; +set timestamp= unix_timestamp('2001-01-02 00:00:01'); +execute s; +drop prepare s; + if (!$MTR_COMBINATION_HEAP) { --echo # Complex table diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 72312ee7ac4..55d7d713656 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -880,11 +880,11 @@ uint partition_info::vers_set_hist_part(THD *thd, bool auto_inc) if (auto_inc) { DBUG_ASSERT(thd->query_start() >= vers_info->hist_part->range_value); - my_time_t diff= thd->query_start() - vers_info->hist_part->range_value; + my_time_t diff= thd->query_start() - (my_time_t) vers_info->hist_part->range_value; if (diff > 0) { size_t delta= vers_info->interval.seconds(); - create_count= diff / delta + 1; + create_count= (uint) (diff / delta + 1); if (diff % delta) create_count++; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4d8f08af3ab..59223f95c14 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1770,6 +1770,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) if (table->part_info && table->part_info->part_type == VERSIONING_PARTITION && !table_list->vers_conditions.delete_history && + !thd->stmt_arena->is_stmt_prepare() && table_list->lock_type >= TL_WRITE_ALLOW_WRITE && table_list->mdl_request.type == MDL_SHARED_WRITE) { @@ -2033,6 +2034,7 @@ retry_share: table->part_info->part_type == VERSIONING_PARTITION && !table_list->vers_conditions.delete_history && !ot_ctx->vers_create_count && + !thd->stmt_arena->is_stmt_prepare() && table_list->lock_type >= TL_WRITE_ALLOW_WRITE && table_list->mdl_request.type >= MDL_SHARED_WRITE && table_list->mdl_request.type < MDL_EXCLUSIVE) |