summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/mariabackup/xtrabackup.cc6
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result12
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test12
-rw-r--r--mysql-test/suite/parts/r/partition_alter_myisam.result10
-rw-r--r--mysql-test/suite/parts/t/partition_alter_myisam.test17
-rw-r--r--mysql-test/suite/perfschema/r/misc.result16
-rw-r--r--mysql-test/suite/perfschema/t/misc.test15
-rw-r--r--sql/events.cc2
-rw-r--r--sql/field.cc9
-rw-r--r--sql/field.h14
-rw-r--r--sql/handler.h7
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_partition.cc5
-rw-r--r--sql/sql_table.cc5
-rw-r--r--sql/sql_view.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc11
-rw-r--r--storage/innobase/row/row0mysql.cc129
-rw-r--r--storage/tokudb/CMakeLists.txt8
-rw-r--r--storage/xtradb/handler/ha_innodb.cc4
-rw-r--r--storage/xtradb/row/row0mysql.cc136
-rw-r--r--support-files/mariadb.service.in9
-rw-r--r--support-files/mariadb@.service.in9
22 files changed, 212 insertions, 233 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index f145a94c923..bd73322dcaf 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -1060,11 +1060,13 @@ struct my_option xb_server_options[] =
(G_PTR*) &defaults_group, (G_PTR*) &defaults_group,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"plugin-dir", OPT_PLUGIN_DIR, "Server plugin directory",
+ {"plugin-dir", OPT_PLUGIN_DIR,
+ "Server plugin directory. Used to load encryption plugin during 'prepare' phase."
+ "Has no effect in the 'backup' phase (plugin directory during backup is the same as server's)",
&xb_plugin_dir, &xb_plugin_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "plugin-load", OPT_PLUGIN_LOAD, "encrypton plugin to load",
+ { "plugin-load", OPT_PLUGIN_LOAD, "encrypton plugin to load during 'prepare' phase.",
&xb_plugin_load, &xb_plugin_load,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index e276303557e..1d61079dbd8 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -1351,3 +1351,15 @@ t CREATE TABLE `t` (
KEY `i` (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
DROP TABLE t;
+#
+# MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
+#
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE TABLE t1 (
+c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT
+) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000;
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+c1
+1e19
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 9b526c7c433..fe7ac2c9657 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -683,3 +683,15 @@ INSERT INTO t VALUES (NULL);
SELECT * FROM t;
SHOW CREATE TABLE t;
DROP TABLE t;
+
+--echo #
+--echo # MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE TABLE t1 (
+ c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT
+) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000;
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result
new file mode 100644
index 00000000000..514593fd4ef
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_alter_myisam.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (i INT) ENGINE=MYISAM
+PARTITION BY LIST(i) (
+PARTITION p0 VALUES IN (1),
+PARTITION p1 VALUES IN (2)
+);
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ALTER TABLE t1 DROP PARTITION p1;
+SELECT * FROM t1;
+i
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test
new file mode 100644
index 00000000000..91ce8d21327
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_alter_myisam.test
@@ -0,0 +1,17 @@
+#
+# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
+#
+
+--source include/have_partition.inc
+
+CREATE TABLE t1 (i INT) ENGINE=MYISAM
+PARTITION BY LIST(i) (
+ PARTITION p0 VALUES IN (1),
+ PARTITION p1 VALUES IN (2)
+);
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ALTER TABLE t1 DROP PARTITION p1;
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index f2d40fe90b5..4c8fdca8e68 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -118,3 +118,19 @@ B
select count(*) from events_statements_history where sql_text like "%...";
count(*)
2
+use test;
+create table t1 (id int);
+insert into t1 values (1), (2), (3);
+truncate performance_schema.events_statements_history;
+select * from t1;
+id
+1
+2
+3
+insert into t1 select RAND()*10000 from t1;
+select sql_text, rows_examined from performance_schema.events_statements_history;
+sql_text rows_examined
+truncate performance_schema.events_statements_history 0
+select * from t1 3
+insert into t1 select RAND()*10000 from t1 6
+drop table t1;
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index bf3e8afffdc..c9f7dc6bfc0 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -207,3 +207,18 @@ select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select _utf8mb4 'васÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑ' as B;
select count(*) from events_statements_history where sql_text like "%...";
+
+
+#
+# MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables
+# Verify that the rows_examined counter is set properly.
+
+use test;
+create table t1 (id int);
+insert into t1 values (1), (2), (3);
+truncate performance_schema.events_statements_history;
+select * from t1;
+insert into t1 select RAND()*10000 from t1;
+select sql_text, rows_examined from performance_schema.events_statements_history;
+drop table t1;
+
diff --git a/sql/events.cc b/sql/events.cc
index 07cfdf1028a..b84c90a526c 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -420,7 +420,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
#endif /* WITH_WSREP */
}
diff --git a/sql/field.cc b/sql/field.cc
index bff936b7052..b4353e33df6 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4807,6 +4807,15 @@ double Field_double::val_real(void)
}
+longlong Field_double::val_int_from_real(bool want_unsigned_result)
+{
+ Converter_double_to_longlong conv(val_real(), want_unsigned_result);
+ if (!want_unsigned_result && conv.error())
+ conv.push_warning(get_thd(), Field_double::val_real(), false);
+ return conv.result();
+}
+
+
my_decimal *Field_real::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
diff --git a/sql/field.h b/sql/field.h
index 1d0ce8c74cf..aeef0fa0a65 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -851,6 +851,10 @@ public:
{ return store(ls->str, (uint32) ls->length, cs); }
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
+ virtual ulonglong val_uint(void)
+ {
+ return (ulonglong) val_int();
+ }
virtual bool val_bool(void)= 0;
virtual my_decimal *val_decimal(my_decimal *);
inline String *val_str(String *str) { return val_str(str, str); }
@@ -2175,6 +2179,7 @@ private:
class Field_double :public Field_real {
+ longlong val_int_from_real(bool want_unsigned_result);
public:
Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2211,13 +2216,8 @@ public:
int store(longlong nr, bool unsigned_val);
int reset(void) { bzero(ptr,sizeof(double)); return 0; }
double val_real(void);
- longlong val_int(void)
- {
- Converter_double_to_longlong conv(Field_double::val_real(), false);
- if (conv.error())
- conv.push_warning(get_thd(), Field_double::val_real(), false);
- return conv.result();
- }
+ longlong val_int(void) { return val_int_from_real(false); }
+ ulonglong val_uint(void) { return (ulonglong) val_int_from_real(true); }
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
int cmp(const uchar *,const uchar *);
diff --git a/sql/handler.h b/sql/handler.h
index 486ba564050..b280f6d597d 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1764,6 +1764,13 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
return false;
}
+ ulong table_options_with_row_type()
+ {
+ if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
+ return table_options | HA_OPTION_PACK_RECORD;
+ else
+ return table_options;
+ }
};
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7a4530082eb..391972ea89a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2379,11 +2379,12 @@ com_multi_end:
THD_STAGE_INFO(thd, stage_cleaning_up);
thd->reset_query();
- thd->set_examined_row_count(0); // For processlist
- thd->set_command(COM_SLEEP);
/* Performance Schema Interface instrumentation, end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->set_examined_row_count(0); // For processlist
+ thd->set_command(COM_SLEEP);
+
thd->m_statement_psi= NULL;
thd->m_digest= NULL;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 3f06c950472..f3b81413c19 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6560,10 +6560,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->part_info= part_info;
lpt->alter_info= alter_info;
lpt->create_info= create_info;
- lpt->db_options= create_info->table_options;
- if (create_info->row_type != ROW_TYPE_FIXED &&
- create_info->row_type != ROW_TYPE_DEFAULT)
- lpt->db_options|= HA_OPTION_PACK_RECORD;
+ lpt->db_options= create_info->table_options_with_row_type();
lpt->table= table;
lpt->key_info_buffer= 0;
lpt->key_count= 0;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c112b01ba36..bc877613190 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4434,10 +4434,7 @@ handler *mysql_create_frm_image(THD *thd,
set_table_default_charset(thd, create_info, (char*) db);
- db_options= create_info->table_options;
- if (create_info->row_type == ROW_TYPE_DYNAMIC ||
- create_info->row_type == ROW_TYPE_PAGE)
- db_options|= HA_OPTION_PACK_RECORD;
+ db_options= create_info->table_options_with_row_type();
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
create_info->db_type)))
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index cdb65a79660..bba79642d87 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -430,14 +430,14 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_type= OT_BASE_ONLY;
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
-
if (check_dependencies_in_with_clauses(lex->with_clauses_list))
{
res= TRUE;
goto err;
}
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+
/*
ignore lock specs for CREATE statement
*/
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9d5ead21701..2297149f272 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -8613,8 +8613,8 @@ no_commit:
whether we update the table autoinc counter or not. */
col_max_value = innobase_get_int_col_max_value(table->next_number_field);
- /* Get the value that MySQL attempted to store in the table. */
- auto_inc = table->next_number_field->val_int();
+ /* Get the value that MySQL attempted to store in the table.*/
+ auto_inc = table->next_number_field->val_uint();
switch (error) {
case DB_DUPLICATE_KEY:
@@ -9080,12 +9080,7 @@ calc_row_difference(
if (field != table->found_next_number_field
|| dfield_is_null(&ufield->new_val)) {
} else {
- auto_inc = row_parse_int(
- static_cast<const byte*>(
- ufield->new_val.data),
- ufield->new_val.len,
- col->mtype,
- col->prtype & DATA_UNSIGNED);
+ auto_inc = field->val_uint();
}
}
n_changed++;
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 5b2e80bc50e..335ca35db95 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -75,7 +75,7 @@ ibool row_rollback_on_timeout = FALSE;
/** Chain node of the list of tables to drop in the background. */
struct row_mysql_drop_t{
- char* table_name; /*!< table name */
+ table_id_t table_id; /*!< table id */
UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list;
/*!< list chain node */
};
@@ -112,19 +112,6 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "db"));
}
-/*********************************************************************//**
-If a table is not yet in the drop list, adds the table to the list of tables
-which the master thread drops in background. We need this on Unix because in
-ALTER TABLE MySQL may call drop table even if the table has running queries on
-it. Also, if there are running foreign key checks on the table, we drop the
-table lazily.
-@return TRUE if the table was not yet in the drop list, and was added there */
-static
-ibool
-row_add_table_to_background_drop_list(
-/*==================================*/
- const char* name); /*!< in: table name */
-
#ifdef UNIV_DEBUG
/** Wait for the background drop list to become empty. */
void
@@ -2817,7 +2804,7 @@ loop:
mutex_enter(&row_drop_list_mutex);
ut_a(row_mysql_drop_list_inited);
-
+next:
drop = UT_LIST_GET_FIRST(row_mysql_drop_list);
n_tables = UT_LIST_GET_LEN(row_mysql_drop_list);
@@ -2830,61 +2817,38 @@ loop:
return(n_tables + n_tables_dropped);
}
- DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
- os_thread_sleep(5000000);
- );
-
- table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
- DICT_ERR_IGNORE_NONE);
-
- if (table == NULL) {
- /* If for some reason the table has already been dropped
- through some other mechanism, do not try to drop it */
+ table = dict_table_open_on_id(drop->table_id, FALSE,
+ DICT_TABLE_OP_OPEN_ONLY_IF_CACHED);
- goto already_dropped;
+ if (!table) {
+ n_tables_dropped++;
+ mutex_enter(&row_drop_list_mutex);
+ UT_LIST_REMOVE(row_mysql_drop_list, drop);
+ MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
+ ut_free(drop);
+ goto next;
}
+ ut_a(!table->can_be_evicted);
+
if (!table->to_be_dropped) {
- /* There is a scenario: the old table is dropped
- just after it's added into drop list, and new
- table with the same name is created, then we try
- to drop the new table in background. */
dict_table_close(table, FALSE, FALSE);
- goto already_dropped;
+ mutex_enter(&row_drop_list_mutex);
+ UT_LIST_REMOVE(row_mysql_drop_list, drop);
+ UT_LIST_ADD_LAST(row_mysql_drop_list, drop);
+ goto next;
}
- ut_a(!table->can_be_evicted);
-
dict_table_close(table, FALSE, FALSE);
if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
- drop->table_name)) {
+ table->name.m_name)) {
/* If the DROP fails for some table, we return, and let the
main thread retry later */
-
return(n_tables + n_tables_dropped);
}
- n_tables_dropped++;
-
-already_dropped:
- mutex_enter(&row_drop_list_mutex);
-
- UT_LIST_REMOVE(row_mysql_drop_list, drop);
-
- MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
-
- ib::info() << "Dropped table "
- << ut_get_name(NULL, drop->table_name)
- << " in background drop queue.",
-
- ut_free(drop->table_name);
-
- ut_free(drop);
-
- mutex_exit(&row_drop_list_mutex);
-
goto loop;
}
@@ -2915,14 +2879,13 @@ which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the
table lazily.
-@return TRUE if the table was not yet in the drop list, and was added there */
+@return whether background DROP TABLE was scheduled for the first time */
static
-ibool
-row_add_table_to_background_drop_list(
-/*==================================*/
- const char* name) /*!< in: table name */
+bool
+row_add_table_to_background_drop_list(table_id_t table_id)
{
row_mysql_drop_t* drop;
+ bool added = true;
mutex_enter(&row_drop_list_mutex);
@@ -2933,27 +2896,21 @@ row_add_table_to_background_drop_list(
drop != NULL;
drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) {
- if (strcmp(drop->table_name, name) == 0) {
- /* Already in the list */
-
- mutex_exit(&row_drop_list_mutex);
-
- return(FALSE);
+ if (drop->table_id == table_id) {
+ added = false;
+ goto func_exit;
}
}
- drop = static_cast<row_mysql_drop_t*>(
- ut_malloc_nokey(sizeof(row_mysql_drop_t)));
-
- drop->table_name = mem_strdup(name);
+ drop = static_cast<row_mysql_drop_t*>(ut_malloc_nokey(sizeof *drop));
+ drop->table_id = table_id;
UT_LIST_ADD_LAST(row_mysql_drop_list, drop);
MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE);
-
+func_exit:
mutex_exit(&row_drop_list_mutex);
-
- return(TRUE);
+ return added;
}
/** Reassigns the table identifier of a table.
@@ -3687,7 +3644,7 @@ row_drop_table_for_mysql(
DBUG_EXECUTE_IF("row_drop_table_add_to_background",
- row_add_table_to_background_drop_list(table->name.m_name);
+ row_add_table_to_background_drop_list(table->id);
err = DB_SUCCESS;
goto funct_exit;
);
@@ -3699,28 +3656,17 @@ row_drop_table_for_mysql(
checks take an IS or IX lock on the table. */
if (table->n_foreign_key_checks_running > 0) {
-
- const char* save_tablename = table->name.m_name;
- ibool added;
-
- added = row_add_table_to_background_drop_list(save_tablename);
-
- if (added) {
+ if (row_add_table_to_background_drop_list(table->id)) {
ib::info() << "You are trying to drop table "
<< table->name
<< " though there is a foreign key check"
" running on it. Adding the table to the"
" background drop queue.";
-
- /* We return DB_SUCCESS to MySQL though the drop will
- happen lazily later */
-
- err = DB_SUCCESS;
- } else {
- /* The table is already in the background drop list */
- err = DB_ERROR;
}
+ /* We return DB_SUCCESS to MySQL though the drop will
+ happen lazily later */
+ err = DB_SUCCESS;
goto funct_exit;
}
@@ -3745,12 +3691,7 @@ row_drop_table_for_mysql(
lock_remove_all_on_table(table, TRUE);
ut_a(table->n_rec_locks == 0);
} else if (table->get_ref_count() > 0 || table->n_rec_locks > 0) {
- ibool added;
-
- added = row_add_table_to_background_drop_list(
- table->name.m_name);
-
- if (added) {
+ if (row_add_table_to_background_drop_list(table->id)) {
ib::info() << "MySQL is trying to drop table "
<< table->name
<< " though there are still open handles to"
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 566a0856925..7490f4e620b 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -4,13 +4,17 @@ IF(CMAKE_VERSION VERSION_LESS "2.8.9")
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
-# tokudb requires F_NOCACHE, O_DIRECT, and designated initializers
+# tokudb requires F_NOCACHE or O_DIRECT, and designated initializers
CHECK_CXX_SOURCE_COMPILES(
"
#include <fcntl.h>
struct a {int b; int c; };
struct a d = { .b=1, .c=2 };
-int main() { return F_NOCACHE + O_DIRECT; }
+#if defined(O_DIRECT) || defined(F_NOCACHE)
+int main() { return 0; }
+#else
+#error
+#endif
" TOKUDB_OK)
ENDIF()
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index b09eaf8058c..68813635b6a 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -8844,7 +8844,7 @@ no_commit:
table->next_number_field);
/* Get the value that MySQL attempted to store in the table.*/
- auto_inc = table->next_number_field->val_int();
+ auto_inc = table->next_number_field->val_uint();
switch (error) {
case DB_DUPLICATE_KEY:
@@ -9436,7 +9436,7 @@ ha_innobase::update_row(
ulonglong auto_inc;
ulonglong col_max_value;
- auto_inc = table->next_number_field->val_int();
+ auto_inc = table->next_number_field->val_uint();
/* We need the upper limit of the col type to check for
whether we update the table autoinc counter or not. */
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 3f79c3af6c8..43f4d4bcdd3 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -74,7 +74,7 @@ UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
/** Chain node of the list of tables to drop in the background. */
struct row_mysql_drop_t{
- char* table_name; /*!< table name */
+ table_id_t table_id; /*!< table id */
UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list;
/*!< list chain node */
};
@@ -137,19 +137,6 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "db"));
}
-/*********************************************************************//**
-If a table is not yet in the drop list, adds the table to the list of tables
-which the master thread drops in background. We need this on Unix because in
-ALTER TABLE MySQL may call drop table even if the table has running queries on
-it. Also, if there are running foreign key checks on the table, we drop the
-table lazily.
-@return TRUE if the table was not yet in the drop list, and was added there */
-static
-ibool
-row_add_table_to_background_drop_list(
-/*==================================*/
- const char* name); /*!< in: table name */
-
/*******************************************************************//**
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */
static
@@ -2787,7 +2774,7 @@ loop:
mutex_enter(&row_drop_list_mutex);
ut_a(row_mysql_drop_list_inited);
-
+next:
drop = UT_LIST_GET_FIRST(row_mysql_drop_list);
n_tables = UT_LIST_GET_LEN(row_mysql_drop_list);
@@ -2800,62 +2787,39 @@ loop:
return(n_tables + n_tables_dropped);
}
- DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
- os_thread_sleep(5000000);
- );
-
- table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
- DICT_ERR_IGNORE_NONE);
-
- if (table == NULL) {
- /* If for some reason the table has already been dropped
- through some other mechanism, do not try to drop it */
+ table = dict_table_open_on_id(drop->table_id, FALSE,
+ DICT_TABLE_OP_NORMAL);
- goto already_dropped;
+ if (!table) {
+ n_tables_dropped++;
+ mutex_enter(&row_drop_list_mutex);
+ UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
+ MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
+ ut_free(drop);
+ goto next;
}
+ ut_a(!table->can_be_evicted);
+
if (!table->to_be_dropped) {
- /* There is a scenario: the old table is dropped
- just after it's added into drop list, and new
- table with the same name is created, then we try
- to drop the new table in background. */
dict_table_close(table, FALSE, FALSE);
- goto already_dropped;
+ mutex_enter(&row_drop_list_mutex);
+ UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
+ UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list,
+ drop);
+ goto next;
}
- ut_a(!table->can_be_evicted);
-
dict_table_close(table, FALSE, FALSE);
if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
- drop->table_name)) {
+ table->name)) {
/* If the DROP fails for some table, we return, and let the
main thread retry later */
-
return(n_tables + n_tables_dropped);
}
- n_tables_dropped++;
-
-already_dropped:
- mutex_enter(&row_drop_list_mutex);
-
- UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
-
- MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
-
- ut_print_timestamp(stderr);
- fputs(" InnoDB: Dropped table ", stderr);
- ut_print_name(stderr, NULL, TRUE, drop->table_name);
- fputs(" in background drop queue.\n", stderr);
-
- mem_free(drop->table_name);
-
- mem_free(drop);
-
- mutex_exit(&row_drop_list_mutex);
-
goto loop;
}
@@ -2887,14 +2851,13 @@ which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the
table lazily.
-@return TRUE if the table was not yet in the drop list, and was added there */
+@return whether background DROP TABLE was scheduled for the first time */
static
-ibool
-row_add_table_to_background_drop_list(
-/*==================================*/
- const char* name) /*!< in: table name */
+bool
+row_add_table_to_background_drop_list(table_id_t table_id)
{
row_mysql_drop_t* drop;
+ bool added = true;
mutex_enter(&row_drop_list_mutex);
@@ -2905,31 +2868,21 @@ row_add_table_to_background_drop_list(
drop != NULL;
drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) {
- if (strcmp(drop->table_name, name) == 0) {
- /* Already in the list */
-
- mutex_exit(&row_drop_list_mutex);
-
- return(FALSE);
+ if (drop->table_id == table_id) {
+ added = false;
+ goto func_exit;
}
}
- drop = static_cast<row_mysql_drop_t*>(
- mem_alloc(sizeof(row_mysql_drop_t)));
-
- drop->table_name = mem_strdup(name);
+ drop = static_cast<row_mysql_drop_t*>(ut_malloc(sizeof *drop));
+ drop->table_id = table_id;
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE);
-
- /* fputs("InnoDB: Adding table ", stderr);
- ut_print_name(stderr, trx, TRUE, drop->table_name);
- fputs(" to background drop list\n", stderr); */
-
+func_exit:
mutex_exit(&row_drop_list_mutex);
-
- return(TRUE);
+ return added;
}
/*********************************************************************//**
@@ -4150,7 +4103,7 @@ row_drop_table_for_mysql(
DBUG_EXECUTE_IF("row_drop_table_add_to_background",
- row_add_table_to_background_drop_list(table->name);
+ row_add_table_to_background_drop_list(table->id);
err = DB_SUCCESS;
goto funct_exit;
);
@@ -4162,33 +4115,22 @@ row_drop_table_for_mysql(
checks take an IS or IX lock on the table. */
if (table->n_foreign_key_checks_running > 0) {
-
- const char* save_tablename = table->name;
- ibool added;
-
- added = row_add_table_to_background_drop_list(save_tablename);
-
- if (added) {
+ if (row_add_table_to_background_drop_list(table->id)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: You are trying to drop table ",
stderr);
- ut_print_name(stderr, trx, TRUE, save_tablename);
+ ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n"
"InnoDB: though there is a"
" foreign key check running on it.\n"
"InnoDB: Adding the table to"
" the background drop queue.\n",
stderr);
-
- /* We return DB_SUCCESS to MySQL though the drop will
- happen lazily later */
-
- err = DB_SUCCESS;
- } else {
- /* The table is already in the background drop list */
- err = DB_ERROR;
}
+ /* We return DB_SUCCESS to MySQL though the drop will
+ happen lazily later */
+ err = DB_SUCCESS;
goto funct_exit;
}
@@ -4213,11 +4155,7 @@ row_drop_table_for_mysql(
lock_remove_all_on_table(table, TRUE);
ut_a(table->n_rec_locks == 0);
} else if (table->n_ref_count > 0 || table->n_rec_locks > 0) {
- ibool added;
-
- added = row_add_table_to_background_drop_list(table->name);
-
- if (added) {
+ if (row_add_table_to_background_drop_list(table->id)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: MySQL is"
" trying to drop table ", stderr);
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 6a307b2c41f..fe00f160d28 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -13,7 +13,9 @@
# and probably others
[Unit]
-Description=MariaDB database server
+Description=MariaDB @VERSION@ database server
+Documentation=man:mysqld(8)
+Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
After=syslog.target
@@ -76,7 +78,7 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
-# Use the [service] section and Environment="MYSQLD_OPTS=...".
+# Use the [Service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
@@ -103,7 +105,8 @@ UMask=007
##
##
## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
-## and adding/setting the following will override this file's settings.
+## and adding/setting the following under [Service] will override this file's
+## settings.
# Useful options not previously available in [mysqld_safe]
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index 410e7433b2b..000724d7fe2 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -18,7 +18,9 @@
# Inspired from https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-db/mysql-init-scripts/files/mysqld_at.service
[Unit]
-Description=MariaDB database server
+Description=MariaDB @VERSION@ database server (multi-instance)
+Documentation=man:mysqld(8)
+Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
After=syslog.target
@@ -89,7 +91,7 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb@.service.d/MY_SPECIAL.conf
-# Use the [service] section and Environment="MYSQLD_OPTS=...".
+# Use the [Service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
@@ -124,7 +126,8 @@ UMask=007
##
##
## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
-## and adding/setting the following will override this file's settings.
+## and adding/setting the following below [Service] will override this file's
+## settings.
# Useful options not previously available in [mysqld_safe]