summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqlcheck.c52
-rw-r--r--sql/ha_partition.cc2
-rw-r--r--sql/ha_partition.h1
-rw-r--r--sql/handler.cc10
-rw-r--r--sql/key.cc4
-rw-r--r--sql/key.h2
-rw-r--r--sql/partition_info.cc29
-rw-r--r--sql/partition_info.h14
-rw-r--r--sql/sql_yacc.yy23
9 files changed, 12 insertions, 125 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index e614d628630..3559ad2a361 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -32,10 +32,6 @@
#define EX_USAGE 1
#define EX_MYSQLERR 2
-/* ALTER instead of repair. */
-#define MAX_ALTER_STR_SIZE 128 * 1024
-#define KEY_PARTITIONING_CHANGED_STR "KEY () partitioning changed"
-
static MYSQL mysql_connection, *sock = 0;
static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
@@ -51,7 +47,7 @@ static char *opt_password = 0, *current_user = 0,
*default_charset= 0, *current_host= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0;
-DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
+DYNAMIC_ARRAY tables4repair, tables4rebuild;
static char *shared_memory_base_name=0;
static uint opt_protocol=0;
@@ -818,7 +814,6 @@ static void print_result()
MYSQL_RES *res;
MYSQL_ROW row;
char prev[(NAME_LEN+9)*2+2];
- char prev_alter[MAX_ALTER_STR_SIZE];
uint i;
my_bool found_error=0, table_rebuild=0;
DBUG_ENTER("print_result");
@@ -826,7 +821,6 @@ static void print_result()
res = mysql_use_result(sock);
prev[0] = '\0';
- prev_alter[0]= 0;
for (i = 0; (row = mysql_fetch_row(res)); i++)
{
int changed = strcmp(prev, row[0]);
@@ -843,18 +837,12 @@ static void print_result()
strcmp(row[3],"OK"))
{
if (table_rebuild)
- {
- if (prev_alter[0])
- insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
- else
- insert_dynamic(&tables4rebuild, (uchar*) prev);
- }
+ insert_dynamic(&tables4rebuild, (uchar*) prev);
else
insert_dynamic(&tables4repair, (uchar*) prev);
}
found_error=0;
table_rebuild=0;
- prev_alter[0]= 0;
if (opt_silent)
continue;
}
@@ -871,30 +859,11 @@ static void print_result()
printf("%-50s %s", row[0], "Needs upgrade");
else
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
- if (opt_auto_repair && strcmp(row[2],"note"))
+ if (strcmp(row[2],"note"))
{
- const char *alter_txt= strstr(row[3], "ALTER TABLE");
found_error=1;
- if (alter_txt)
- {
+ if (opt_auto_repair && strstr(row[3], "ALTER TABLE") != NULL)
table_rebuild=1;
- if (!strncmp(row[3], KEY_PARTITIONING_CHANGED_STR,
- strlen(KEY_PARTITIONING_CHANGED_STR)) &&
- strstr(alter_txt, "PARTITION BY"))
- {
- if (strlen(alter_txt) >= MAX_ALTER_STR_SIZE)
- {
- printf("Error: Alter command too long (>= %d),"
- " please do \"%s\" or dump/reload to fix it!\n",
- MAX_ALTER_STR_SIZE,
- alter_txt);
- table_rebuild= 0;
- prev_alter[0]= 0;
- }
- else
- strcpy(prev_alter, alter_txt);
- }
- }
}
}
else
@@ -906,12 +875,7 @@ static void print_result()
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
{
if (table_rebuild)
- {
- if (prev_alter[0])
- insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
- else
- insert_dynamic(&tables4rebuild, (uchar*) prev);
- }
+ insert_dynamic(&tables4rebuild, (uchar*) prev);
else
insert_dynamic(&tables4repair, (uchar*) prev);
}
@@ -1030,9 +994,7 @@ int main(int argc, char **argv)
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
- 64, MYF(0)) ||
- my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0,
- 1, MYF(0))))
+ 64, MYF(0))))
goto end;
if (opt_alldbs)
@@ -1057,8 +1019,6 @@ int main(int argc, char **argv)
}
for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
- for (i = 0; i < alter_table_cmds.elements ; i++)
- run_query((char*) dynamic_array_ptr(&alter_table_cmds, i));
}
ret= test(first_error);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 4644863933b..c3d28f91c27 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -55,8 +55,6 @@
#include "sql_table.h" // tablename_to_filename
#include "key.h"
#include "sql_plugin.h"
-#include "sql_show.h" // append_identifier
-#include "sql_admin.h" // SQL_ADMIN_MSG_TEXT_SIZE
#include "debug_sync.h"
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index fc1f1a600d0..5881ee8b41a 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1192,6 +1192,7 @@ public:
private:
int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags);
public:
+
/*
-------------------------------------------------------------------------
Admin commands not supported currently (almost purely MyISAM routines)
diff --git a/sql/handler.cc b/sql/handler.cc
index 685bb6e6c30..6bdda78b758 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -5805,8 +5805,6 @@ int handler::ha_write_row(uchar *buf)
m_lock_type == F_WRLCK);
DBUG_ENTER("handler::ha_write_row");
DEBUG_SYNC_C("ha_write_row_start");
- DBUG_EXECUTE_IF("inject_error_ha_write_row",
- DBUG_RETURN(HA_ERR_INTERNAL_ERROR); );
MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
@@ -5839,7 +5837,6 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
(and the old record is in record[1]).
*/
DBUG_ASSERT(new_data == table->record[0]);
- DBUG_ASSERT(old_data == table->record[1]);
MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
@@ -5861,13 +5858,6 @@ int handler::ha_delete_row(const uchar *buf)
{
int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
- /*
- Normally table->record[0] is used, but sometimes table->record[1] is used.
- */
- DBUG_ASSERT(buf == table->record[0] ||
- buf == table->record[1]);
- DBUG_EXECUTE_IF("inject_error_ha_delete_row",
- return HA_ERR_INTERNAL_ERROR; );
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
diff --git a/sql/key.cc b/sql/key.cc
index 97388f43ebc..edc3e6c0057 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -347,8 +347,8 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
@param prefix_key The field is used as a prefix key.
*/
-void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
- bool prefix_key)
+static void field_unpack(String *to, Field *field, const uchar *rec,
+ uint max_length, bool prefix_key)
{
String tmp;
DBUG_ENTER("field_unpack");
diff --git a/sql/key.h b/sql/key.h
index de2b00a4773..c8b3ad997fb 100644
--- a/sql/key.h
+++ b/sql/key.h
@@ -33,8 +33,6 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
uint key_length);
bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
void key_unpack(String *to, TABLE *form, KEY *key);
-void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
- bool prefix_key);
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key);
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 6556d50b218..cbd7dedec32 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2759,36 +2759,9 @@ int partition_info::fix_parser_data(THD *thd)
if (!(part_type == RANGE_PARTITION ||
part_type == LIST_PARTITION))
{
- if (part_type == HASH_PARTITION && list_of_part_fields)
- {
- /* KEY partitioning, check ALGORITHM = N. Should not pass the parser! */
- if (key_algorithm > KEY_ALGORITHM_55)
- {
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- DBUG_RETURN(true);
- }
- /* If not set, use DEFAULT = 2 for CREATE and ALTER! */
- if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
- thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
- key_algorithm == KEY_ALGORITHM_NONE)
- key_algorithm= KEY_ALGORITHM_55;
- }
+ /* Nothing to do for HASH/KEY partitioning */
DBUG_RETURN(FALSE);
}
- if (is_sub_partitioned() && list_of_subpart_fields)
- {
- /* KEY subpartitioning, check ALGORITHM = N. Should not pass the parser! */
- if (key_algorithm > KEY_ALGORITHM_55)
- {
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- DBUG_RETURN(true);
- }
- /* If not set, use DEFAULT = 2 for CREATE and ALTER! */
- if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
- thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
- key_algorithm == KEY_ALGORITHM_NONE)
- key_algorithm= KEY_ALGORITHM_55;
- }
do
{
part_elem= it++;
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 01f6b53a148..59b40d7ce88 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -210,19 +210,6 @@ public:
but mainly of use to handlers supporting partitioning.
*/
uint16 linear_hash_mask;
- /*
- PARTITION BY KEY ALGORITHM=N
- Which algorithm to use for hashing the fields.
- N = 1 - Use 5.1 hashing (numeric fields are hashed as binary)
- N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes)
- */
- enum enum_key_algorithm
- {
- KEY_ALGORITHM_NONE= 0,
- KEY_ALGORITHM_51= 1,
- KEY_ALGORITHM_55= 2
- };
- enum_key_algorithm key_algorithm;
bool use_default_partitions;
bool use_default_num_partitions;
@@ -273,7 +260,6 @@ public:
count_curr_subparts(0), part_error_code(0),
num_list_values(0), num_part_fields(0), num_subpart_fields(0),
num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
- key_algorithm(KEY_ALGORITHM_NONE),
use_default_partitions(TRUE), use_default_num_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE),
default_partitions_setup(FALSE), defined_max_value(FALSE),
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 07666822acf..b2b269da4f2 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4844,7 +4844,7 @@ partition:
;
part_type_def:
- opt_linear KEY_SYM opt_key_algo '(' part_field_list ')'
+ opt_linear KEY_SYM '(' part_field_list ')'
{
partition_info *part_info= Lex->part_info;
part_info->list_of_part_fields= TRUE;
@@ -4870,25 +4870,6 @@ opt_linear:
{ Lex->part_info->linear_hash_ind= TRUE;}
;
-opt_key_algo:
- /* empty */
- { Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;}
- | ALGORITHM_SYM EQ real_ulong_num
- {
- switch ($3) {
- case 1:
- Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_51;
- break;
- case 2:
- Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55;
- break;
- default:
- my_parse_error(ER(ER_SYNTAX_ERROR));
- MYSQL_YYABORT;
- }
- }
- ;
-
part_field_list:
/* empty */ {}
| part_field_item_list {}
@@ -4970,7 +4951,7 @@ opt_sub_part:
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func
{ Lex->part_info->subpart_type= HASH_PARTITION; }
opt_num_subparts {}
- | SUBPARTITION_SYM BY opt_linear KEY_SYM opt_key_algo
+ | SUBPARTITION_SYM BY opt_linear KEY_SYM
'(' sub_part_field_list ')'
{
partition_info *part_info= Lex->part_info;