mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
also, don't rotate versioning partitions for DELETE HISTORY originally by: Aleksey Midenkov
This commit is contained in:
@ -45,15 +45,24 @@ call truncate_sp;
|
|||||||
select * from t for system_time all;
|
select * from t for system_time all;
|
||||||
a
|
a
|
||||||
drop procedure truncate_sp;
|
drop procedure truncate_sp;
|
||||||
### Issue #399, truncate partitioned table is now unimplemented
|
# Truncate partitioned
|
||||||
create or replace table t (a int)
|
create or replace table t (a int)
|
||||||
with system versioning
|
with system versioning
|
||||||
engine myisam
|
engine myisam
|
||||||
partition by system_time (
|
partition by system_time limit 1 (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
|
partition p1 history,
|
||||||
partition pn current);
|
partition pn current);
|
||||||
|
insert into t values (1);
|
||||||
|
update t set a= 2;
|
||||||
|
update t set a= 3;
|
||||||
|
Warnings:
|
||||||
|
Note 4114 Versioned table `test`.`t`: switching from partition `p0` to `p1`
|
||||||
delete history from t;
|
delete history from t;
|
||||||
ERROR 42000: The used command is not allowed with this MariaDB version
|
select * from t for system_time all;
|
||||||
|
a
|
||||||
|
3
|
||||||
|
# VIEW
|
||||||
create or replace table t (i int) with system versioning;
|
create or replace table t (i int) with system versioning;
|
||||||
delete history from t;
|
delete history from t;
|
||||||
create or replace view v as select * from t;
|
create or replace view v as select * from t;
|
||||||
|
@ -41,18 +41,21 @@ select * from t for system_time all;
|
|||||||
|
|
||||||
drop procedure truncate_sp;
|
drop procedure truncate_sp;
|
||||||
|
|
||||||
--echo ### Issue #399, truncate partitioned table is now unimplemented
|
--echo # Truncate partitioned
|
||||||
|
|
||||||
create or replace table t (a int)
|
create or replace table t (a int)
|
||||||
with system versioning
|
with system versioning
|
||||||
engine myisam
|
engine myisam
|
||||||
partition by system_time (
|
partition by system_time limit 1 (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
|
partition p1 history,
|
||||||
partition pn current);
|
partition pn current);
|
||||||
|
insert into t values (1);
|
||||||
--error ER_NOT_ALLOWED_COMMAND
|
update t set a= 2;
|
||||||
|
update t set a= 3;
|
||||||
delete history from t;
|
delete history from t;
|
||||||
|
select * from t for system_time all;
|
||||||
|
|
||||||
|
--echo # VIEW
|
||||||
create or replace table t (i int) with system versioning;
|
create or replace table t (i int) with system versioning;
|
||||||
delete history from t;
|
delete history from t;
|
||||||
create or replace view v as select * from t;
|
create or replace view v as select * from t;
|
||||||
|
@ -4474,11 +4474,18 @@ int ha_partition::delete_row(const uchar *buf)
|
|||||||
|
|
||||||
Notice that HA_READ_BEFORE_WRITE_REMOVAL does not require this protocol,
|
Notice that HA_READ_BEFORE_WRITE_REMOVAL does not require this protocol,
|
||||||
so this is not supported for this engine.
|
so this is not supported for this engine.
|
||||||
|
|
||||||
|
For partitions by system_time, get_part_for_buf() is always either current
|
||||||
|
or last historical partition, but DELETE HISTORY can delete from any
|
||||||
|
historical partition. So, skip the check in this case.
|
||||||
*/
|
*/
|
||||||
uint32 part_id;
|
if (!thd->lex->vers_conditions) // if not DELETE HISTORY
|
||||||
error= get_part_for_buf(buf, m_rec0, m_part_info, &part_id);
|
{
|
||||||
DBUG_ASSERT(!error);
|
uint32 part_id;
|
||||||
DBUG_ASSERT(part_id == m_last_part);
|
error= get_part_for_buf(buf, m_rec0, m_part_info, &part_id);
|
||||||
|
DBUG_ASSERT(!error);
|
||||||
|
DBUG_ASSERT(part_id == m_last_part);
|
||||||
|
}
|
||||||
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
|
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
|
||||||
DBUG_ASSERT(bitmap_is_set(&(m_part_info->lock_partitions), m_last_part));
|
DBUG_ASSERT(bitmap_is_set(&(m_part_info->lock_partitions), m_last_part));
|
||||||
#endif
|
#endif
|
||||||
|
@ -317,14 +317,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
DBUG_ASSERT(table);
|
DBUG_ASSERT(table);
|
||||||
|
|
||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
|
||||||
if (table->part_info)
|
|
||||||
{
|
|
||||||
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0));
|
|
||||||
DBUG_RETURN(true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute());
|
DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute());
|
||||||
if (select_lex->vers_setup_conds(thd, table_list, &conds))
|
if (select_lex->vers_setup_conds(thd, table_list, &conds))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
@ -3112,6 +3112,8 @@ int vers_get_partition_id(partition_info *part_info,
|
|||||||
switch (thd->lex->sql_command)
|
switch (thd->lex->sql_command)
|
||||||
{
|
{
|
||||||
case SQLCOM_DELETE:
|
case SQLCOM_DELETE:
|
||||||
|
if (thd->lex->vers_conditions)
|
||||||
|
break; // DELETE HISTORY
|
||||||
case SQLCOM_DELETE_MULTI:
|
case SQLCOM_DELETE_MULTI:
|
||||||
case SQLCOM_UPDATE:
|
case SQLCOM_UPDATE:
|
||||||
case SQLCOM_UPDATE_MULTI:
|
case SQLCOM_UPDATE_MULTI:
|
||||||
|
Reference in New Issue
Block a user