summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-04-07 17:11:22 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-04-07 17:11:22 +0300
commit4c89cff5582e786d1cde40b75c2290c136e64e31 (patch)
tree098edebe3e6e97ca234bf8842580851f807cd57a /sql
parent4ede2fec4cb7165a469776bfdbf247db86acb297 (diff)
parent400a8eb60f832030a04a248e2c96552aa3f44055 (diff)
downloadmariadb-git-4c89cff5582e786d1cde40b75c2290c136e64e31.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql')
-rw-r--r--sql/contributors.h3
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_strfunc.h6
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/share/errmsg-utf8.txt4
-rw-r--r--sql/sql_statistics.cc23
-rw-r--r--sql/sql_yacc.yy5
-rw-r--r--sql/sys_vars.cc4
-rw-r--r--sql/table.h1
10 files changed, 35 insertions, 19 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_strfunc.cc b/sql/item_strfunc.cc
index cd47257a77b..db1ba15214f 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -318,7 +318,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 e19efd31229..e68c54ab6ea 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -202,6 +202,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) {}
@@ -211,8 +212,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"; }
};
@@ -1241,6 +1242,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(uchar *int_arg)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index fc633a4fc46..5735dbfda28 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -540,7 +540,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
@@ -551,7 +551,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;
ulong thread_id=1L,current_pid;
ulong slow_launch_threads = 0;
uint sync_binlog_period= 0, sync_relaylog_period= 0,
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 0725d862553..97ecf889787 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -200,7 +200,7 @@ extern ulong slave_trans_retries;
extern uint slave_net_timeout;
extern int max_user_connections;
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;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 52be5e14e14..d73a22c80dc 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5577,8 +5577,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 "`%-.192s`.`%-.192s` contains view recursion"
ger "`%-.192s`.`%-.192s` enthält View-Rekursion"
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 1e8e959314b..22444e16dd3 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3083,18 +3083,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();
@@ -3990,4 +4000,3 @@ bool is_stat_table(const char *db, const char *table)
}
return false;
}
-
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 1d380ce0c6b..fcfc63439cb 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -14503,6 +14503,11 @@ option_value_no_option_type:
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{
struct sys_var_with_base tmp= $4;
+ if (tmp.var == trg_new_row_fake_var)
+ {
+ my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), "NEW");
+ MYSQL_YYABORT;
+ }
/* Lookup if necessary: must be a system variable. */
if (tmp.var == NULL)
{
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 8f4ab34e4c4..9f87d66fef1 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2111,11 +2111,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_sort_length(
diff --git a/sql/table.h b/sql/table.h
index 5abb99cd0c7..61763d76391 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2305,6 +2305,7 @@ struct TABLE_LIST
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
(alias ? alias : "<NULL>"),
get_unit()));
+ derived= get_unit();
derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
DTYPE_TABLE | DTYPE_MATERIALIZE);
set_check_materialized();