Merge 10.1 to 10.2
Follow-up fix to MDEV-14008: Let Field_double::val_uint() silently return 0 on error
This commit is contained in:
commit
8d70097c21
@ -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 },
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
10
mysql-test/suite/parts/r/partition_alter_myisam.result
Normal file
10
mysql-test/suite/parts/r/partition_alter_myisam.result
Normal file
@ -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;
|
17
mysql-test/suite/parts/t/partition_alter_myisam.test
Normal file
17
mysql-test/suite/parts/t/partition_alter_myisam.test
Normal file
@ -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;
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
14
sql/field.h
14
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 *);
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)))
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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++;
|
||||
|
@ -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_id(drop->table_id, FALSE,
|
||||
DICT_TABLE_OP_OPEN_ONLY_IF_CACHED);
|
||||
|
||||
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 */
|
||||
|
||||
goto already_dropped;
|
||||
}
|
||||
|
||||
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;
|
||||
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) {
|
||||
dict_table_close(table, FALSE, FALSE);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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"
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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_id(drop->table_id, FALSE,
|
||||
DICT_TABLE_OP_NORMAL);
|
||||
|
||||
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 */
|
||||
|
||||
goto already_dropped;
|
||||
}
|
||||
|
||||
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;
|
||||
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) {
|
||||
dict_table_close(table, FALSE, FALSE);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user