Commit 9980886c authored by Aleksey Midenkov's avatar Aleksey Midenkov

Revert "SQL: 1-row partition rotation fix [fixes #260]"

Related to IB partitioning only.
This reverts commit 7e764ae1.
parent 2b60afe8
......@@ -408,10 +408,6 @@ enum ha_base_keytype {
when only HA_STATUS_VARIABLE but it won't be used.
*/
#define HA_STATUS_VARIABLE_EXTRA 128U
/*
Treat empty table as empty (ignore HA_STATUS_TIME hack).
*/
#define HA_STATUS_OPEN 256U
/*
Errorcodes given by handler functions
......
......@@ -172,12 +172,6 @@ x
2
create or replace table t1 (x int)
with system versioning
partition by system_time limit 1 (
partition p0 versioning,
partition pn as of now);
alter table t1 change x big int;
create or replace table t1 (x int)
with system versioning
partition by system_time (
partition p0 versioning,
partition pn as of now);
......
......@@ -89,14 +89,6 @@ alter table t1 drop partition p0;
select x from t1;
# Bug #260: incorrect IB partitioning warning
create or replace table t1 (x int)
with system versioning
partition by system_time limit 1 (
partition p0 versioning,
partition pn as of now);
alter table t1 change x big int;
# insert, delete, update
create or replace table t1 (x int)
with system versioning
......
......@@ -3585,7 +3585,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
m_part_info->part_expr->get_monotonicity_info();
else if (m_part_info->list_of_part_fields)
m_part_func_monotonicity_info= MONOTONIC_STRICT_INCREASING;
info(HA_STATUS_OPEN | HA_STATUS_VARIABLE | HA_STATUS_CONST);
info(HA_STATUS_VARIABLE | HA_STATUS_CONST);
DBUG_RETURN(0);
err_handler:
......@@ -6585,7 +6585,6 @@ int ha_partition::info(uint flag)
{
uint no_lock_flag= flag & HA_STATUS_NO_LOCK;
uint extra_var_flag= flag & HA_STATUS_VARIABLE_EXTRA;
uint open_flag= flag & HA_STATUS_OPEN;
DBUG_ENTER("ha_partition::info");
#ifndef DBUG_OFF
......@@ -6626,7 +6625,7 @@ int ha_partition::info(uint flag)
do
{
file= *file_array;
file->info(HA_STATUS_AUTO | no_lock_flag | open_flag);
file->info(HA_STATUS_AUTO | no_lock_flag);
set_if_bigger(auto_increment_value,
file->stats.auto_increment_value);
} while (*(++file_array));
......@@ -6680,7 +6679,7 @@ int ha_partition::info(uint flag)
i= bitmap_get_next_set(&m_part_info->read_partitions, i))
{
file= m_file[i];
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag | open_flag);
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
stats.records+= file->stats.records;
stats.deleted+= file->stats.deleted;
stats.data_file_length+= file->stats.data_file_length;
......@@ -6761,7 +6760,7 @@ int ha_partition::info(uint flag)
if (!(flag & HA_STATUS_VARIABLE) ||
!bitmap_is_set(&(m_part_info->read_partitions),
(uint)(file_array - m_file)))
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag | open_flag);
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
if (file->stats.records > max_records)
{
max_records= file->stats.records;
......@@ -6780,7 +6779,7 @@ int ha_partition::info(uint flag)
this);
file= m_file[handler_instance];
file->info(HA_STATUS_CONST | no_lock_flag | open_flag);
file->info(HA_STATUS_CONST | no_lock_flag);
stats.block_size= file->stats.block_size;
stats.create_time= file->stats.create_time;
ref_length= m_ref_length;
......@@ -6796,7 +6795,7 @@ int ha_partition::info(uint flag)
Note: all engines does not support HA_STATUS_ERRKEY, so set errkey.
*/
file->errkey= errkey;
file->info(HA_STATUS_ERRKEY | no_lock_flag | open_flag);
file->info(HA_STATUS_ERRKEY | no_lock_flag);
errkey= file->errkey;
}
if (flag & HA_STATUS_TIME)
......@@ -6813,7 +6812,7 @@ int ha_partition::info(uint flag)
do
{
file= *file_array;
file->info(HA_STATUS_TIME | no_lock_flag | open_flag);
file->info(HA_STATUS_TIME | no_lock_flag);
if (file->stats.update_time > stats.update_time)
stats.update_time= file->stats.update_time;
} while (*(++file_array));
......
......@@ -1351,7 +1351,7 @@ class ha_partition :public handler
{
handler *file= m_file[part_id];
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id));
file->info(HA_STATUS_OPEN | HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
part_recs+= file->stats.records;
}
return part_recs;
......
......@@ -3163,21 +3163,11 @@ int vers_get_partition_id(partition_info *part_info,
DBUG_ASSERT(part_info);
Field *sys_trx_end= part_info->part_field_array[STAT_TRX_END];
DBUG_ASSERT(sys_trx_end);
TABLE *table= part_info->table;
DBUG_ASSERT(table);
DBUG_ASSERT(part_info->table);
Vers_part_info *vers_info= part_info->vers_info;
DBUG_ASSERT(vers_info);
DBUG_ASSERT(vers_info->initialized());
DBUG_ASSERT(sys_trx_end->table == table);
bool tmp_off= false;
if (!table->versioned() && table->file->native_versioned())
{
// in copy_data_between_tables() versioning may be temporarily turned off
tmp_off= true;
table->s->versioned= true;
}
DBUG_ASSERT(table->versioned());
DBUG_ASSERT(table->vers_end_field() == sys_trx_end);
DBUG_ASSERT(vers_info && vers_info->initialized());
DBUG_ASSERT(sys_trx_end->table == part_info->table && part_info->table->versioned());
DBUG_ASSERT(part_info->table->vers_end_field() == sys_trx_end);
// new rows have NULL in sys_trx_end
if (sys_trx_end->is_max() || sys_trx_end->is_null())
......@@ -3187,6 +3177,7 @@ int vers_get_partition_id(partition_info *part_info,
else // row is historical
{
THD *thd= current_thd;
TABLE *table= part_info->table;
switch (thd->lex->sql_command)
{
......@@ -3224,9 +3215,6 @@ int vers_get_partition_id(partition_info *part_info,
*part_id= vers_info->hist_part->id;
}
if (tmp_off)
table->s->versioned= false;
DBUG_PRINT("exit",("partition: %d", *part_id));
DBUG_RETURN(0);
}
......
......@@ -6523,7 +6523,7 @@ ha_innobase::open(const char* name, int, uint)
}
}
info(HA_STATUS_OPEN | HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
DBUG_RETURN(0);
}
......@@ -14404,7 +14404,7 @@ ha_innobase::info_low(
set. That way SHOW TABLE STATUS will show the best estimate,
while the optimizer never sees the table empty. */
if (n_rows == 0 && !(flag & (HA_STATUS_TIME | HA_STATUS_OPEN))) {
if (n_rows == 0 && !(flag & HA_STATUS_TIME)) {
n_rows++;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment