Commit 09049fe4 authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.6' into 10.11

parents 2b8dc766 bdaa6bac
...@@ -47,4 +47,4 @@ SET GLOBAL debug_dbug = NULL; ...@@ -47,4 +47,4 @@ SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET'; SET debug_sync='RESET';
SELECT @@debug_sync; SELECT @@debug_sync;
@@debug_sync @@debug_sync
ON - current signal: '' ON - current signals: ''
...@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug; ...@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2; connection node_2;
SELECT @@debug_sync; SELECT @@debug_sync;
@@debug_sync @@debug_sync
ON - current signal: '' ON - current signals: ''
set debug_sync='RESET'; set debug_sync='RESET';
SET SESSION wsrep_sync_wait = 1; SET SESSION wsrep_sync_wait = 1;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb"; SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
...@@ -45,4 +45,4 @@ SET SESSION wsrep_sync_wait = default; ...@@ -45,4 +45,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait1; DROP TABLE t_wait1;
SELECT @@debug_sync; SELECT @@debug_sync;
@@debug_sync @@debug_sync
ON - current signal: '' ON - current signals: ''
...@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug; ...@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2; connection node_2;
SELECT @@debug_sync; SELECT @@debug_sync;
@@debug_sync @@debug_sync
ON - current signal: '' ON - current signals: ''
SET SESSION wsrep_sync_wait = 8; SET SESSION wsrep_sync_wait = 8;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb"; SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1; connection node_1;
...@@ -46,4 +46,4 @@ SET SESSION wsrep_sync_wait = default; ...@@ -46,4 +46,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait8; DROP TABLE t_wait8;
SELECT @@debug_sync; SELECT @@debug_sync;
@@debug_sync @@debug_sync
ON - current signal: '' ON - current signals: ''
connection node_2; connection node_2;
connection node_1; connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2), (3); INSERT INTO t1 VALUES (2), (3);
...@@ -22,6 +23,8 @@ COUNT(*) = 0 ...@@ -22,6 +23,8 @@ COUNT(*) = 0
1 1
SELECT COUNT(*) = 0 FROM t2; SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0 COUNT(*) = 0
1 0
connection node_1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
SET GLOBAL wsrep_mode=DEFAULT;
...@@ -36,10 +36,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; ...@@ -36,10 +36,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1; connection node_1;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
connection node_1; 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL; SET GLOBAL debug_dbug = NULL;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
# Without a PK # Without a PK
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -41,5 +43,7 @@ TRUNCATE TABLE t1; ...@@ -41,5 +43,7 @@ TRUNCATE TABLE t1;
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2; SELECT COUNT(*) = 0 FROM t2;
--connection node_1
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
SET GLOBAL wsrep_mode=DEFAULT;
...@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1); ...@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t1; SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB' ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. Got one of the listed errors
SELECT * FROM t2; SELECT * FROM t2;
a a
1 1
......
...@@ -59,7 +59,7 @@ SELECT * FROM t1; ...@@ -59,7 +59,7 @@ SELECT * FROM t1;
let $restart_parameters=--innodb_force_recovery=1; let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT --error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
SELECT * FROM t1; SELECT * FROM t1;
SELECT * FROM t2; SELECT * FROM t2;
CHECK TABLE t2; CHECK TABLE t2;
......
...@@ -361,64 +361,68 @@ static bool dict_stats_process_entry_from_recalc_pool(THD *thd) ...@@ -361,64 +361,68 @@ static bool dict_stats_process_entry_from_recalc_pool(THD *thd)
{ {
ut_ad(i->state == recalc::IN_PROGRESS); ut_ad(i->state == recalc::IN_PROGRESS);
recalc_pool.erase(i); recalc_pool.erase(i);
const bool reschedule= !update_now && recalc_pool.empty();
if (err == DB_SUCCESS_LOCKED_REC) if (err == DB_SUCCESS_LOCKED_REC)
recalc_pool.emplace_back(recalc{table_id, recalc::IDLE}); recalc_pool.emplace_back(recalc{table_id, recalc::IDLE});
mysql_mutex_unlock(&recalc_pool_mutex); mysql_mutex_unlock(&recalc_pool_mutex);
if (reschedule)
dict_stats_schedule(MIN_RECALC_INTERVAL * 1000);
} }
return update_now; return update_now;
} }
static tpool::timer* dict_stats_timer; /** Check if the recalc pool is empty. */
static std::mutex dict_stats_mutex; static bool is_recalc_pool_empty()
{
mysql_mutex_lock(&recalc_pool_mutex);
bool empty= recalc_pool.empty();
mysql_mutex_unlock(&recalc_pool_mutex);
return empty;
}
static tpool::timer* dict_stats_timer;
static THD *dict_stats_thd;
static void dict_stats_func(void*) static void dict_stats_func(void*)
{ {
THD *thd= innobase_create_background_thd("InnoDB statistics"); if (!dict_stats_thd)
set_current_thd(thd); dict_stats_thd= innobase_create_background_thd("InnoDB statistics");
while (dict_stats_process_entry_from_recalc_pool(thd)) {} set_current_thd(dict_stats_thd);
dict_defrag_process_entries_from_defrag_pool(thd);
while (dict_stats_process_entry_from_recalc_pool(dict_stats_thd)) {}
dict_defrag_process_entries_from_defrag_pool(dict_stats_thd);
innobase_reset_background_thd(dict_stats_thd);
set_current_thd(nullptr); set_current_thd(nullptr);
destroy_background_thd(thd); if (!is_recalc_pool_empty())
dict_stats_schedule(MIN_RECALC_INTERVAL * 1000);
} }
void dict_stats_start() void dict_stats_start()
{ {
std::lock_guard<std::mutex> lk(dict_stats_mutex); DBUG_ASSERT(!dict_stats_timer);
if (!dict_stats_timer) dict_stats_timer= srv_thread_pool->create_timer(dict_stats_func);
dict_stats_timer= srv_thread_pool->create_timer(dict_stats_func);
} }
static void dict_stats_schedule(int ms) static void dict_stats_schedule(int ms)
{ {
std::unique_lock<std::mutex> lk(dict_stats_mutex, std::defer_lock); if(dict_stats_timer)
/*
Use try_lock() to avoid deadlock in dict_stats_shutdown(), which
uses dict_stats_mutex too. If there is simultaneous timer reschedule,
the first one will win, which is fine.
*/
if (!lk.try_lock())
{
return;
}
if (dict_stats_timer)
dict_stats_timer->set_time(ms,0); dict_stats_timer->set_time(ms,0);
} }
void dict_stats_schedule_now() void dict_stats_schedule_now()
{ {
dict_stats_schedule(10); dict_stats_schedule(0);
} }
/** Shut down the dict_stats_thread. */ /** Shut down the dict_stats_thread. */
void dict_stats_shutdown() void dict_stats_shutdown()
{ {
std::lock_guard<std::mutex> lk(dict_stats_mutex);
delete dict_stats_timer; delete dict_stats_timer;
dict_stats_timer= 0; dict_stats_timer= 0;
if (dict_stats_thd)
{
destroy_background_thd(dict_stats_thd);
dict_stats_thd= 0;
}
} }
...@@ -696,6 +696,46 @@ static LEX_STRING spider_init_queries[] = { ...@@ -696,6 +696,46 @@ static LEX_STRING spider_init_queries[] = {
" add column if not exists driver char(64) default null after filedsn," " add column if not exists driver char(64) default null after filedsn,"
" algorithm=copy, lock=shared;" " algorithm=copy, lock=shared;"
)}, )},
{C_STRING_WITH_LEN(
"alter table mysql.spider_link_mon_servers"
" add column if not exists filedsn text default null after dsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_tables"
" add column if not exists filedsn text default null after dsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_xa_failed_log"
" add column if not exists filedsn text default null after dsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_xa_member"
" add column if not exists filedsn text default null after dsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_link_mon_servers"
" add column if not exists driver char(64) default null after filedsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_tables"
" add column if not exists driver char(64) default null after filedsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_xa_failed_log"
" add column if not exists driver char(64) default null after filedsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN(
"alter table mysql.spider_xa_member"
" add column if not exists driver char(64) default null after filedsn,"
" algorithm=copy, lock=shared;"
)},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0);" "set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0);"
)}, )},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment