Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/wl2826
parents 1afc70d0 6473c104
...@@ -116,6 +116,7 @@ valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" ...@@ -116,6 +116,7 @@ valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
# Used in -debug builds # Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX" debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
error_inject="--with-error-inject "
# #
# Base C++ flags for all builds # Base C++ flags for all builds
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
......
...@@ -4,6 +4,6 @@ path=`dirname $0` ...@@ -4,6 +4,6 @@ path=`dirname $0`
. "$path/SETUP.sh" "$@" --with-debug=full . "$path/SETUP.sh" "$@" --with-debug=full
extra_flags="$pentium_cflags $debug_cflags" extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_configs" extra_configs="$pentium_configs $debug_configs $max_configs $error_inject"
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -666,6 +666,7 @@ else ...@@ -666,6 +666,7 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
MYSQL_SYS_LARGEFILE MYSQL_SYS_LARGEFILE
# Types that must be checked AFTER large file support is checked # Types that must be checked AFTER large file support is checked
...@@ -1608,6 +1609,21 @@ else ...@@ -1608,6 +1609,21 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
fi fi
# If we should allow error injection tests
AC_ARG_WITH(error-inject,
[ --with-error-inject Enable error injection in MySQL Server],
[ with_error_inject=$withval ],
[ with_error_inject=no ])
if test $with_debug != "no"
then
if test "$with_error_inject" = "yes"
then
AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
[Enable error injection in MySQL Server])
fi
fi
AC_ARG_WITH([fast-mutexes], AC_ARG_WITH([fast-mutexes],
AC_HELP_STRING([--with-fast-mutexes], AC_HELP_STRING([--with-fast-mutexes],
[Compile with fast mutexes (default is disabled)]), [Compile with fast mutexes (default is disabled)]),
......
...@@ -559,7 +559,7 @@ extern File my_register_filename(File fd, const char *FileName, ...@@ -559,7 +559,7 @@ extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file, enum file_type type_of_file,
uint error_message_number, myf MyFlags); uint error_message_number, myf MyFlags);
extern File my_create(const char *FileName,int CreateFlags, extern File my_create(const char *FileName,int CreateFlags,
int AccsesFlags, myf MyFlags); int AccessFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags); extern int my_close(File Filedes,myf MyFlags);
extern File my_dup(File file, myf MyFlags); extern File my_dup(File file, myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
......
...@@ -165,6 +165,20 @@ ENGINE=NDB ...@@ -165,6 +165,20 @@ ENGINE=NDB
PARTITION BY KEY(c3) PARTITIONS 5; PARTITION BY KEY(c3) PARTITIONS 5;
ALTER TABLE t1 COALESCE PARTITION 4; ALTER TABLE t1 COALESCE PARTITION 4;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int primary key)
ENGINE=NDB
PARTITION BY KEY(a);
ALTER TABLE t1 OPTIMIZE PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 CHECK PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 REPAIR PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 ANALYZE PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 REBUILD PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
c1 MEDIUMINT NOT NULL AUTO_INCREMENT, c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
c2 TEXT NOT NULL, c2 TEXT NOT NULL,
......
...@@ -154,6 +154,24 @@ ALTER TABLE t1 COALESCE PARTITION 4; ...@@ -154,6 +154,24 @@ ALTER TABLE t1 COALESCE PARTITION 4;
DROP TABLE t1; DROP TABLE t1;
#
# Bug 16822: OPTIMIZE TABLE hangs test
#
CREATE TABLE t1 (a int primary key)
ENGINE=NDB
PARTITION BY KEY(a);
--error 1031
ALTER TABLE t1 OPTIMIZE PARTITION p0;
--error 1031
ALTER TABLE t1 CHECK PARTITION p0;
--error 1031
ALTER TABLE t1 REPAIR PARTITION p0;
--error 1031
ALTER TABLE t1 ANALYZE PARTITION p0;
--error 1031
ALTER TABLE t1 REBUILD PARTITION p0;
DROP TABLE t1;
# #
# BUG 16806: ALTER TABLE fails # BUG 16806: ALTER TABLE fails
# #
......
...@@ -4711,7 +4711,10 @@ int ha_ndbcluster::create(const char *name, ...@@ -4711,7 +4711,10 @@ int ha_ndbcluster::create(const char *name,
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
} }
int ha_ndbcluster::create_handler_files(const char *file, HA_CREATE_INFO *info) int ha_ndbcluster::create_handler_files(const char *file,
const char *old_name,
int action_flag,
HA_CREATE_INFO *info)
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
const char *name; const char *name;
...@@ -4723,6 +4726,10 @@ int ha_ndbcluster::create_handler_files(const char *file, HA_CREATE_INFO *info) ...@@ -4723,6 +4726,10 @@ int ha_ndbcluster::create_handler_files(const char *file, HA_CREATE_INFO *info)
DBUG_ENTER("create_handler_files"); DBUG_ENTER("create_handler_files");
if (action_flag != CHF_INDEX_FLAG)
{
DBUG_RETURN(FALSE);
}
DBUG_PRINT("enter", ("file: %s", file)); DBUG_PRINT("enter", ("file: %s", file));
if (!(ndb= get_ndb())) if (!(ndb= get_ndb()))
DBUG_RETURN(HA_ERR_NO_CONNECTION); DBUG_RETURN(HA_ERR_NO_CONNECTION);
......
...@@ -610,7 +610,8 @@ class ha_ndbcluster: public handler ...@@ -610,7 +610,8 @@ class ha_ndbcluster: public handler
int rename_table(const char *from, const char *to); int rename_table(const char *from, const char *to);
int delete_table(const char *name); int delete_table(const char *name);
int create(const char *name, TABLE *form, HA_CREATE_INFO *info); int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
int create_handler_files(const char *file, HA_CREATE_INFO *info); int create_handler_files(const char *file, const char *old_name,
int action_flag, HA_CREATE_INFO *info);
int get_default_no_partitions(ulonglong max_rows); int get_default_no_partitions(ulonglong max_rows);
bool get_no_parts(const char *name, uint *no_parts); bool get_no_parts(const char *name, uint *no_parts);
void set_auto_partitions(partition_info *part_info); void set_auto_partitions(partition_info *part_info);
......
This diff is collapsed.
...@@ -179,7 +179,8 @@ public: ...@@ -179,7 +179,8 @@ public:
virtual int rename_table(const char *from, const char *to); virtual int rename_table(const char *from, const char *to);
virtual int create(const char *name, TABLE *form, virtual int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info); HA_CREATE_INFO *create_info);
virtual int create_handler_files(const char *name, virtual int create_handler_files(const char *name,
const char *old_name, int action_flag,
HA_CREATE_INFO *create_info); HA_CREATE_INFO *create_info);
virtual void update_create_info(HA_CREATE_INFO *create_info); virtual void update_create_info(HA_CREATE_INFO *create_info);
virtual char *update_table_comment(const char *comment); virtual char *update_table_comment(const char *comment);
......
...@@ -632,6 +632,7 @@ typedef struct { ...@@ -632,6 +632,7 @@ typedef struct {
#define UNDEF_NODEGROUP 65535 #define UNDEF_NODEGROUP 65535
class Item; class Item;
struct st_table_log_memory_entry;
class partition_info; class partition_info;
...@@ -639,7 +640,6 @@ struct st_partition_iter; ...@@ -639,7 +640,6 @@ struct st_partition_iter;
#define NOT_A_PARTITION_ID ((uint32)-1) #define NOT_A_PARTITION_ID ((uint32)-1)
typedef struct st_ha_create_information typedef struct st_ha_create_information
{ {
CHARSET_INFO *table_charset, *default_table_charset; CHARSET_INFO *table_charset, *default_table_charset;
...@@ -1379,8 +1379,15 @@ public: ...@@ -1379,8 +1379,15 @@ public:
virtual void drop_table(const char *name); virtual void drop_table(const char *name);
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
virtual int create_handler_files(const char *name, HA_CREATE_INFO *info)
{ return FALSE;} #define CHF_CREATE_FLAG 0
#define CHF_DELETE_FLAG 1
#define CHF_RENAME_FLAG 2
#define CHF_INDEX_FLAG 3
virtual int create_handler_files(const char *name, const char *old_name,
int action_flag, HA_CREATE_INFO *info)
{ return FALSE; }
virtual int change_partitions(HA_CREATE_INFO *create_info, virtual int change_partitions(HA_CREATE_INFO *create_info,
const char *path, const char *path,
......
...@@ -613,6 +613,100 @@ struct Query_cache_query_flags ...@@ -613,6 +613,100 @@ struct Query_cache_query_flags
#define query_cache_invalidate_by_MyISAM_filename_ref NULL #define query_cache_invalidate_by_MyISAM_filename_ref NULL
#endif /*HAVE_QUERY_CACHE*/ #endif /*HAVE_QUERY_CACHE*/
/*
Error injector Macros to enable easy testing of recovery after failures
in various error cases.
*/
#ifndef ERROR_INJECT_SUPPORT
#define ERROR_INJECT(x) 0
#define ERROR_INJECT_ACTION(x,action) 0
#define ERROR_INJECT_CRASH(x) 0
#define ERROR_INJECT_VALUE(x) 0
#define ERROR_INJECT_VALUE_ACTION(x,action) 0
#define ERROR_INJECT_VALUE_CRASH(x) 0
#define SET_ERROR_INJECT_VALUE(x)
#else
inline bool check_and_unset_keyword(const char *dbug_str)
{
const char *extra_str= "-d,";
char total_str[200];
if (_db_strict_keyword_ (dbug_str))
{
strxmov(total_str, extra_str, dbug_str, NullS);
DBUG_SET(total_str);
return 1;
}
return 0;
}
inline bool
check_and_unset_inject_value(int value)
{
THD *thd= current_thd;
if (thd->error_inject_value == (uint)value)
{
thd->error_inject_value= 0;
return 1;
}
return 0;
}
/*
ERROR INJECT MODULE:
--------------------
These macros are used to insert macros from the application code.
The event that activates those error injections can be activated
from SQL by using:
SET SESSION dbug=+d,code;
After the error has been injected, the macros will automatically
remove the debug code, thus similar to using:
SET SESSION dbug=-d,code
from SQL.
ERROR_INJECT_CRASH will inject a crash of the MySQL Server if code
is set when macro is called. ERROR_INJECT_CRASH can be used in
if-statements, it will always return FALSE unless of course it
crashes in which case it doesn't return at all.
ERROR_INJECT_ACTION will inject the action specified in the action
parameter of the macro, before performing the action the code will
be removed such that no more events occur. ERROR_INJECT_ACTION
can also be used in if-statements and always returns FALSE.
ERROR_INJECT can be used in a normal if-statement, where the action
part is performed in the if-block. The macro returns TRUE if the
error was activated and otherwise returns FALSE. If activated the
code is removed.
Sometimes it is necessary to perform error inject actions as a serie
of events. In this case one can use one variable on the THD object.
Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
behaviour as the above described macros except that they use the
error inject value instead of a code used by DBUG macros.
*/
#define SET_ERROR_INJECT_VALUE(x) \
current_thd->error_inject_value= (x)
#define ERROR_INJECT_CRASH(code) \
DBUG_EVALUATE_IF(code, (abort(), 0), 0)
#define ERROR_INJECT_ACTION(code, action) \
(check_and_unset_keyword(code) ? ((action), 0) : 0)
#define ERROR_INJECT(code) \
check_and_unset_keyword(code)
#define ERROR_INJECT_VALUE(value) \
check_and_unset_inject_value(value)
#define ERROR_INJECT_VALUE_ACTION(value,action) \
(check_and_unset_inject_value(value) ? (action) : 0)
#define ERROR_INJECT_VALUE_CRASH(value) \
ERROR_INJECT_VALUE_ACTION(value, (abort(), 0))
#endif
uint build_table_path(char *buff, size_t bufflen, const char *db, uint build_table_path(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext); const char *table, const char *ext);
void write_bin_log(THD *thd, bool clear_error, void write_bin_log(THD *thd, bool clear_error,
...@@ -1090,6 +1184,16 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info, ...@@ -1090,6 +1184,16 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
bool remove_table_from_cache(THD *thd, const char *db, const char *table, bool remove_table_from_cache(THD *thd, const char *db, const char *table,
uint flags); uint flags);
#define NORMAL_PART_NAME 0
#define TEMP_PART_NAME 1
#define RENAMED_PART_NAME 2
void create_partition_name(char *out, const char *in1,
const char *in2, uint name_variant,
bool translate);
void create_subpartition_name(char *out, const char *in1,
const char *in2, const char *in3,
uint name_variant);
typedef struct st_lock_param_type typedef struct st_lock_param_type
{ {
ulonglong copied; ulonglong copied;
...@@ -1109,14 +1213,94 @@ typedef struct st_lock_param_type ...@@ -1109,14 +1213,94 @@ typedef struct st_lock_param_type
uint key_count; uint key_count;
uint db_options; uint db_options;
uint pack_frm_len; uint pack_frm_len;
partition_info *part_info;
} ALTER_PARTITION_PARAM_TYPE; } ALTER_PARTITION_PARAM_TYPE;
void mem_alloc_error(size_t size); void mem_alloc_error(size_t size);
#define WFRM_INITIAL_WRITE 1
#define WFRM_CREATE_HANDLER_FILES 2 enum ddl_log_entry_code
{
/*
DDL_LOG_EXECUTE_CODE:
This is a code that indicates that this is a log entry to
be executed, from this entry a linked list of log entries
can be found and executed.
DDL_LOG_ENTRY_CODE:
An entry to be executed in a linked list from an execute log
entry.
DDL_IGNORE_LOG_ENTRY_CODE:
An entry that is to be ignored
*/
DDL_LOG_EXECUTE_CODE = 'e',
DDL_LOG_ENTRY_CODE = 'l',
DDL_IGNORE_LOG_ENTRY_CODE = 'i'
};
enum ddl_log_action_code
{
/*
The type of action that a DDL_LOG_ENTRY_CODE entry is to
perform.
DDL_LOG_DELETE_ACTION:
Delete an entity
DDL_LOG_RENAME_ACTION:
Rename an entity
DDL_LOG_REPLACE_ACTION:
Rename an entity after removing the previous entry with the
new name, that is replace this entry.
*/
DDL_LOG_DELETE_ACTION = 'd',
DDL_LOG_RENAME_ACTION = 'r',
DDL_LOG_REPLACE_ACTION = 's'
};
typedef struct st_ddl_log_entry
{
const char *name;
const char *from_name;
const char *handler_name;
uint next_entry;
uint entry_pos;
enum ddl_log_entry_code entry_type;
enum ddl_log_action_code action_type;
/*
Most actions have only one phase. REPLACE does however have two
phases. The first phase removes the file with the new name if
there was one there before and the second phase renames the
old name to the new name.
*/
char phase;
} DDL_LOG_ENTRY;
typedef struct st_ddl_log_memory_entry
{
uint entry_pos;
struct st_ddl_log_memory_entry *next_log_entry;
struct st_ddl_log_memory_entry *prev_log_entry;
struct st_ddl_log_memory_entry *next_active_log_entry;
} DDL_LOG_MEMORY_ENTRY;
bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
DDL_LOG_MEMORY_ENTRY **active_entry);
bool write_execute_ddl_log_entry(uint first_entry,
bool complete,
DDL_LOG_MEMORY_ENTRY **active_entry);
bool deactivate_ddl_log_entry(uint entry_no);
void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry);
bool sync_ddl_log();
void release_ddl_log();
void execute_ddl_log_recovery();
bool execute_ddl_log_entry(THD *thd, uint first_entry);
extern pthread_mutex_t LOCK_gdl;
#define WFRM_WRITE_SHADOW 1
#define WFRM_INSTALL_SHADOW 2
#define WFRM_PACK_FRM 4 #define WFRM_PACK_FRM 4
bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
bool abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt); int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt);
void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt); void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt);
void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table); void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table);
......
...@@ -3605,6 +3605,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3605,6 +3605,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
unireg_abort(1); unireg_abort(1);
} }
} }
execute_ddl_log_recovery();
create_shutdown_thread(); create_shutdown_thread();
create_maintenance_thread(); create_maintenance_thread();
...@@ -3656,6 +3657,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3656,6 +3657,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count);
release_ddl_log();
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if (Service.IsNT() && start_mode) if (Service.IsNT() && start_mode)
Service.Stop(); Service.Stop();
......
...@@ -36,6 +36,8 @@ enum partition_state { ...@@ -36,6 +36,8 @@ enum partition_state {
PART_IS_ADDED= 8 PART_IS_ADDED= 8
}; };
struct st_ddl_log_memory_entry;
class partition_element :public Sql_alloc { class partition_element :public Sql_alloc {
public: public:
List<partition_element> subpartitions; List<partition_element> subpartitions;
...@@ -44,6 +46,7 @@ public: ...@@ -44,6 +46,7 @@ public:
ulonglong part_min_rows; ulonglong part_min_rows;
char *partition_name; char *partition_name;
char *tablespace_name; char *tablespace_name;
struct st_ddl_log_memory_entry *log_entry;
longlong range_value; longlong range_value;
char* part_comment; char* part_comment;
char* data_file_name; char* data_file_name;
...@@ -55,7 +58,8 @@ public: ...@@ -55,7 +58,8 @@ public:
partition_element() partition_element()
: part_max_rows(0), part_min_rows(0), partition_name(NULL), : part_max_rows(0), part_min_rows(0), partition_name(NULL),
tablespace_name(NULL), range_value(0), part_comment(NULL), tablespace_name(NULL), log_entry(NULL),
range_value(0), part_comment(NULL),
data_file_name(NULL), index_file_name(NULL), data_file_name(NULL), index_file_name(NULL),
engine_type(NULL),part_state(PART_NORMAL), engine_type(NULL),part_state(PART_NORMAL),
nodegroup_id(UNDEF_NODEGROUP), has_null_value(FALSE) nodegroup_id(UNDEF_NODEGROUP), has_null_value(FALSE)
......
...@@ -28,7 +28,7 @@ typedef int (*get_part_id_func)(partition_info *part_info, ...@@ -28,7 +28,7 @@ typedef int (*get_part_id_func)(partition_info *part_info,
longlong *func_value); longlong *func_value);
typedef uint32 (*get_subpart_id_func)(partition_info *part_info); typedef uint32 (*get_subpart_id_func)(partition_info *part_info);
struct st_ddl_log_memory_entry;
class partition_info : public Sql_alloc class partition_info : public Sql_alloc
{ {
...@@ -76,7 +76,11 @@ public: ...@@ -76,7 +76,11 @@ public:
Item *subpart_expr; Item *subpart_expr;
Item *item_free_list; Item *item_free_list;
struct st_ddl_log_memory_entry *first_log_entry;
struct st_ddl_log_memory_entry *exec_log_entry;
struct st_ddl_log_memory_entry *frm_log_entry;
/* /*
A bitmap of partitions used by the current query. A bitmap of partitions used by the current query.
Usage pattern: Usage pattern:
...@@ -191,6 +195,7 @@ public: ...@@ -191,6 +195,7 @@ public:
part_field_array(NULL), subpart_field_array(NULL), part_field_array(NULL), subpart_field_array(NULL),
full_part_field_array(NULL), full_part_field_array(NULL),
part_expr(NULL), subpart_expr(NULL), item_free_list(NULL), part_expr(NULL), subpart_expr(NULL), item_free_list(NULL),
first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL),
list_array(NULL), list_array(NULL),
part_info_string(NULL), part_info_string(NULL),
part_func_string(NULL), subpart_func_string(NULL), part_func_string(NULL), subpart_func_string(NULL),
......
...@@ -5826,6 +5826,8 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT ...@@ -5826,6 +5826,8 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT
eng "The NDB cluster engine does not support changing the binlog format on the fly yet" eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
ER_PARTITION_NO_TEMPORARY ER_PARTITION_NO_TEMPORARY
eng "Cannot create temporary table with partitions" eng "Cannot create temporary table with partitions"
ER_DDL_LOG_ERROR
eng "Error in DDL log"
ER_NULL_IN_VALUES_LESS_THAN ER_NULL_IN_VALUES_LESS_THAN
eng "Not allowed to use NULL value in VALUES LESS THAN" eng "Not allowed to use NULL value in VALUES LESS THAN"
swe "Det r inte tilltet att anvnda NULL-vrden i VALUES LESS THAN" swe "Det r inte tilltet att anvnda NULL-vrden i VALUES LESS THAN"
......
...@@ -6140,9 +6140,8 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b) ...@@ -6140,9 +6140,8 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
abort_and_upgrade_lock() abort_and_upgrade_lock()
lpt Parameter passing struct lpt Parameter passing struct
All parameters passed through the ALTER_PARTITION_PARAM_TYPE object All parameters passed through the ALTER_PARTITION_PARAM_TYPE object
RETURN VALUES RETURN VALUE
TRUE Failure 0
FALSE Success
DESCRIPTION DESCRIPTION
Remember old lock level (for possible downgrade later on), abort all Remember old lock level (for possible downgrade later on), abort all
waiting threads and ensure that all keeping locks currently are waiting threads and ensure that all keeping locks currently are
...@@ -6156,23 +6155,17 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b) ...@@ -6156,23 +6155,17 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
old_lock_level Old lock level old_lock_level Old lock level
*/ */
bool abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt) int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
uint flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG; uint flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
int error= FALSE;
DBUG_ENTER("abort_and_upgrade_locks"); DBUG_ENTER("abort_and_upgrade_locks");
lpt->old_lock_type= lpt->table->reginfo.lock_type; lpt->old_lock_type= lpt->table->reginfo.lock_type;
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
mysql_lock_abort(lpt->thd, lpt->table, TRUE); mysql_lock_abort(lpt->thd, lpt->table, TRUE);
VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags)); VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags));
if (lpt->thd->killed)
{
lpt->thd->no_warnings_for_error= 0;
error= TRUE;
}
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(error); DBUG_RETURN(0);
} }
......
...@@ -223,6 +223,9 @@ THD::THD() ...@@ -223,6 +223,9 @@ THD::THD()
cuted_fields= sent_row_count= 0L; cuted_fields= sent_row_count= 0L;
limit_found_rows= 0; limit_found_rows= 0;
statement_id_counter= 0UL; statement_id_counter= 0UL;
#ifdef ERROR_INJECT_SUPPORT
error_inject_value= 0UL;
#endif
// Must be reset to handle error with THD's created for init of mysqld // Must be reset to handle error with THD's created for init of mysqld
lex->current_select= 0; lex->current_select= 0;
start_time=(time_t) 0; start_time=(time_t) 0;
......
...@@ -1099,6 +1099,9 @@ public: ...@@ -1099,6 +1099,9 @@ public:
query_id_t query_id, warn_id; query_id_t query_id, warn_id;
ulong thread_id, col_access; ulong thread_id, col_access;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_value;
#endif
/* Statement id is thread-wide. This counter is used to generate ids */ /* Statement id is thread-wide. This counter is used to generate ids */
ulong statement_id_counter; ulong statement_id_counter;
ulong rand_saved_seed1, rand_saved_seed2; ulong rand_saved_seed1, rand_saved_seed2;
......
This diff is collapsed.
This diff is collapsed.
...@@ -3558,75 +3558,14 @@ part_definition: ...@@ -3558,75 +3558,14 @@ part_definition:
LEX *lex= Lex; LEX *lex= Lex;
partition_info *part_info= lex->part_info; partition_info *part_info= lex->part_info;
partition_element *p_elem= new partition_element(); partition_element *p_elem= new partition_element();
uint part_id= part_info->partitions.elements + uint part_id= part_info->partitions.elements;
part_info->temp_partitions.elements;
enum partition_state part_state;
if (part_info->part_state) if (!p_elem || part_info->partitions.push_back(p_elem))
part_state= (enum partition_state)part_info->part_state[part_id];
else
part_state= PART_NORMAL;
switch (part_state)
{ {
case PART_TO_BE_DROPPED: mem_alloc_error(sizeof(partition_element));
/* YYABORT;
This part is currently removed so we keep it in a
temporary list for REPAIR TABLE to be able to handle
failures during drop partition process.
*/
case PART_TO_BE_ADDED:
/*
This part is currently being added so we keep it in a
temporary list for REPAIR TABLE to be able to handle
failures during add partition process.
*/
if (!p_elem || part_info->temp_partitions.push_back(p_elem))
{
mem_alloc_error(sizeof(partition_element));
YYABORT;
}
break;
case PART_IS_ADDED:
/*
Part has been added and is now a normal partition
*/
case PART_TO_BE_REORGED:
/*
This part is currently reorganised, it is still however
used so we keep it in the list of partitions. We do
however need the state to be able to handle REPAIR TABLE
after failures in the reorganisation process.
*/
case PART_REORGED_DROPPED:
/*
This part is currently reorganised as part of a
COALESCE PARTITION and it will be dropped without a new
replacement partition after completing the reorganisation.
*/
case PART_CHANGED:
/*
This part is currently split or merged as part of ADD
PARTITION for a hash partition or as part of COALESCE
PARTITION for a hash partitioned table.
*/
case PART_IS_CHANGED:
/*
This part has been split or merged as part of ADD
PARTITION for a hash partition or as part of COALESCE
PARTITION for a hash partitioned table.
*/
case PART_NORMAL:
if (!p_elem || part_info->partitions.push_back(p_elem))
{
mem_alloc_error(sizeof(partition_element));
YYABORT;
}
break;
default:
mem_alloc_error((part_id * 1000) + part_state);
YYABORT;
} }
p_elem->part_state= part_state; p_elem->part_state= PART_NORMAL;
part_info->curr_part_elem= p_elem; part_info->curr_part_elem= p_elem;
part_info->current_partition= p_elem; part_info->current_partition= p_elem;
part_info->use_default_partitions= FALSE; part_info->use_default_partitions= FALSE;
......
...@@ -667,36 +667,17 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -667,36 +667,17 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
#endif #endif
next_chunk+= 5 + partition_info_len; next_chunk+= 5 + partition_info_len;
} }
if (share->mysql_version > 50105 && next_chunk + 5 < buff_end) #if MYSQL_VERSION_ID < 50200
if (share->mysql_version >= 50106 && share->mysql_version <= 50109)
{ {
/* /*
Partition state was introduced to support partition management in version 5.1.5 Partition state array was here in version 5.1.6 to 5.1.9, this code
makes it possible to load a 5.1.6 table in later versions. Can most
likely be removed at some point in time. Will only be used for
upgrades within 5.1 series of versions. Upgrade to 5.2 can only be
done from newer 5.1 versions.
*/ */
uint32 part_state_len= uint4korr(next_chunk); next_chunk+= 4;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if ((share->part_state_len= part_state_len))
if (!(share->part_state=
(uchar*) memdup_root(&share->mem_root, next_chunk + 4,
part_state_len)))
{
my_free(buff, MYF(0));
goto err;
}
#else
if (part_state_len)
{
DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined"));
my_free(buff, MYF(0));
goto err;
}
#endif
next_chunk+= 4 + part_state_len;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
else
{
share->part_state_len= 0;
share->part_state= NULL;
} }
#endif #endif
keyinfo= share->key_info; keyinfo= share->key_info;
......
...@@ -136,7 +136,6 @@ bool mysql_create_frm(THD *thd, const char *file_name, ...@@ -136,7 +136,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if (part_info) if (part_info)
{ {
create_info->extra_size+= part_info->part_info_len; create_info->extra_size+= part_info->part_info_len;
create_info->extra_size+= part_info->part_state_len;
} }
#endif #endif
...@@ -209,12 +208,6 @@ bool mysql_create_frm(THD *thd, const char *file_name, ...@@ -209,12 +208,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
my_write(file, (const byte*)part_info->part_info_string, my_write(file, (const byte*)part_info->part_info_string,
part_info->part_info_len + 1, MYF_RW)) part_info->part_info_len + 1, MYF_RW))
goto err; goto err;
DBUG_PRINT("info", ("Part state len = %d", part_info->part_state_len));
int4store(buff, part_info->part_state_len);
if (my_write(file, (const byte*)buff, 4, MYF_RW) ||
my_write(file, (const byte*)part_info->part_state,
part_info->part_state_len, MYF_RW))
goto err;
} }
else else
#endif #endif
...@@ -330,7 +323,7 @@ int rea_create_table(THD *thd, const char *path, ...@@ -330,7 +323,7 @@ int rea_create_table(THD *thd, const char *path,
// Make sure mysql_create_frm din't remove extension // Make sure mysql_create_frm din't remove extension
DBUG_ASSERT(*fn_rext(frm_name)); DBUG_ASSERT(*fn_rext(frm_name));
if (file->create_handler_files(path, create_info)) if (file->create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
goto err_handler; goto err_handler;
if (!create_info->frm_only && ha_create_table(thd, path, db, table_name, if (!create_info->frm_only && ha_create_table(thd, path, db, table_name,
create_info,0)) create_info,0))
......
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