summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/contributors.h3
-rw-r--r--sql/item.cc10
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_strfunc.h6
-rw-r--r--sql/mysqld.cc96
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/set_var.h10
-rw-r--r--sql/share/errmsg-utf8.txt4
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_parse.cc34
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_statistics.cc22
-rw-r--r--sql/sql_type.cc56
-rw-r--r--sql/sql_type.h11
-rw-r--r--sql/sys_vars.cc8
-rw-r--r--sql/table.h1
17 files changed, 145 insertions, 127 deletions
diff --git a/sql/contributors.h b/sql/contributors.h
index 7369dcd141d..a0d05af3fa6 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -41,13 +41,12 @@ struct show_table_contributors_st show_table_contributors[]= {
{"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"},
- {"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"},
+ {"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
{"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
{"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"},
{"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
{"Acronis", "http://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Auttomattic", "https://automattic.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
diff --git a/sql/item.cc b/sql/item.cc
index dd12d9a476f..56af69be427 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -10002,6 +10002,8 @@ Item *Item_cache_int::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
new_item= null_value ?
(Item*) new (thd->mem_root) Item_null(thd) :
(Item*) new (thd->mem_root) Item_int(thd, val_int(), max_length);
@@ -10164,6 +10166,8 @@ Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
return new (thd->mem_root) Item_null(thd);
else
@@ -10244,6 +10248,8 @@ Item *Item_cache_real::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
new_item= null_value ?
(Item*) new (thd->mem_root) Item_null(thd) :
(Item*) new (thd->mem_root) Item_float(thd, val_real(),
@@ -10307,6 +10313,8 @@ Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
new_item= (Item*) new (thd->mem_root) Item_null(thd);
else
@@ -10402,6 +10410,8 @@ Item *Item_cache_str::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
new_item= (Item*) new (thd->mem_root) Item_null(thd);
else
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c6b0ae7fba8..85e578f4595 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -317,7 +317,7 @@ String *Item_aes_crypt::val_str(String *str2)
{
DBUG_ASSERT(fixed == 1);
StringBuffer<80> user_key_buf;
- String *sptr= args[0]->val_str(&str_value);
+ String *sptr= args[0]->val_str(&tmp_value);
String *user_key= args[1]->val_str(&user_key_buf);
uint32 aes_length;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 18cda491efd..cff9fdee072 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -212,6 +212,7 @@ class Item_aes_crypt :public Item_str_binary_checksum_func
protected:
int what;
+ String tmp_value;
public:
Item_aes_crypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {}
@@ -221,8 +222,8 @@ public:
class Item_func_aes_encrypt :public Item_aes_crypt
{
public:
- Item_func_aes_encrypt(THD *thd, Item *a, Item *b):
- Item_aes_crypt(thd, a, b) {}
+ Item_func_aes_encrypt(THD *thd, Item *a, Item *b)
+ :Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_encrypt"; }
Item *get_copy(THD *thd)
@@ -1629,6 +1630,7 @@ public:
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
fix_char_length(MY_UUID_STRING_LENGTH);
}
+ table_map used_tables() const { return RAND_TABLE_BIT; }
const char *func_name() const{ return "uuid"; }
String *val_str(String *);
bool check_vcol_func_processor(void *arg)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index edac9d466f7..9de6d090945 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -117,7 +117,7 @@
#include <poll.h>
#endif
-#include <my_systemd.h>
+#include <my_service_manager.h>
#define mysqld_charset &my_charset_latin1
@@ -547,7 +547,7 @@ bool max_user_connections_checking=0;
Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks.
*/
-ulong max_prepared_stmt_count;
+uint max_prepared_stmt_count;
/**
Current total number of prepared statements in the server. This number
is exact, and therefore may not be equal to the difference between
@@ -558,7 +558,7 @@ ulong max_prepared_stmt_count;
two different connections, this counts as two distinct prepared
statements.
*/
-ulong prepared_stmt_count=0;
+uint prepared_stmt_count=0;
my_thread_id global_thread_id= 0;
ulong current_pid;
ulong slow_launch_threads = 0;
@@ -4461,11 +4461,20 @@ static int init_common_variables()
/* connections and databases needs lots of files */
{
- uint files, wanted_files, max_open_files;
+ uint files, wanted_files, max_open_files, min_tc_size, extra_files,
+ min_connections;
+ ulong org_max_connections, org_tc_size;
+ /* Number of files reserved for temporary files */
+ extra_files= 30;
+ min_connections= 10;
/* MyISAM requires two file handles per table. */
- wanted_files= (10 + max_connections + extra_max_connections +
+ wanted_files= (extra_files + max_connections + extra_max_connections +
tc_size * 2);
+ min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN);
+ org_max_connections= max_connections;
+ org_tc_size= tc_size;
+
/*
We are trying to allocate no less than max_connections*5 file
handles (i.e. we are trying to set the limit so that they will
@@ -4477,44 +4486,49 @@ static int init_common_variables()
requested (value of wanted_files).
*/
max_open_files= MY_MAX(MY_MAX(wanted_files,
- (max_connections + extra_max_connections)*5),
- open_files_limit);
+ (max_connections + extra_max_connections)*5),
+ open_files_limit);
files= my_set_max_open_files(max_open_files);
+ SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong);
- if (files < wanted_files)
- {
- if (!open_files_limit || IS_SYSVAR_AUTOSIZE(&open_files_limit))
- {
- /*
- If we have requested too much file handles than we bring
- max_connections in supported bounds.
- */
- SYSVAR_AUTOSIZE(max_connections,
- (ulong) MY_MIN(files-10-TABLE_OPEN_CACHE_MIN*2, max_connections));
- /*
- Decrease tc_size according to max_connections, but
- not below TABLE_OPEN_CACHE_MIN. Outer MY_MIN() ensures that we
- never increase tc_size automatically (that could
- happen if max_connections is decreased above).
- */
- SYSVAR_AUTOSIZE(tc_size,
- (ulong) MY_MIN(MY_MAX((files - 10 - max_connections) / 2,
- TABLE_OPEN_CACHE_MIN), tc_size));
- DBUG_PRINT("warning",
- ("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
- files, max_connections, tc_size));
- if (global_system_variables.log_warnings > 1)
- sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
- files, max_connections, tc_size);
- }
- else if (global_system_variables.log_warnings)
- sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
- }
- SYSVAR_AUTOSIZE(open_files_limit, files);
- }
+ if (files < wanted_files && global_system_variables.log_warnings)
+ sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
+
+ /*
+ If we have requested too much file handles than we bring
+ max_connections in supported bounds. Still leave at least
+ 'min_connections' connections
+ */
+ SYSVAR_AUTOSIZE_IF_CHANGED(max_connections,
+ (ulong) MY_MAX(MY_MIN(files- extra_files-
+ min_tc_size*2,
+ max_connections),
+ min_connections),
+ ulong);
+ /*
+ Decrease tc_size according to max_connections, but
+ not below min_tc_size. Outer MY_MIN() ensures that we
+ never increase tc_size automatically (that could
+ happen if max_connections is decreased above).
+ */
+ SYSVAR_AUTOSIZE_IF_CHANGED(tc_size,
+ (ulong) MY_MIN(MY_MAX((files - extra_files -
+ max_connections) / 2,
+ min_tc_size),
+ tc_size), ulong);
+ DBUG_PRINT("warning",
+ ("Current limits: max_open_files: %u max_connections: %ld table_cache: %ld",
+ files, max_connections, tc_size));
+ if (global_system_variables.log_warnings > 1 &&
+ (max_connections < org_max_connections ||
+ tc_size < org_tc_size))
+ sql_print_warning("Changed limits: max_open_files: %u max_connections: %lu (was %lu) table_cache: %lu (was %lu)",
+ files, max_connections, org_max_connections,
+ tc_size, org_tc_size);
+ }
/*
- Max_connections is now set.
+ Max_connections and tc_cache are now set.
Now we can fix other variables depending on this variable.
*/
@@ -6677,7 +6691,7 @@ void handle_connections_sockets()
#endif
sd_notify(0, "READY=1\n"
- "STATUS=Taking your SQL requests now...");
+ "STATUS=Taking your SQL requests now...\n");
DBUG_PRINT("general",("Waiting for connections."));
MAYBE_BROKEN_SYSCALL;
@@ -6879,7 +6893,7 @@ void handle_connections_sockets()
create_new_thread(connect);
}
sd_notify(0, "STOPPING=1\n"
- "STATUS=Shutdown in progress");
+ "STATUS=Shutdown in progress\n");
DBUG_VOID_RETURN;
}
diff --git a/sql/mysqld.h b/sql/mysqld.h
index e695c2d4d4c..7a616097338 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -240,7 +240,7 @@ extern uint slave_net_timeout;
extern int max_user_connections;
extern volatile ulong cached_thread_count;
extern ulong what_to_log,flush_time;
-extern ulong max_prepared_stmt_count, prepared_stmt_count;
+extern uint max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
extern ulonglong binlog_cache_size, binlog_stmt_cache_size, binlog_file_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
diff --git a/sql/set_var.h b/sql/set_var.h
index 9014a9c4936..82afb3ceea6 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -401,6 +401,16 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free);
set_sys_var_value_origin(&VAR, sys_var::AUTO); \
} while(0)
+#define SYSVAR_AUTOSIZE_IF_CHANGED(VAR,VAL,TYPE) \
+ do { \
+ TYPE tmp= (VAL); \
+ if (VAR != tmp) \
+ { \
+ VAR= (VAL); \
+ set_sys_var_value_origin(&VAR, sys_var::AUTO); \
+ } \
+ } while(0)
+
void set_sys_var_value_origin(void *ptr, enum sys_var::where here);
enum sys_var::where get_sys_var_value_origin(void *ptr);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index c0b3a881b8c..17192663381 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5749,8 +5749,8 @@ ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt"
ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
- eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
- ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %lu)"
+ eng "Can't create more than max_prepared_stmt_count statements (current value: %u)"
+ ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %u)"
ER_VIEW_RECURSIVE
eng "%`s.%`s contains view recursion"
ger "%`s.%`s enthält View-Rekursion"
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3354a2fdf1b..5ce6a6b001c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -484,7 +484,8 @@ err_with_reopen:
old locks. This should always succeed (unless some external process
has removed the tables)
*/
- result= thd->locked_tables_list.reopen_tables(thd);
+ if (thd->locked_tables_list.reopen_tables(thd))
+ result= true;
/*
Since downgrade_lock() won't do anything with shared
metadata lock it is much simpler to go through all open tables rather
diff --git a/sql/sql_const.h b/sql/sql_const.h
index 65742235bee..e28a0649f04 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -127,7 +127,7 @@
#define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16
#define SEQUENCES_HASH_SIZE 16
-#define TABLE_OPEN_CACHE_MIN 400
+#define TABLE_OPEN_CACHE_MIN 200
#define TABLE_OPEN_CACHE_DEFAULT 2000
#define TABLE_DEF_CACHE_DEFAULT 400
/**
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index f85d25525d4..27edfa47799 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1358,22 +1358,27 @@ bool do_command(THD *thd)
command= fetch_command(thd, packet);
#ifdef WITH_WSREP
- /*
- Bail out if DB snapshot has not been installed.
- */
- if (thd->variables.wsrep_on && !thd->wsrep_applier &&
- (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
- (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0)
+ if (WSREP(thd))
{
- thd->protocol->end_statement();
+ /*
+ Bail out if DB snapshot has not been installed.
+ */
+ if (!thd->wsrep_applier &&
+ (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
+ (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0)
+ {
+ my_message(ER_UNKNOWN_COM_ERROR,
+ "WSREP has not yet prepared node for application use", MYF(0));
+ thd->protocol->end_statement();
- /* Performance Schema Interface instrumentation end. */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
- thd->m_statement_psi= NULL;
- thd->m_digest= NULL;
+ /* Performance Schema Interface instrumentation end. */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
- return_value= FALSE;
- goto out;
+ return_value= FALSE;
+ goto out;
+ }
}
#endif
@@ -3439,8 +3444,7 @@ mysql_execute_command(THD *thd)
* allow SET and SHOW queries and reads from information schema
* and dirty reads (if configured)
*/
- if (thd->variables.wsrep_on &&
- !thd->wsrep_applier &&
+ if (!thd->wsrep_applier &&
!(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) &&
!(thd->variables.wsrep_dirty_reads &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index b8f0023eefb..6c1a4a32fb4 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -30,6 +30,7 @@
#include "sql_show.h"
#include "debug_sync.h"
#include "des_key_file.h"
+#include "transaction.h"
static void disable_checkpoints(THD *thd);
@@ -593,6 +594,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
return FALSE;
error_reset_bits:
+ trans_rollback_stmt(thd);
close_thread_tables(thd);
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
error:
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 26fdce12e7f..e62a49f71ea 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3081,18 +3081,19 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
return FALSE;
/*
- Do not read statistics for any query over non-user tables.
- If the query references some statistical tables, but not all
- of them, reading the statistics may lead to a deadlock
- */
+ Do not read statistics for any query that explicity involves
+ statistical tables, failure to to do so we may end up
+ in a deadlock.
+ */
+
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{
if (!tl->is_view_or_derived() && tl->table)
{
TABLE_SHARE *table_share= tl->table->s;
if (table_share &&
- (table_share->table_category != TABLE_CATEGORY_USER ||
- table_share->tmp_table != NO_TMP_TABLE))
+ table_share->table_category != TABLE_CATEGORY_USER
+ && is_stat_table(&tl->db, &tl->alias))
return FALSE;
}
}
@@ -3767,6 +3768,15 @@ double get_column_range_cardinality(Field *field,
if (!col_stats)
return tab_records;
+ /*
+ Use statistics for a table only when we have actually read
+ the statistics from the stat tables. For example due to
+ chances of getting a deadlock we disable reading statistics for
+ a table.
+ */
+
+ if (!table->stats_is_read)
+ return tab_records;
double col_nulls= tab_records * col_stats->get_nulls_ratio();
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 6354dc603fd..421ff0ed0f1 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -1365,27 +1365,6 @@ Field *Type_handler_varchar_compressed::make_conversion_table_field(TABLE *table
}
-Field *Type_handler_tiny_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 1, target->charset());
-}
-
-
-Field *Type_handler_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 2, target->charset());
-}
-
Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
uint metadata,
@@ -1403,28 +1382,6 @@ Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
}
-Field *Type_handler_medium_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 3, target->charset());
-}
-
-
-Field *Type_handler_long_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 4, target->charset());
-}
-
-
#ifdef HAVE_SPATIAL
const Name Type_handler_geometry::m_name_geometry(STRING_WITH_LEN("geometry"));
@@ -5770,6 +5727,19 @@ void Type_handler_datetime_common::Item_param_set_param_func(Item_param *param,
param->set_param_datetime(pos, len);
}
+Field *Type_handler_blob_common::make_conversion_table_field(TABLE *table,
+ uint metadata,
+ const Field *target)
+ const
+{
+ uint pack_length= metadata & 0x00ff;
+ if (pack_length < 1 || pack_length > 4)
+ return NULL; // Broken binary log?
+ return new(table->in_use->mem_root)
+ Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
+ table->s, pack_length, target->charset());
+}
+
void Type_handler_timestamp_common::Item_param_set_param_func(Item_param *param,
uchar **pos,
diff --git a/sql/sql_type.h b/sql/sql_type.h
index db03b77d48f..dd37e2ba96c 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -2964,6 +2964,8 @@ class Type_handler_blob_common: public Type_handler_longstr
{
public:
virtual ~Type_handler_blob_common() { }
+ Field *make_conversion_table_field(TABLE *, uint metadata,
+ const Field *target) const;
const Type_handler *type_handler_for_tmp_table(const Item *item) const
{
return blob_type_handler(item);
@@ -2988,6 +2990,7 @@ public:
Type_all_attributes *atrr,
Item **items, uint nitems) const;
void Item_param_setup_conversion(THD *thd, Item_param *) const;
+
};
@@ -2999,8 +3002,6 @@ public:
const Name name() const { return m_name_tinyblob; }
enum_field_types field_type() const { return MYSQL_TYPE_TINY_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3016,8 +3017,6 @@ public:
const Name name() const { return m_name_mediumblob; }
enum_field_types field_type() const { return MYSQL_TYPE_MEDIUM_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3035,8 +3034,6 @@ public:
uint32 calc_pack_length(uint32 length) const;
Item *create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3052,8 +3049,6 @@ public:
const Name name() const { return m_name_blob; }
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 101c30237bf..d0c0662c0a0 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1491,7 +1491,7 @@ static bool fix_max_connections(sys_var *self, THD *thd, enum_var_type type)
static Sys_var_ulong Sys_max_connections(
"max_connections", "The number of simultaneous clients allowed",
PARSED_EARLY GLOBAL_VAR(max_connections), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 100000),
+ VALID_RANGE(10, 100000),
DEFAULT(MAX_CONNECTIONS_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
@@ -2219,11 +2219,11 @@ static Sys_var_ulong Sys_max_long_data_size(
BLOCK_SIZE(1));
static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
-static Sys_var_ulong Sys_max_prepared_stmt_count(
+static Sys_var_uint Sys_max_prepared_stmt_count(
"max_prepared_stmt_count",
"Maximum number of prepared statements in the server",
GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1),
+ VALID_RANGE(0, UINT_MAX32), DEFAULT(16382), BLOCK_SIZE(1),
&PLock_prepared_stmt_count);
static Sys_var_ulong Sys_max_recursive_iterations(
@@ -3469,7 +3469,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
+ VALID_RANGE(10, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_table_open_cache));
diff --git a/sql/table.h b/sql/table.h
index 32e99db880f..ac382e5aa94 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2537,6 +2537,7 @@ struct TABLE_LIST
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
(alias.str ? alias.str : "<NULL>"),
get_unit()));
+ derived= get_unit();
derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
DTYPE_TABLE | DTYPE_MATERIALIZE);
set_check_materialized();