summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_partition.cc23
-rw-r--r--sql/ha_partition.h3
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/item_strfunc.cc4
-rw-r--r--sql/item_sum.cc8
-rw-r--r--sql/log_event.cc4
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_range.cc19
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/set_var.h3
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sys_vars.cc12
14 files changed, 60 insertions, 27 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index feda3460c9f..cdb8690ba62 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1345,7 +1345,8 @@ bool ha_partition::is_crashed() const
int ha_partition::prepare_new_partition(TABLE *tbl,
HA_CREATE_INFO *create_info,
handler *file, const char *part_name,
- partition_element *p_elem)
+ partition_element *p_elem,
+ uint disable_non_uniq_indexes)
{
int error;
DBUG_ENTER("prepare_new_partition");
@@ -1371,6 +1372,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock)))
goto error_open;
DBUG_PRINT("info", ("partition %s opened", part_name));
+
/*
Note: if you plan to add another call that may return failure,
better to do it before external_lock() as cleanup_new_partition()
@@ -1381,6 +1383,9 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
goto error_external_lock;
DBUG_PRINT("info", ("partition %s external locked", part_name));
+ if (disable_non_uniq_indexes)
+ file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
+
DBUG_RETURN(0);
error_external_lock:
(void) file->ha_close();
@@ -1658,6 +1663,14 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
on them to prepare them for copy phase and also for later close
calls
*/
+
+ /*
+ Before creating new partitions check whether indexes are disabled
+ in the partitions.
+ */
+
+ uint disable_non_uniq_indexes = indexes_are_disabled();
+
i= 0;
part_count= 0;
part_it.rewind();
@@ -1692,11 +1705,13 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
if ((error= prepare_new_partition(table, create_info,
new_file_array[part],
(const char *)part_name_buff,
- sub_elem)))
+ sub_elem,
+ disable_non_uniq_indexes)))
{
cleanup_new_partition(part_count);
DBUG_RETURN(error);
}
+
m_added_file[part_count++]= new_file_array[part];
} while (++j < num_subparts);
}
@@ -1709,11 +1724,13 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
if ((error= prepare_new_partition(table, create_info,
new_file_array[i],
(const char *)part_name_buff,
- part_elem)))
+ part_elem,
+ disable_non_uniq_indexes)))
{
cleanup_new_partition(part_count);
DBUG_RETURN(error);
}
+
m_added_file[part_count++]= new_file_array[i];
}
}
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 7941c1ce581..cec377b9e29 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -269,7 +269,8 @@ private:
void cleanup_new_partition(uint part_count);
int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info,
handler *file, const char *part_name,
- partition_element *p_elem);
+ partition_element *p_elem,
+ uint disable_non_uniq_indexes);
/*
delete_table, rename_table and create uses very similar logic which
is packed into this routine.
diff --git a/sql/handler.cc b/sql/handler.cc
index e6981689d19..2e038be0092 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4906,8 +4906,10 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
"", 0, "DISABLED", 8) ? 1 : 0;
}
else
+ {
result= db_type->show_status &&
db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0;
+ }
}
/*
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 1c51ffaeea6..fc0d3beeea3 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -2888,7 +2888,9 @@ String *Item_func_conv::val_str(String *str)
int to_base= (int) args[2]->val_int();
int err;
+ // Note that abs(INT_MIN) is undefined.
if (args[0]->null_value || args[1]->null_value || args[2]->null_value ||
+ from_base == INT_MIN || to_base == INT_MIN ||
abs(to_base) > 36 || abs(to_base) < 2 ||
abs(from_base) > 36 || abs(from_base) < 2 || !(res->length()))
{
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 092531c1c9e..092c9728d47 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1579,8 +1579,12 @@ void Item_sum_count::clear()
bool Item_sum_count::add()
{
- if (!args[0]->maybe_null || !args[0]->is_null())
- count++;
+ for (uint i=0; i<arg_count; i++)
+ {
+ if (args[i]->maybe_null && args[i]->is_null())
+ return 0;
+ }
+ count++;
return 0;
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 113234d3106..73686a2fd0c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5955,9 +5955,7 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
switch (type) {
case LAST_INSERT_ID_EVENT:
- thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
- thd->first_successful_insert_id_in_prev_stmt_for_binlog=
- thd->first_successful_insert_id_in_prev_stmt= val;
+ thd->first_successful_insert_id_in_prev_stmt= val;
DBUG_PRINT("info",("last_insert_id_event: %ld", (long) val));
break;
case INSERT_ID_EVENT:
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index e0a0d5b75cf..4b78492c857 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index dbaec28b8df..66bd287d86a 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -10340,15 +10340,16 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
{
KEY *table_key=quick->head->key_info+quick->index;
flag=EQ_RANGE;
- if ((table_key->flags & HA_NOSAME) && key->part == table_key->key_parts-1)
+ if ((table_key->flags & HA_NOSAME) &&
+ key_tree->part == table_key->key_parts-1)
{
- if (!(table_key->flags & HA_NULL_PART_KEY) ||
- !null_part_in_key(key,
- param->min_key,
- (uint) (tmp_min_key - param->min_key)))
- flag|= UNIQUE_RANGE;
- else
- flag|= NULL_RANGE;
+ if ((table_key->flags & HA_NULL_PART_KEY) &&
+ null_part_in_key(key,
+ param->min_key,
+ (uint) (tmp_min_key - param->min_key)))
+ flag|= NULL_RANGE;
+ else
+ flag|= UNIQUE_RANGE;
}
}
}
@@ -10378,7 +10379,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
}
/*
- Return 1 if there is only one range and this uses the whole primary key
+ Return 1 if there is only one range and this uses the whole unique key
*/
bool QUICK_RANGE_SELECT::unique_key_range()
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 7c3cec38601..2179f50d266 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -216,7 +216,6 @@ uchar *sys_var::global_value_ptr(THD *thd, LEX_STRING *base)
bool sys_var::check(THD *thd, set_var *var)
{
- do_deprecated_warning(thd);
if ((var->value && do_check(thd, var))
|| (on_check && on_check(this, thd, var)))
{
@@ -592,6 +591,7 @@ err:
int set_var::check(THD *thd)
{
+ var->do_deprecated_warning(thd);
if (var->is_readonly())
{
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str, "read only");
diff --git a/sql/set_var.h b/sql/set_var.h
index 205812e8822..2b3a376488b 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -140,6 +140,7 @@ public:
return (option.id != -1) && ((flags & PARSE_EARLY) == parse_flags) &&
insert_dynamic(array, (uchar*)&option);
}
+ void do_deprecated_warning(THD *thd);
private:
virtual bool do_check(THD *thd, set_var *var) = 0;
@@ -153,7 +154,7 @@ private:
virtual void global_save_default(THD *thd, set_var *var) = 0;
virtual bool session_update(THD *thd, set_var *var) = 0;
virtual bool global_update(THD *thd, set_var *var) = 0;
- void do_deprecated_warning(THD *thd);
+
protected:
/**
A pointer to a value of the variable for SHOW.
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 0ce09e3fcd0..665d5b2724f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -492,6 +492,7 @@ void lex_start(THD *thd)
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
lex->select_lex.group_list.empty();
lex->select_lex.order_list.empty();
+ lex->select_lex.gorder_list.empty();
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
lex->spname= NULL;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index eb48e2be48b..357bd8efc27 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -5106,6 +5106,8 @@ that are reorganised.
}
else if (alter_info->flags & ALTER_REBUILD_PARTITION)
{
+ set_engine_all_partitions(tab_part_info,
+ tab_part_info->default_engine_type);
if (set_part_state(alter_info, tab_part_info, PART_CHANGED))
{
my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD");
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ad1e291a9d7..e948813584d 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -880,7 +880,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
if (param->state == Item_param::NO_VALUE)
DBUG_RETURN(1);
- if (param->limit_clause_param)
+ if (param->limit_clause_param && param->state != Item_param::INT_VALUE)
{
param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS);
param->item_type= Item::INT_ITEM;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 9526933933f..5b4d4fdb4eb 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
- Copyright (c) 2012, Monty Program Ab
+/* Copyright (c) 2002, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2014, SkySQL Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1769,9 +1769,13 @@ static Sys_var_charptr Sys_socket(
static Sys_var_ulong Sys_thread_concurrency(
"thread_concurrency",
"Permits the application to give the threads system a hint for "
- "the desired number of threads that should be run at the same time",
+ "the desired number of threads that should be run at the same time."
+ "This variable has no effect, and is deprecated. "
+ "It will be removed in a future release.",
READ_ONLY GLOBAL_VAR(concurrency), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1));
+ VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
+ DEPRECATED(""));
static Sys_var_ulonglong Sys_thread_stack(
"thread_stack", "The stack size for each thread",