Skip to content

Commit

Permalink
MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
Browse files Browse the repository at this point in the history
  • Loading branch information
midenok committed Dec 26, 2017
1 parent 4236f58 commit 11c6882
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mysql-test/suite/versioning/r/partition.result
Original file line number Diff line number Diff line change
Expand Up @@ -366,5 +366,11 @@ partition pn current);
set autocommit= off;
truncate table t1;
set autocommit= on;
MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
create or replace table t1 (x int) with system versioning;
lock table t1 write;
alter table t1 partition by system_time interval 1 week (
partition p1 history,
partition pn current);
drop table t1;
drop table t2;
7 changes: 7 additions & 0 deletions mysql-test/suite/versioning/t/partition.test
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ set autocommit= off;
truncate table t1;
set autocommit= on;

--echo MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
create or replace table t1 (x int) with system versioning;
lock table t1 write;
alter table t1 partition by system_time interval 1 week (
partition p1 history,
partition pn current);

drop table t1;
drop table t2;

Expand Down
6 changes: 5 additions & 1 deletion sql/partition_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1057,9 +1057,13 @@ class Table_locker
{
DBUG_ASSERT(table.file);
// FIXME: check consistency with table.reginfo.lock_type
if (table.file->get_lock_type() != F_UNLCK)
if (table.file->get_lock_type() != F_UNLCK
|| table.s->tmp_table)
{
return false;
}
thd->lock= NULL;
thd->locked_tables_mode= LTM_NONE;
bool res= lock_tables(thd, &table_list, 1, 0);
locked= !res;
return res;
Expand Down

0 comments on commit 11c6882

Please sign in to comment.