Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2038 05/10/08 19:16:35 mronstrom@stripped +5 -0
WL 2604 Partition Management
Various fixes after personal review of my own code
sql/sql_yacc.yy
1.386 05/10/08 19:16:20 mronstrom@stripped +6 -0
Check that part state isn't set from CREATE/ALTER TABLE
sql/sql_table.cc
1.246 05/10/08 19:16:20 mronstrom@stripped +14 -0
Error if foreign key for partitioned table
sql/sql_partition.cc
1.26 05/10/08 19:16:19 mronstrom@stripped +23 -28
Fix + 80 char limit + Fix
sql/share/errmsg.txt
1.41 05/10/08 19:16:19 mronstrom@stripped +6 -3
New error messages + one dropped
sql/handler.h
1.160 05/10/08 19:16:18 mronstrom@stripped +5 -2
Ensure that it is not possible to set state in CREATE/ALTER TABLE
Fix 80 character limit
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mronstrom
# Host: c-2708e253.1238-1-64736c10.cust.bredbandsbolaget.se
# Root: /Users/mikron/wl2498
--- 1.159/sql/handler.h 2005-10-07 20:32:57 +02:00
+++ 1.160/sql/handler.h 2005-10-08 19:16:18 +02:00
@@ -543,6 +543,7 @@
bool list_of_subpart_fields;
bool linear_hash_ind;
bool fixed;
+ bool from_openfrm;
partition_info()
: get_partition_id(NULL), get_part_partition_id(NULL),
@@ -570,7 +571,8 @@
defined_max_value(FALSE),
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
linear_hash_ind(FALSE),
- fixed(FALSE)
+ fixed(FALSE),
+ from_openfrm(FALSE)
{
all_fields_in_PF.clear_all();
all_fields_in_PPF.clear_all();
@@ -686,7 +688,8 @@
uint32 *old_part_id, uint32 *new_part_id);
int get_part_for_delete(const byte *buf, const byte *rec0,
partition_info *part_info, uint32 *part_id);
-bool check_partition_info(partition_info *part_info, handler *file, ulonglong max_rows);
+bool check_partition_info(partition_info *part_info, handler *file,
+ ulonglong max_rows);
bool fix_partition_func(THD *thd, const char *name, TABLE *table,
bool create_table_ind);
char *generate_partition_syntax(partition_info *part_info,
--- 1.245/sql/sql_table.cc 2005-10-07 20:32:57 +02:00
+++ 1.246/sql/sql_table.cc 2005-10-08 19:16:20 +02:00
@@ -1698,6 +1698,20 @@
this information in the default_db_type variable, it is either
DB_TYPE_DEFAULT or the engine set in the ALTER TABLE command.
*/
+ /*
+ Check that we don't use foreign keys in the table since it won't
+ work even with InnoDB beneath it.
+ */
+ List_iterator<Key> key_iterator(keys);
+ Key *key;
+ while ((key= key_iterator++))
+ {
+ if (key->type == Key::FOREIGN_KEY)
+ {
+ my_error(ER_CANNOT_ADD_FOREIGN, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+ }
enum db_type part_engine_type= create_info->db_type;
char *part_syntax_buf;
uint syntax_len;
--- 1.385/sql/sql_yacc.yy 2005-10-07 05:45:15 +02:00
+++ 1.386/sql/sql_yacc.yy 2005-10-08 19:16:20 +02:00
@@ -3037,6 +3037,7 @@
mem_alloc_error();
YYABORT;
}
+ lex->part_info->from_openfrm= TRUE;
}
else
{
@@ -3281,6 +3282,11 @@
char *part_state= $3.str;
bool res;
+ if (!part_info->from_openfrm)
+ {
+ my_error(ER_PART_STATE_ERROR, MYF(0));
+ YYABORT;
+ }
if (strcmp(part_state, "PART_TO_BE_DROPPED"))
{
/*
--- 1.40/sql/share/errmsg.txt 2005-09-22 16:43:36 +02:00
+++ 1.41/sql/share/errmsg.txt 2005-10-08 19:16:19 +02:00
@@ -5482,9 +5482,6 @@
ER_BLOB_FIELD_IN_PART_FUNC_ERROR
eng "A BLOB field is not allowed in partition function"
-ER_CHAR_SET_IN_PART_FIELD_ERROR
- eng "VARCHAR only allowed if binary collation for partition functions"
ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
eng "A %s need to include all fields in the partition function"
@@ -5494,6 +5491,9 @@
ER_PARTITION_MGMT_ON_NONPARTITIONED
eng "Partition management on a not partitioned table is not possible"
+ER_FOREIGN_KEY_ON_PARTITIONED
+ eng "Foreign key condition is not yet supported in conjunction with partitioning"
ER_DROP_PARTITION_NON_EXISTENT
eng "Error in list of partitions to %s"
swe "Fel i listan av partitioner att %s"
@@ -5541,6 +5541,9 @@
ER_DROP_PARTITION_WHEN_FK_DEFINED
eng "Cannot drop a partition when a foreign key constraint is defined on the table"
+ER_PART_STATE_ERROR
+ eng "Partition state cannot be defined from CREATE/ALTER TABLE"
ER_TABLESPACE_OPTION_ONLY_ONCE
eng "It is not allowed to specify %s more than once"
ER_CREATE_TABLESPACE_FAILED
--- 1.25/sql/sql_partition.cc 2005-10-07 20:32:57 +02:00
+++ 1.26/sql/sql_partition.cc 2005-10-08 19:16:19 +02:00
@@ -817,7 +817,8 @@
This code is used early in the CREATE TABLE and ALTER TABLE process.
*/
-bool check_partition_info(partition_info *part_info, handler *file, ulonglong max_rows)
+bool check_partition_info(partition_info *part_info, handler *file,
+ ulonglong max_rows)
{
u_char *engine_array= NULL;
uint part_count= 0, i, no_parts, tot_partitions;
@@ -3620,6 +3621,7 @@
so we need to ensure that the data structure of the table object
is freed by setting version to 0.
*/
+ uint flags;
table->s->version= 0L;
if (alter_info->flags == ALTER_TABLE_REORG)
{
@@ -3661,7 +3663,9 @@
alter_info->no_parts= curr_part_no - new_part_no;
}
}
- if (table->file->alter_table_flags() & HA_FAST_CHANGE_PARTITION)
+ flags= table->file->alter_table_flags();
+ if ((flags & HA_FAST_CHANGE_PARTITION) ||
+ (flags & HA_PARTITION_ONE_PHASE))
online_alter_part= TRUE;
if (alter_info->flags & ALTER_ADD_PARTITION)
{
@@ -4581,7 +4585,7 @@
in synch with the changes made and if an error occurs that a proper
error handling is done.
- If the MySQL Server crashes at the moment but the handler succeeds
+ If the MySQL Server crashes at this moment but the handler succeeds
in performing the change then the binlog is not written for the
change. There is no way to solve this as long as the binlog is not
transactional and even then it is hard to solve it completely.
@@ -4595,7 +4599,8 @@
if ((mysql_write_frm(lpt, TRUE, FALSE, TRUE)) ||
(mysql_change_partitions(lpt)))
{
- DBUG_RETURN(FALSE);
+ online_alter_part_error_handler(lpt);
+ DBUG_RETURN(TRUE);
}
}
else if (alter_info->flags == ALTER_DROP_PARTITION)
@@ -4736,43 +4741,33 @@
used and rename those added to their real new names.
7) Wait until all accesses using the old frm file has completed
8) Drop the reorganised partitions
- 9) Write binlog and return from statement (including releasing all
+ 9) Write a new frm file of the table where the partitions are
+ reorganised.
+ 10)Wait until all accesses using the old frm file has completed
+ 11)Write binlog and return from statement (including releasing all
remaining locks).
*/
if (table->file->alter_table_flags() & HA_ONLINE_DOUBLE_WRITE)
{
if (table->reginfo.lock_type == TL_WRITE_ALLOW_READ)
+ {
mysql_lock_downgrade_write(lpt->thd, lpt->table,
TL_WRITE_ALLOW_WRITE);
- if ((mysql_write_frm(lpt, TRUE, FALSE, FALSE)) ||
- (mysql_change_partitions(lpt)) ||
- (abort_and_upgrade_lock(lpt)) ||
- (mysql_write_frm(lpt, FALSE, TRUE, FALSE)) ||
- (mysql_rename_partitions(lpt)) ||
- (close_open_tables_and_downgrade(lpt), FALSE) ||
- (mysql_drop_partitions(lpt)) ||
- (mysql_write_frm(lpt, FALSE, FALSE, FALSE)) ||
- (mysql_wait_completed_table(lpt, table), FALSE))
- {
- online_alter_part_error_handler(lpt);
- DBUG_RETURN(TRUE);
}
}
- else
+ if ((mysql_write_frm(lpt, TRUE, FALSE, FALSE)) ||
+ (mysql_change_partitions(lpt)) ||
+ (abort_and_upgrade_lock(lpt)) ||
+ (mysql_write_frm(lpt, FALSE, TRUE, FALSE)) ||
+ (mysql_rename_partitions(lpt)) ||
+ (close_open_tables_and_downgrade(lpt), FALSE) ||
+ (mysql_drop_partitions(lpt)) ||
+ (mysql_write_frm(lpt, FALSE, FALSE, FALSE)) ||
+ (mysql_wait_completed_table(lpt, table), FALSE))
{
- if ((mysql_write_frm(lpt, TRUE, FALSE, FALSE)) ||
- (mysql_change_partitions(lpt)) ||
- (abort_and_upgrade_lock(lpt)) ||
- (mysql_write_frm(lpt, FALSE, TRUE, FALSE)) ||
- (mysql_rename_partitions(lpt)) ||
- (close_open_tables_and_downgrade(lpt), FALSE) ||
- (mysql_drop_partitions(lpt)) ||
- (mysql_write_frm(lpt, FALSE, FALSE, FALSE)))
- {
online_alter_part_error_handler(lpt);
DBUG_RETURN(TRUE);
- }
}
}
/*
| Thread |
|---|
| • bk commit into 5.1 tree (mronstrom:1.2038) | mikael | 10 Oct |