Commit 71e061db authored by Georgi Kodinov's avatar Georgi Kodinov

merged 5.1-5.1.29 -> 5.1-bugteam

parents cdb8a2a9 20cf5c16
This diff is collapsed.
This diff is collapsed.
################################################################################
# t/partition_auto_increment_archive.test #
# #
# Purpose: #
# Tests around auto increment column #
# Archive branch #
# #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-09-02 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
--source include/have_archive.inc
# Archve does not support delete
let $skip_delete= 1;
let $skip_truncate= 1;
let $skip_update= 1;
let $only_ai_pk= 1;
##### Storage engine to be tested
let $engine= 'Archive';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
################################################################################
# t/partition_auto_increment_blackhole.test #
# #
# Purpose: #
# Tests around auto increment column #
# Blackhole branch #
# #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-09-02 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
--source include/have_blackhole.inc
##### Storage engine to be tested
let $engine= 'Blackhole';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
################################################################################
# t/partition_auto_increment_innodb.test #
# #
# Purpose: #
# Tests around auto increment column #
# InnoDB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-02-12 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'InnoDB';
--source include/have_innodb.inc
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
################################################################################
# t/partition_auto_increment_memory.test #
# #
# Purpose: #
# Tests around auto increment column #
# Memory branch #
# #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-02-12 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'Memory';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
################################################################################
# t/partition_auto_increment_myisam.test #
# #
# Purpose: #
# Tests around auto increment column #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-02-12 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MyISAM';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
################################################################################
# t/partition_auto_increment_ndb.test #
# #
# Purpose: #
# Tests around auto increment column #
# NDB branch #
# #
# Note: NDB behavior for auto_increment on secondary column in #
# multi-column-index is NOT like MyISAM, instead it uses the same #
# behavior as if it was the primary column. #
#------------------------------------------------------------------------------#
# Original Author: MattiasJ #
# Original Date: 2008-09-02 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
--source include/have_ndb.inc
##### Storage engine to be tested
let $engine= 'NDB';
connection default;
#enable hash partitioning
SET new=on;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_auto_increment.inc
This diff is collapsed.
...@@ -37,6 +37,15 @@ typedef struct st_partition_share ...@@ -37,6 +37,15 @@ typedef struct st_partition_share
} PARTITION_SHARE; } PARTITION_SHARE;
#endif #endif
/**
Partition specific ha_data struct.
@todo: move all partition specific data from TABLE_SHARE here.
*/
typedef struct st_ha_data_partition
{
ulonglong next_auto_inc_val; /**< first non reserved value */
bool auto_inc_initialized;
} HA_DATA_PARTITION;
#define PARTITION_BYTES_IN_POS 2 #define PARTITION_BYTES_IN_POS 2
class ha_partition :public handler class ha_partition :public handler
...@@ -140,6 +149,12 @@ class ha_partition :public handler ...@@ -140,6 +149,12 @@ class ha_partition :public handler
"own" the m_part_info structure. "own" the m_part_info structure.
*/ */
bool is_clone; bool is_clone;
bool auto_increment_lock; /**< lock reading/updating auto_inc */
/**
Flag to keep the auto_increment lock through out the statement.
This to ensure it will work with statement based replication.
*/
bool auto_increment_safe_stmt_log_lock;
public: public:
handler *clone(MEM_ROOT *mem_root); handler *clone(MEM_ROOT *mem_root);
virtual void set_part_info(partition_info *part_info) virtual void set_part_info(partition_info *part_info)
...@@ -196,8 +211,8 @@ class ha_partition :public handler ...@@ -196,8 +211,8 @@ class ha_partition :public handler
virtual char *update_table_comment(const char *comment); virtual char *update_table_comment(const char *comment);
virtual int change_partitions(HA_CREATE_INFO *create_info, virtual int change_partitions(HA_CREATE_INFO *create_info,
const char *path, const char *path,
ulonglong *copied, ulonglong * const copied,
ulonglong *deleted, ulonglong * const deleted,
const uchar *pack_frm_data, const uchar *pack_frm_data,
size_t pack_frm_len); size_t pack_frm_len);
virtual int drop_partitions(const char *path); virtual int drop_partitions(const char *path);
...@@ -211,7 +226,7 @@ class ha_partition :public handler ...@@ -211,7 +226,7 @@ class ha_partition :public handler
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
private: private:
int prepare_for_rename(); int prepare_for_rename();
int copy_partitions(ulonglong *copied, ulonglong *deleted); int copy_partitions(ulonglong * const copied, ulonglong * const deleted);
void cleanup_new_partition(uint part_count); void cleanup_new_partition(uint part_count);
int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info, int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info,
handler *file, const char *part_name, handler *file, const char *part_name,
...@@ -826,12 +841,51 @@ class ha_partition :public handler ...@@ -826,12 +841,51 @@ class ha_partition :public handler
auto_increment_column_changed auto_increment_column_changed
------------------------------------------------------------------------- -------------------------------------------------------------------------
*/ */
virtual void restore_auto_increment(ulonglong prev_insert_id);
virtual void get_auto_increment(ulonglong offset, ulonglong increment, virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values, ulonglong nb_desired_values,
ulonglong *first_value, ulonglong *first_value,
ulonglong *nb_reserved_values); ulonglong *nb_reserved_values);
virtual void release_auto_increment(); virtual void release_auto_increment();
private:
virtual int reset_auto_increment(ulonglong value);
virtual void lock_auto_increment()
{
/* lock already taken */
if (auto_increment_safe_stmt_log_lock)
return;
DBUG_ASSERT(table_share->ha_data && !auto_increment_lock);
if(table_share->tmp_table == NO_TMP_TABLE)
{
auto_increment_lock= TRUE;
pthread_mutex_lock(&table_share->mutex);
}
}
virtual void unlock_auto_increment()
{
DBUG_ASSERT(table_share->ha_data);
/*
If auto_increment_safe_stmt_log_lock is true, we have to keep the lock.
It will be set to false and thus unlocked at the end of the statement by
ha_partition::release_auto_increment.
*/
if(auto_increment_lock && !auto_increment_safe_stmt_log_lock)
{
pthread_mutex_unlock(&table_share->mutex);
auto_increment_lock= FALSE;
}
}
virtual void set_auto_increment_if_higher(const ulonglong nr)
{
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
lock_auto_increment();
/* must check when the mutex is taken */
if (nr >= ha_data->next_auto_inc_val)
ha_data->next_auto_inc_val= nr + 1;
ha_data->auto_inc_initialized= TRUE;
unlock_auto_increment();
}
public:
/* /*
------------------------------------------------------------------------- -------------------------------------------------------------------------
......
...@@ -1241,8 +1241,8 @@ class handler :public Sql_alloc ...@@ -1241,8 +1241,8 @@ class handler :public Sql_alloc
int ha_change_partitions(HA_CREATE_INFO *create_info, int ha_change_partitions(HA_CREATE_INFO *create_info,
const char *path, const char *path,
ulonglong *copied, ulonglong * const copied,
ulonglong *deleted, ulonglong * const deleted,
const uchar *pack_frm_data, const uchar *pack_frm_data,
size_t pack_frm_len); size_t pack_frm_len);
int ha_drop_partitions(const char *path); int ha_drop_partitions(const char *path);
...@@ -1859,7 +1859,8 @@ class handler :public Sql_alloc ...@@ -1859,7 +1859,8 @@ class handler :public Sql_alloc
This is called to delete all rows in a table This is called to delete all rows in a table
If the handler don't support this, then this function will If the handler don't support this, then this function will
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
by one. by one. It should reset auto_increment if
thd->lex->sql_command == SQLCOM_TRUNCATE.
*/ */
virtual int delete_all_rows() virtual int delete_all_rows()
{ return (my_errno=HA_ERR_WRONG_COMMAND); } { return (my_errno=HA_ERR_WRONG_COMMAND); }
...@@ -1898,8 +1899,8 @@ class handler :public Sql_alloc ...@@ -1898,8 +1899,8 @@ class handler :public Sql_alloc
virtual int change_partitions(HA_CREATE_INFO *create_info, virtual int change_partitions(HA_CREATE_INFO *create_info,
const char *path, const char *path,
ulonglong *copied, ulonglong * const copied,
ulonglong *deleted, ulonglong * const deleted,
const uchar *pack_frm_data, const uchar *pack_frm_data,
size_t pack_frm_len) size_t pack_frm_len)
{ return HA_ERR_WRONG_COMMAND; } { return HA_ERR_WRONG_COMMAND; }
......
...@@ -6223,7 +6223,7 @@ Can't be set to 1 if --log-slave-updates is used.", ...@@ -6223,7 +6223,7 @@ Can't be set to 1 if --log-slave-updates is used.",
{"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.", {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-thread-priority", OPT_SKIP_PRIOR, {"skip-thread-priority", OPT_SKIP_PRIOR,
"Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG, "Don't give threads different priorities. Deprecated option.", 0, 0, 0, GET_NO_ARG, NO_ARG,
DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0}, DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
...@@ -7865,6 +7865,9 @@ mysqld_get_one_option(int optid, ...@@ -7865,6 +7865,9 @@ mysqld_get_one_option(int optid,
break; break;
case (int) OPT_SKIP_PRIOR: case (int) OPT_SKIP_PRIOR:
opt_specialflag|= SPECIAL_NO_PRIOR; opt_specialflag|= SPECIAL_NO_PRIOR;
sql_print_warning("The --skip-thread-priority startup option is deprecated "
"and will be removed in MySQL 7.0. MySQL 6.0 and up do not "
"give threads different priorities.");
break; break;
case (int) OPT_SKIP_LOCK: case (int) OPT_SKIP_LOCK:
opt_external_locking=0; opt_external_locking=0;
......
...@@ -410,6 +410,7 @@ typedef struct st_table_share ...@@ -410,6 +410,7 @@ typedef struct st_table_share
int cached_row_logging_check; int cached_row_logging_check;
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
/** @todo: Move into *ha_data for partitioning */
bool auto_partitioned; bool auto_partitioned;
const char *partition_info; const char *partition_info;
uint partition_info_len; uint partition_info_len;
...@@ -419,6 +420,9 @@ typedef struct st_table_share ...@@ -419,6 +420,9 @@ typedef struct st_table_share
handlerton *default_part_db_type; handlerton *default_part_db_type;
#endif #endif
/** place to store storage engine specific data */
void *ha_data;
/* /*
Set share's table cache key and update its db and table name appropriately. Set share's table cache key and update its db and table name appropriately.
......
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