summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
commit1d0f70c2f894b27e98773a282871d32802f67964 (patch)
tree833e683e0ced29c4323c29a9d845703d4dfcd81b /sql
parent5a86a61219826aadf8d08cbc447fe438f2bf50c3 (diff)
downloadmariadb-git-1d0f70c2f894b27e98773a282871d32802f67964.tar.gz
Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6
Diffstat (limited to 'sql')
-rw-r--r--sql/CMakeLists.txt3
-rw-r--r--sql/handler.h62
-rw-r--r--sql/hash_filo.h6
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/multi_range_read.cc32
-rw-r--r--sql/multi_range_read.h8
-rw-r--r--sql/mysqld.h1
-rw-r--r--sql/opt_range.cc10
-rw-r--r--sql/opt_subselect.cc6
-rw-r--r--sql/share/errmsg-utf8.txt227
-rw-r--r--sql/sql_bootstrap.cc99
-rw-r--r--sql/sql_bootstrap.h44
-rw-r--r--sql/sql_class.h6
-rw-r--r--sql/sql_error.h10
-rw-r--r--sql/sql_parse.cc62
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/table.cc3
18 files changed, 497 insertions, 91 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index ecf91fcf043..805f7b34e04 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -59,7 +59,8 @@ SET (SQL_SOURCE
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
- sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc
+ sql_list.cc sql_load.cc sql_manager.cc
+ sql_parse.cc sql_bootstrap.cc sql_bootstrap.h
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc debug_sync.h
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
diff --git a/sql/handler.h b/sql/handler.h
index ee1731af563..981bf9aec6a 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1069,7 +1069,22 @@ inline LEX_STRING *hton_name(const handlerton *hton)
#define HTON_NOT_USER_SELECTABLE (1 << 5)
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
#define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables
-#define HTON_NO_PARTITION (1 << 8) //You can not partition these tables
+#define HTON_NO_PARTITION (1 << 8) //Not partition of these tables
+
+/*
+ This flag should be set when deciding that the engine does not allow
+ row based binary logging (RBL) optimizations.
+
+ Currently, setting this flag, means that table's read/write_set will
+ be left untouched when logging changes to tables in this engine. In
+ practice this means that the server will not mess around with
+ table->write_set and/or table->read_set when using RBL and deciding
+ whether to log full or minimal rows.
+
+ It's valuable for instance for virtual tables, eg: Performance
+ Schema which have no meaning for replication.
+*/
+#define HTON_NO_BINLOG_ROW_OPT (1 << 9)
class Ha_trx_info;
@@ -1446,21 +1461,24 @@ typedef struct st_range_seq_if
typedef bool (*SKIP_INDEX_TUPLE_FUNC) (range_seq_t seq, range_id_t range_info);
-class COST_VECT
+class Cost_estimate
{
public:
double io_count; /* number of I/O */
double avg_io_cost; /* cost of an average I/O oper. */
double cpu_cost; /* cost of operations in CPU */
- double mem_cost; /* cost of used memory */
double import_cost; /* cost of remote operations */
+ double mem_cost; /* cost of used memory */
enum { IO_COEFF=1 };
enum { CPU_COEFF=1 };
enum { MEM_COEFF=1 };
enum { IMPORT_COEFF=1 };
- COST_VECT() {} // keep gcc happy
+ Cost_estimate()
+ {
+ reset();
+ }
double total_cost()
{
@@ -1468,7 +1486,17 @@ public:
MEM_COEFF*mem_cost + IMPORT_COEFF*import_cost;
}
- void zero()
+ /**
+ Whether or not all costs in the object are zero
+
+ @return true if all costs are zero, false otherwise
+ */
+ bool is_zero() const
+ {
+ return !(io_count || cpu_cost || import_cost || mem_cost);
+ }
+
+ void reset()
{
avg_io_cost= 1.0;
io_count= cpu_cost= mem_cost= import_cost= 0.0;
@@ -1482,13 +1510,14 @@ public:
/* Don't multiply mem_cost */
}
- void add(const COST_VECT* cost)
+ void add(const Cost_estimate* cost)
{
double io_count_sum= io_count + cost->io_count;
add_io(cost->io_count, cost->avg_io_cost);
io_count= io_count_sum;
cpu_cost += cost->cpu_cost;
}
+
void add_io(double add_io_cnt, double add_avg_cost)
{
/* In edge cases add_io_cnt may be zero */
@@ -1501,20 +1530,28 @@ public:
}
}
+ /// Add to CPU cost
+ void add_cpu(double add_cpu_cost) { cpu_cost+= add_cpu_cost; }
+
+ /// Add to import cost
+ void add_import(double add_import_cost) { import_cost+= add_import_cost; }
+
+ /// Add to memory cost
+ void add_mem(double add_mem_cost) { mem_cost+= add_mem_cost; }
+
/*
To be used when we go from old single value-based cost calculations to
- the new COST_VECT-based.
+ the new Cost_estimate-based.
*/
void convert_from_cost(double cost)
{
- zero();
- avg_io_cost= 1.0;
+ reset();
io_count= cost;
}
};
void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted,
- COST_VECT *cost);
+ Cost_estimate *cost);
/*
Indicates that all scanned ranges will be singlepoint (aka equality) ranges.
@@ -2156,10 +2193,11 @@ public:
virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
- uint *mrr_mode, COST_VECT *cost);
+ uint *mrr_mode,
+ Cost_estimate *cost);
virtual ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
uint key_parts, uint *bufsz,
- uint *mrr_mode, COST_VECT *cost);
+ uint *mrr_mode, Cost_estimate *cost);
virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mrr_mode,
HANDLER_BUFFER *buf);
diff --git a/sql/hash_filo.h b/sql/hash_filo.h
index dab54928a55..b6068348d1d 100644
--- a/sql/hash_filo.h
+++ b/sql/hash_filo.h
@@ -32,9 +32,15 @@
class hash_filo_element
{
+private:
hash_filo_element *next_used,*prev_used;
public:
hash_filo_element() {}
+ hash_filo_element *next()
+ { return next_used; }
+ hash_filo_element *prev()
+ { return prev_used; }
+
friend class hash_filo;
};
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c5d1edbe475..48d0b32d51c 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -50,7 +50,7 @@
#include "password.h" // my_make_scrambled_password,
// my_make_scrambled_password_323
#include <m_ctype.h>
-#include "my_md5.h"
+#include <my_md5.h>
#include "sha1.h"
#include "my_aes.h"
#include <zlib.h>
@@ -180,7 +180,8 @@ String *Item_func_md5::val_str_ascii(String *str)
uchar digest[16];
null_value=0;
- MY_MD5_HASH(digest,(uchar *) sptr->ptr(), sptr->length());
+ compute_md5_hash((char *) digest, (const char *) sptr->ptr(),
+ sptr->length());
if (str->alloc(32)) // Ensure that memory is free
{
null_value=1;
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 5b040c1fce3..ac44ba7288b 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -56,7 +56,7 @@
ha_rows
handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param, uint n_ranges_arg,
- uint *bufsz, uint *flags, COST_VECT *cost)
+ uint *bufsz, uint *flags, Cost_estimate *cost)
{
KEY_MULTI_RANGE range;
range_seq_t seq_it;
@@ -106,7 +106,7 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
{
/* The following calculation is the same as in multi_range_read_info(): */
*flags |= HA_MRR_USE_DEFAULT_IMPL;
- cost->zero();
+ cost->reset();
cost->avg_io_cost= 1; /* assume random seeks */
if ((*flags & HA_MRR_INDEX_ONLY) && total_rows > 2)
cost->io_count= keyread_time(keyno, n_ranges, (uint)total_rows);
@@ -154,7 +154,7 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
ha_rows handler::multi_range_read_info(uint keyno, uint n_ranges, uint n_rows,
uint key_parts, uint *bufsz,
- uint *flags, COST_VECT *cost)
+ uint *flags, Cost_estimate *cost)
{
/*
Currently we expect this function to be called only in preparation of scan
@@ -165,7 +165,7 @@ ha_rows handler::multi_range_read_info(uint keyno, uint n_ranges, uint n_rows,
*bufsz= 0; /* Default implementation doesn't need a buffer */
*flags |= HA_MRR_USE_DEFAULT_IMPL;
- cost->zero();
+ cost->reset();
cost->avg_io_cost= 1; /* assume random seeks */
/* Produce the same cost as non-MRR code does */
@@ -1402,7 +1402,7 @@ int DsMrr_impl::dsmrr_next(range_id_t *range_info)
*/
ha_rows DsMrr_impl::dsmrr_info(uint keyno, uint n_ranges, uint rows,
uint key_parts,
- uint *bufsz, uint *flags, COST_VECT *cost)
+ uint *bufsz, uint *flags, Cost_estimate *cost)
{
ha_rows __attribute__((unused)) res;
uint def_flags= *flags;
@@ -1437,7 +1437,7 @@ ha_rows DsMrr_impl::dsmrr_info(uint keyno, uint n_ranges, uint rows,
ha_rows DsMrr_impl::dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param, uint n_ranges,
- uint *bufsz, uint *flags, COST_VECT *cost)
+ uint *bufsz, uint *flags, Cost_estimate *cost)
{
ha_rows rows;
uint def_flags= *flags;
@@ -1551,9 +1551,9 @@ bool DsMrr_impl::check_cpk_scan(THD *thd, uint keyno, uint mrr_flags)
bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
- uint *bufsz, COST_VECT *cost)
+ uint *bufsz, Cost_estimate *cost)
{
- COST_VECT dsmrr_cost;
+ Cost_estimate dsmrr_cost;
bool res;
THD *thd= current_thd;
@@ -1655,7 +1655,7 @@ int DsMrr_impl::dsmrr_explain_info(uint mrr_mode, char *str, size_t size)
}
-static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost);
+static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, Cost_estimate *cost);
/**
@@ -1673,7 +1673,7 @@ static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost
*/
bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
- uint *buffer_size, COST_VECT *cost)
+ uint *buffer_size, Cost_estimate *cost)
{
ulong max_buff_entries, elem_size;
ha_rows rows_in_full_step;
@@ -1707,13 +1707,13 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
}
else
{
- cost->zero();
+ cost->reset();
*buffer_size= max(*buffer_size,
(size_t)(1.2*rows_in_last_step) * elem_size +
primary_file->ref_length + table->key_info[keynr].key_length);
}
- COST_VECT last_step_cost;
+ Cost_estimate last_step_cost;
get_sort_and_sweep_cost(table, rows_in_last_step, &last_step_cost);
cost->add(&last_step_cost);
@@ -1742,7 +1742,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
*/
static
-void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost)
+void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, Cost_estimate *cost)
{
if (nrows)
{
@@ -1754,7 +1754,7 @@ void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost)
cost->cpu_cost += cmp_op * log2(cmp_op);
}
else
- cost->zero();
+ cost->reset();
}
@@ -1802,11 +1802,11 @@ void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost)
*/
void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted,
- COST_VECT *cost)
+ Cost_estimate *cost)
{
DBUG_ENTER("get_sweep_read_cost");
- cost->zero();
+ cost->reset();
if (table->file->primary_key_is_clustered())
{
cost->io_count= table->file->read_time(table->s->primary_key,
diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h
index dcba92aab16..387ae9791bc 100644
--- a/sql/multi_range_read.h
+++ b/sql/multi_range_read.h
@@ -562,11 +562,11 @@ public:
int dsmrr_next(range_id_t *range_info);
ha_rows dsmrr_info(uint keyno, uint n_ranges, uint keys, uint key_parts,
- uint *bufsz, uint *flags, COST_VECT *cost);
+ uint *bufsz, uint *flags, Cost_estimate *cost);
ha_rows dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param, uint n_ranges, uint *bufsz,
- uint *flags, COST_VECT *cost);
+ uint *flags, Cost_estimate *cost);
int dsmrr_explain_info(uint mrr_mode, char *str, size_t size);
private:
@@ -624,9 +624,9 @@ private:
Forward_lifo_buffer rowid_buffer;
bool choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, uint *bufsz,
- COST_VECT *cost);
+ Cost_estimate *cost);
bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
- uint *buffer_size, COST_VECT *cost);
+ uint *buffer_size, Cost_estimate *cost);
bool check_cpk_scan(THD *thd, uint keyno, uint mrr_flags);
bool setup_buffer_sharing(uint key_size_in_keybuf, key_part_map key_tuple_map);
diff --git a/sql/mysqld.h b/sql/mysqld.h
index f32b92633b7..6b073eac59b 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -207,6 +207,7 @@ extern int bootstrap_error;
extern I_List<THD> threads;
extern char err_shared_dir[];
extern TYPELIB thread_handling_typelib;
+extern ulong log_warnings;
/*
THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0390ac1101e..a66a6755757 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -890,7 +890,7 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts);
static ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
SEL_ARG *tree, bool update_tbl_stats,
uint *mrr_flags, uint *bufsize,
- COST_VECT *cost);
+ Cost_estimate *cost);
QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
SEL_ARG *key_tree, uint mrr_flags,
@@ -6691,7 +6691,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
if (*key)
{
ha_rows found_records;
- COST_VECT cost;
+ Cost_estimate cost;
double found_read_time;
uint mrr_flags, buf_size;
INDEX_SCAN_INFO *index_scan;
@@ -9941,7 +9941,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
static
ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
SEL_ARG *tree, bool update_tbl_stats,
- uint *mrr_flags, uint *bufsize, COST_VECT *cost)
+ uint *mrr_flags, uint *bufsize, Cost_estimate *cost)
{
SEL_ARG_RANGE_SEQ seq;
RANGE_SEQ_IF seq_if = {NULL, sel_arg_range_seq_init, sel_arg_range_seq_next, 0, 0};
@@ -10430,7 +10430,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
QUICK_RANGE *range;
uint part;
bool create_err= FALSE;
- COST_VECT cost;
+ Cost_estimate cost;
old_root= thd->mem_root;
/* The following call may change thd->mem_root */
@@ -12103,7 +12103,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
cur_index_tree= get_index_range_tree(cur_index, tree, param,
&cur_param_idx);
/* Check if this range tree can be used for prefix retrieval. */
- COST_VECT dummy_cost;
+ Cost_estimate dummy_cost;
uint mrr_flags= HA_MRR_USE_DEFAULT_IMPL;
uint mrr_bufsize=0;
cur_quick_prefix_records= check_quick_select(param, cur_param_idx,
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 8d1cbeba5f4..9b09bb57358 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -2198,7 +2198,7 @@ bool optimize_semijoin_nests(JOIN *join, table_map all_table_map)
Set the cost to do a full scan of the temptable (will need this to
consider doing sjm-scan):
*/
- sjm->scan_cost.zero();
+ sjm->scan_cost.reset();
sjm->scan_cost.add_io(sjm->rows, lookup_cost);
sjm->lookup_cost.convert_from_cost(lookup_cost);
@@ -2633,12 +2633,12 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
else
{
/* This is SJ-Materialization with lookups */
- COST_VECT prefix_cost;
+ Cost_estimate prefix_cost;
signed int first_tab= (int)idx - mat_info->tables;
double prefix_rec_count;
if (first_tab < (int)join->const_tables)
{
- prefix_cost.zero();
+ prefix_cost.reset();
prefix_rec_count= 1.0;
}
else
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index a762a06cfc1..907161224d5 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -6508,6 +6508,225 @@ ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
# End of 5.5 error messages.
#
+ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+ eng "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted"
+ ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d gefunden. Tabelle ist wahrscheinlich beschädigt"
+
+ER_CANNOT_LOAD_FROM_TABLE_V2
+ eng "Cannot load from %s.%s. The table is probably corrupted"
+ ger "Kann %s.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt"
+
+ER_MASTER_DELAY_VALUE_OUT_OF_RANGE
+ eng "The requested value %u for the master delay exceeds the maximum %u"
+ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT
+ eng "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)"
+
+ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
+ eng "Non matching attribute '%-.64s' between partition and table"
+ swe "Attributet '%-.64s' är olika mellan partition och tabell"
+ER_PARTITION_EXCHANGE_PART_TABLE
+ eng "Table to exchange with partition is partitioned: '%-.64s'"
+ swe "Tabellen att byta ut mot partition är partitionerad: '%-.64s'"
+ER_PARTITION_EXCHANGE_TEMP_TABLE
+ eng "Table to exchange with partition is temporary: '%-.64s'"
+ swe "Tabellen att byta ut mot partition är temporär: '%-.64s'"
+ER_PARTITION_INSTEAD_OF_SUBPARTITION
+ eng "Subpartitioned table, use subpartition instead of partition"
+ swe "Subpartitionerad tabell, använd subpartition istället för partition"
+ER_UNKNOWN_PARTITION
+ eng "Unknown partition '%-.64s' in table '%-.64s'"
+ swe "Okänd partition '%-.64s' i tabell '%-.64s'"
+ER_TABLES_DIFFERENT_METADATA
+ eng "Tables have different definitions"
+ swe "Tabellerna har olika definitioner"
+ER_ROW_DOES_NOT_MATCH_PARTITION
+ eng "Found a row that does not match the partition"
+ swe "Hittade en rad som inte passar i partitionen"
+ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX
+ eng "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size."
+ER_WARN_INDEX_NOT_APPLICABLE
+ eng "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'"
+
+ER_PARTITION_EXCHANGE_FOREIGN_KEY
+ eng "Table to exchange with partition has foreign key references: '%-.64s'"
+ swe "Tabellen att byta ut mot partition har foreign key referenser: '%-.64s'"
+ER_NO_SUCH_KEY_VALUE
+ eng "Key value '%-.192s' was not found in table '%-.192s.%-.192s'"
+ER_RPL_INFO_DATA_TOO_LONG
+ eng "Data for column '%s' too long"
+ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
+ eng "Replication event checksum verification failed while reading from network."
+ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE
+ eng "Replication event checksum verification failed while reading from a log file."
+
+ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX
+ eng "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size."
+ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT
+ eng "Can't update table '%-.192s' while '%-.192s' is being created."
+
+ER_PARTITION_CLAUSE_ON_NONPARTITIONED
+ eng "PARTITION () clause on non partitioned table"
+ swe "PARTITION () klausul för en icke partitionerad tabell"
+ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
+ eng "Found a row not matching the given partition set"
+ swe "Hittade en rad som inte passar i någon given partition"
+ER_NO_SUCH_PARTITION
+ cze "partion '%-.64s' neexistuje"
+ dan "partition '%-.64s' eksisterer ikke"
+ nla "partition '%-.64s' bestaat niet"
+ eng "partition '%-.64s' doesn't exist"
+ est "partition '%-.64s' ei eksisteeri"
+ fre "La partition '%-.64s' n'existe pas"
+ ger "Die partition '%-.64s' existiert nicht"
+ hun "A '%-.64s' partition nem letezik"
+ ita "La tabella particione '%-.64s' non esiste"
+ nor "Partition '%-.64s' doesn't exist"
+ norwegian-ny "Partition '%-.64s' doesn't exist"
+ pol "Partition '%-.64s' doesn't exist"
+ por "Particion '%-.64s' n�o existe"
+ rum "Partition '%-.64s' nu exista"
+ serbian "Partition '%-.64s' ne postoji"
+ slo "Partition '%-.64s' doesn't exist"
+ spa "Particion '%-.64s' no existe"
+ swe "Det finns ingen partition som heter '%-.64s'"
+
+ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
+ eng "Failure while changing the type of replication repository: %s."
+
+ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE
+ eng "The creation of some temporary tables could not be rolled back."
+ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE
+ eng "Some temporary tables were dropped, but these operations could not be rolled back."
+
+ER_MTS_FEATURE_IS_NOT_SUPPORTED
+ eng "%s is not supported in multi-threaded slave mode. %s"
+ER_MTS_UPDATED_DBS_GREATER_MAX
+ eng "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata."
+ER_MTS_CANT_PARALLEL
+ eng "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s."
+ER_MTS_INCONSISTENT_DATA
+ eng "%s"
+
+ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING
+ eng "FULLTEXT index is not supported for partitioned tables."
+ swe "FULLTEXT index stöds ej för partitionerade tabeller."
+
+ER_DA_INVALID_CONDITION_NUMBER 35000
+ eng "Invalid condition number"
+ por "Número de condição inválido"
+
+ER_INSECURE_PLAIN_TEXT
+ eng "Sending passwords in plain text without SSL/TLS is extremely insecure."
+
+ER_INSECURE_CHANGE_MASTER
+ eng "Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives."
+
+ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 23000 S1009
+ eng "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in table '%.192s', key '%.192s'"
+ ger "Fremdschlüssel-Beschränkung für Tabelle '%.192s', Datensatz '%-.192s' würde zu einem doppelten Eintrag in Tabelle '%.192s', Schlüssel '%.192s' führen"
+ swe "FOREIGN KEY constraint för tabell '%.192s', posten '%-.192s' kan inte uppdatera barntabell '%.192s' på grund av nyckel '%.192s'"
+
+ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 23000 S1009
+ eng "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in a child table"
+ ger "Fremdschlüssel-Beschränkung für Tabelle '%.192s', Datensatz '%-.192s' würde zu einem doppelten Eintrag in einer Kind-Tabelle führen"
+ swe "FOREIGN KEY constraint för tabell '%.192s', posten '%-.192s' kan inte uppdatera en barntabell på grund av UNIQUE-test"
+ER_SQLTHREAD_WITH_SECURE_SLAVE
+ eng "Setting authentication options is not possible when only the Slave SQL Thread is being started."
+
+ER_TABLE_HAS_NO_FT
+ eng "The table does not have FULLTEXT index to support this query"
+
+ER_INNODB_FT_LIMIT
+ eng "InnoDB presently supports one FULLTEXT index per table"
+
+ER_INNODB_NO_FT_TEMP_TABLE
+ eng "Cannot create FULLTEXT index on temporary InnoDB table"
+
+ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER
+ eng "The system variable %.200s cannot be set in stored functions or triggers."
+
+ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
+ eng "The system variable %.200s cannot be set when there is an ongoing transaction."
+
+ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST
+ eng "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST."
+
+ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL
+ eng "When @@SESSION.GTID_NEXT_LIST == NULL, the system variable @@SESSION.GTID_NEXT cannot change inside a transaction."
+
+ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION
+ eng "The statement 'SET %.200s' cannot invoke a stored function."
+
+ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL
+ eng "The system variable @@SESSION.GTID_NEXT cannot be 'AUTOMATIC' when @@SESSION.GTID_NEXT_LIST is non-NULL."
+
+ER_SKIPPING_LOGGED_TRANSACTION
+ eng "Skipping transaction %.200s because it has already been executed and logged."
+
+ER_MALFORMED_GTID_SET_SPECIFICATION
+ eng "Malformed GTID set specification '%.200s'."
+
+ER_MALFORMED_GTID_SET_ENCODING
+ eng "Malformed GTID set encoding."
+
+ER_MALFORMED_GTID_SPECIFICATION
+ eng "Malformed GTID specification '%.200s'."
+
+ER_GNO_EXHAUSTED
+ eng "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid."
+
+ER_BAD_SLAVE_AUTO_POSITION
+ eng "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active."
+
+ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON
+ eng "CHANGE MASTER TO AUTO_POSITION = 1 can only be executed when GTID_MODE = ON."
+
+ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET
+ eng "Cannot execute statements with implicit commit inside a transaction when GTID_NEXT != AUTOMATIC or GTID_NEXT_LIST != NULL."
+
+ER_GTID_MODE_2_OR_3_REQUIRES_DISABLE_GTID_UNSAFE_STATEMENTS_ON
+ eng "GTID_MODE = ON or GTID_MODE = UPGRADE_STEP_2 requires DISABLE_GTID_UNSAFE_STATEMENTS = 1."
+
+ER_GTID_MODE_REQUIRES_BINLOG
+ eng "GTID_MODE = ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates."
+
+ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF
+ eng "GTID_NEXT cannot be set to UUID:NUMBER when GTID_MODE = OFF."
+
+ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON
+ eng "GTID_NEXT cannot be set to ANONYMOUS when GTID_MODE = ON."
+
+ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF
+ eng "GTID_NEXT_LIST cannot be set to a non-NULL value when GTID_MODE = OFF."
+
+ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF
+ eng "Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF."
+
+ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE
+ eng "Updates to non-transactional tables are forbidden when DISABLE_GTID_UNSAFE_STATEMENTS = 1."
+
+ER_GTID_UNSAFE_CREATE_SELECT
+ eng "CREATE TABLE ... SELECT is forbidden when DISABLE_GTID_UNSAFE_STATEMENTS = 1."
+
+ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION
+ eng "When DISABLE_GTID_UNSAFE_STATEMENTS = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1."
+
+ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
+ eng "The value of GTID_MODE can only change one step at a time: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions."
+
+ER_MASTER_HAS_PURGED_REQUIRED_GTIDS
+ eng "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires."
+
+ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID
+ eng "GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK."
+
+ER_UNKNOWN_EXPLAIN_FORMAT
+ eng "Unknown EXPLAIN format name: '%s'"
+ rus "Неизвестное имя формата команды EXPLAIN: '%s'"
+
+ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 25006
+ eng "Cannot execute statement in a READ ONLY transaction."
+
#
# MariaDB error messages section starts here
#
@@ -6547,10 +6766,10 @@ ER_UNKNOWN_OPTION
eng "Unknown option '%-.64s'"
ER_BAD_OPTION_VALUE
eng "Incorrect value '%-.64s' for option '%-.64s'"
-ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
- eng "Replication event checksum verification failed while reading from network."
-ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE
- eng "Replication event checksum verification failed while reading from a log file."
+ER_NOT_USED_ERROR_MESSAGE
+ eng ""
+ER_NOT_USED_ERROR_MESSAGE2
+ eng ""
ER_CANT_DO_ONLINE
eng "Can't execute the given '%s' command as online"
ER_DATA_OVERFLOW 22003
diff --git a/sql/sql_bootstrap.cc b/sql/sql_bootstrap.cc
new file mode 100644
index 00000000000..c5e88739df7
--- /dev/null
+++ b/sql/sql_bootstrap.cc
@@ -0,0 +1,99 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+
+#include <ctype.h>
+#include <string.h>
+#include "sql_bootstrap.h"
+
+int read_bootstrap_query(char *query, int *query_length,
+ fgets_input_t input, fgets_fn_t fgets_fn)
+{
+ char line_buffer[MAX_BOOTSTRAP_LINE_SIZE];
+ const char *line;
+ int len;
+ int query_len= 0;
+
+ for ( ; ; )
+ {
+ line= (*fgets_fn)(line_buffer, sizeof(line_buffer), input);
+
+ if (line == NULL)
+ return (query_len ? READ_BOOTSTRAP_ERROR : READ_BOOTSTRAP_EOF);
+
+ len= strlen(line);
+
+ /*
+ Remove trailing whitespace characters.
+ This assumes:
+ - no multibyte encoded character can be found at the very end of a line,
+ - whitespace characters from the "C" locale only.
+ which is sufficient for the kind of queries found
+ in the bootstrap scripts.
+ */
+ while (len && (isspace(line[len - 1])))
+ len--;
+ /*
+ Cleanly end the string, so we don't have to test len > x
+ all the time before reading line[x], in the code below.
+ */
+ line_buffer[len]= '\0';
+
+ /* Skip blank lines */
+ if (len == 0)
+ continue;
+
+ /* Skip # comments */
+ if (line[0] == '#')
+ continue;
+
+ /* Skip -- comments */
+ if ((line[0] == '-') && (line[1] == '-'))
+ continue;
+
+ /* Skip delimiter, ignored. */
+ if (strncmp(line, "delimiter", 9) == 0)
+ continue;
+
+ /* Append the current line to a multi line query. */
+
+ if (query_len + len + 1 >= MAX_BOOTSTRAP_QUERY_SIZE)
+ return READ_BOOTSTRAP_ERROR;
+
+ if (query_len != 0)
+ {
+ /*
+ Append a \n to the current line, if any,
+ to preserve the intended presentation.
+ */
+ query[query_len]= '\n';
+ query_len++;
+ }
+ memcpy(query + query_len, line, len);
+ query_len+= len;
+
+ if (line[len - 1] == ';')
+ {
+ /*
+ The last line is terminated by ';'.
+ Return the query found.
+ */
+ query[query_len]= '\0';
+ *query_length= query_len;
+ return 0;
+ }
+ }
+}
+
diff --git a/sql/sql_bootstrap.h b/sql/sql_bootstrap.h
new file mode 100644
index 00000000000..f80daf4a2f4
--- /dev/null
+++ b/sql/sql_bootstrap.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+
+#ifndef SQL_BOOTSTRAP_H
+#define SQL_BOOTSTRAP_H
+
+/**
+ The maximum size of a bootstrap query.
+ Increase this size if parsing a longer query during bootstrap is necessary.
+ The longest query in use depends on the documentation content,
+ see the file fill_help_tables.sql
+*/
+#define MAX_BOOTSTRAP_QUERY_SIZE 20000
+/**
+ The maximum size of a bootstrap query, expressed in a single line.
+ Do not increase this size, use the multiline syntax instead.
+*/
+#define MAX_BOOTSTRAP_LINE_SIZE 20000
+
+#define READ_BOOTSTRAP_EOF 1
+#define READ_BOOTSTRAP_ERROR 2
+
+typedef void *fgets_input_t;
+typedef char * (*fgets_fn_t)(char *, size_t, fgets_input_t);
+
+int read_bootstrap_query(char *query, int *query_length,
+ fgets_input_t input, fgets_fn_t fgets_fn);
+
+#endif
+
+
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5b53f806ddb..de5c0583213 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3695,13 +3695,13 @@ public:
/*
Cost to materialize - execute the sub-join and write rows into temp.table
*/
- COST_VECT materialization_cost;
+ Cost_estimate materialization_cost;
/* Cost to make one lookup in the temptable */
- COST_VECT lookup_cost;
+ Cost_estimate lookup_cost;
/* Cost of scanning the materialized table */
- COST_VECT scan_cost;
+ Cost_estimate scan_cost;
/* --- Execution structures ---------- */
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 00ade934226..79633ae5df8 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -20,6 +20,8 @@
#include "m_string.h" /* LEX_STRING */
#include "sql_string.h" /* String */
#include "mysql_com.h" /* MYSQL_ERRMSG_SIZE */
+#include "my_time.h" /* MYSQL_TIME */
+#include "decimal.h"
class THD;
@@ -319,6 +321,14 @@ private:
MEM_ROOT *m_mem_root;
};
+class Sql_condition : public MYSQL_ERROR
+{
+ /*
+ Wrapper class to allow one to use Sql_condition in handlers instead of
+ MYSQL_ERROR
+ */
+};
+
///////////////////////////////////////////////////////////////////////////
/**
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e77ae68a5de..17a6cf0f379 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -95,6 +95,7 @@
#include "probes_mysql.h"
#include "set_var.h"
#include "log_slow.h"
+#include "sql_bootstrap.h"
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
@@ -481,11 +482,16 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
}
+static char *fgets_fn(char *buffer, size_t size, fgets_input_t input)
+{
+ MYSQL_FILE *in= static_cast<MYSQL_FILE*> (input);
+ return mysql_file_fgets(buffer, size, in);
+}
+
+
static void handle_bootstrap_impl(THD *thd)
{
MYSQL_FILE *file= bootstrap_file;
- char *buff, *res;
-
DBUG_ENTER("handle_bootstrap");
#ifndef EMBEDDED_LIBRARY
@@ -503,50 +509,30 @@ static void handle_bootstrap_impl(THD *thd)
*/
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
- buff= (char*) thd->net.buff;
thd->init_for_queries();
- while (mysql_file_fgets(buff, thd->net.max_packet, file))
+
+ for ( ; ; )
{
+ char buffer[MAX_BOOTSTRAP_QUERY_SIZE];
+ int rc, length;
char *query;
- /* strlen() can't be deleted because mysql_file_fgets() doesn't return length */
- ulong length= (ulong) strlen(buff);
- while (buff[length-1] != '\n' && !mysql_file_feof(file))
+
+ rc= read_bootstrap_query(buffer, &length, file, fgets_fn);
+
+ if (rc == READ_BOOTSTRAP_ERROR)
{
- /*
- We got only a part of the current string. Will try to increase
- net buffer then read the rest of the current string.
- */
- /* purecov: begin tested */
- if (net_realloc(&(thd->net), 2 * thd->net.max_packet))
- {
- thd->protocol->end_statement();
- bootstrap_error= 1;
- break;
- }
- buff= (char*) thd->net.buff;
- res= mysql_file_fgets(buff + length, thd->net.max_packet - length, file);
- if (!res && !mysql_file_feof(file))
- {
- thd->protocol->end_statement();
- bootstrap_error= 1;
- break;
- }
- length+= (ulong) strlen(buff + length);
- /* purecov: end */
+ thd->raise_error(ER_SYNTAX_ERROR);
+ thd->protocol->end_statement();
+ bootstrap_error= 1;
+ break;
}
- if (bootstrap_error)
- break; /* purecov: inspected */
- while (length && (my_isspace(thd->charset(), buff[length-1]) ||
- buff[length-1] == ';'))
- length--;
- buff[length]=0;
+ if (rc == READ_BOOTSTRAP_EOF)
+ break;
- /* Skip lines starting with delimiter */
- if (strncmp(buff, STRING_WITH_LEN("delimiter")) == 0)
- continue;
+ DBUG_ASSERT(rc == 0);
- query= (char *) thd->memdup_w_gap(buff, length + 1,
+ query= (char *) thd->memdup_w_gap(buffer, length + 1,
thd->db_length + 1 +
QUERY_CACHE_DB_LENGTH_SIZE +
QUERY_CACHE_FLAGS_SIZE);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 0c1fb07d761..7032fdae939 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9588,7 +9588,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
uint table_index,
JOIN_TAB *prev_tab)
{
- COST_VECT cost;
+ Cost_estimate cost;
uint flags= 0;
ha_rows rows= 0;
uint bufsz= 4096;
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 0ed976ac36a..289914df5c5 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -763,7 +763,7 @@ typedef struct st_position :public Sql_alloc
double read_time;
/* Cumulative cost and record count for the join prefix */
- COST_VECT prefix_cost;
+ Cost_estimate prefix_cost;
double prefix_record_count;
/*
diff --git a/sql/table.cc b/sql/table.cc
index 2a11098caed..cf9b3906cbd 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4018,7 +4018,8 @@ void TABLE::reset_item_list(List<Item> *item_list) const
void TABLE_LIST::calc_md5(char *buffer)
{
uchar digest[16];
- MY_MD5_HASH(digest, (uchar *) select_stmt.str, select_stmt.length);
+ compute_md5_hash((char*) digest, select_stmt.str,
+ select_stmt.length);
sprintf((char *) buffer,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1], digest[2], digest[3],