Commit cc67d824 authored by unknown's avatar unknown

Merge c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/clean-mysql-5.1

into  c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19305


sql/ha_partition.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_partition.cc:
  Auto merged
parents beaea997 cd76b08d
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p1.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p1.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.frm
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.par
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.frm
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.par
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
......@@ -611,6 +611,8 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff));
if ((ret_error= file->delete_table((const char *) part_name_buff)))
error= ret_error;
if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
error= 1;
} while (++j < no_subparts);
}
else
......@@ -622,6 +624,8 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
if ((ret_error= file->delete_table((const char *) part_name_buff)))
error= ret_error;
if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
error= 1;
}
if (part_elem->part_state == PART_IS_CHANGED)
part_elem->part_state= PART_NORMAL;
......@@ -629,6 +633,7 @@ int ha_partition::drop_partitions(const char *path)
part_elem->part_state= PART_IS_DROPPED;
}
} while (++i < no_parts);
VOID(sync_ddl_log());
DBUG_RETURN(error);
}
......@@ -745,6 +750,7 @@ int ha_partition::rename_partitions(const char *path)
*/
part_elem= part_it++;
if (part_elem->part_state == PART_IS_CHANGED ||
part_elem->part_state == PART_TO_BE_DROPPED ||
(part_elem->part_state == PART_IS_ADDED && temp_partitions))
{
if (m_is_sub_partitioned)
......
......@@ -1208,6 +1208,7 @@ typedef struct st_lock_param_type
ulonglong deleted;
THD *thd;
HA_CREATE_INFO *create_info;
ALTER_INFO *alter_info;
List<create_field> *create_list;
List<create_field> new_create_list;
List<Key> *key_list;
......
......@@ -4996,8 +4996,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
DBUG_RETURN(TRUE);
}
*next_entry= log_entry->entry_pos;
if (temp_list)
sub_elem->log_entry= log_entry;
sub_elem->log_entry= log_entry;
insert_part_info_log_entry_list(part_info, log_entry);
} while (++j < no_subparts);
}
......@@ -5015,8 +5014,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
DBUG_RETURN(TRUE);
}
*next_entry= log_entry->entry_pos;
if (temp_list)
part_elem->log_entry= log_entry;
part_elem->log_entry= log_entry;
insert_part_info_log_entry_list(part_info, log_entry);
}
}
......@@ -5290,7 +5288,7 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
lpt->table_name, "#");
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
TRUE))
lpt->alter_info->flags & ALTER_REORGANIZE_PARTITION))
goto error;
if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
goto error;
......@@ -5544,6 +5542,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->thd= thd;
lpt->part_info= part_info;
lpt->alter_info= alter_info;
lpt->create_info= create_info;
lpt->create_list= create_list;
lpt->key_list= key_list;
......@@ -5846,6 +5845,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT_CRASH("crash_change_partition_5") ||
(table->file->extra(HA_EXTRA_PREPARE_FOR_DELETE), FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_6") ||
mysql_drop_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_61") ||
mysql_rename_partitions(lpt) ||
((frm_install= TRUE), FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_7") ||
......
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