Skip to content

Commit fa57479

Browse files
committed
Merge 10.0 into 10.1
2 parents 58c56dd + 75b35a3 commit fa57479

25 files changed

+373
-447
lines changed

extra/mariabackup/xtrabackup.cc

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,18 +1899,16 @@ innodb_init(void)
18991899
return(TRUE);
19001900
}
19011901

1902-
static my_bool
1903-
innodb_end(void)
1902+
static void
1903+
innodb_end()
19041904
{
19051905
srv_fast_shutdown = (ulint) innobase_fast_shutdown;
19061906
innodb_inited = 0;
19071907

19081908
msg("xtrabackup: starting shutdown with innodb_fast_shutdown = %lu\n",
19091909
srv_fast_shutdown);
19101910

1911-
if (innobase_shutdown_for_mysql() != DB_SUCCESS) {
1912-
goto error;
1913-
}
1911+
innodb_shutdown();
19141912
free(internal_innobase_data_file_path);
19151913
internal_innobase_data_file_path = NULL;
19161914

@@ -1921,12 +1919,6 @@ innodb_end(void)
19211919
// pthread_mutex_destroy(&commit_threads_m);
19221920
// pthread_mutex_destroy(&commit_cond_m);
19231921
// pthread_cond_destroy(&commit_cond);
1924-
1925-
return(FALSE);
1926-
1927-
error:
1928-
msg("xtrabackup: innodb_end(): Error occured.\n");
1929-
return(TRUE);
19301922
}
19311923

19321924
/* ================= common ================= */
@@ -4819,8 +4811,7 @@ xtrabackup_stats_func(int argc, char **argv)
48194811
xb_filters_free();
48204812

48214813
/* shutdown InnoDB */
4822-
if(innodb_end())
4823-
exit(EXIT_FAILURE);
4814+
innodb_end();
48244815
}
48254816

48264817
/* ================= prepare ================= */
@@ -6763,8 +6754,7 @@ xtrabackup_prepare_func(int argc, char ** argv)
67636754
xb_write_galera_info(xtrabackup_incremental);
67646755
#endif
67656756

6766-
if(innodb_end())
6767-
goto error_cleanup;
6757+
innodb_end();
67686758

67696759
innodb_free_param();
67706760

@@ -6850,9 +6840,7 @@ xtrabackup_prepare_func(int argc, char ** argv)
68506840
if(innodb_init())
68516841
goto error;
68526842

6853-
if(innodb_end())
6854-
goto error;
6855-
6843+
innodb_end();
68566844
innodb_free_param();
68576845

68586846
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
create table t1 (a int not null, d varchar(15) not null, b
2+
varchar(198) not null, c char(156),
3+
fulltext ftsic(c)) engine=InnoDB
4+
row_format=redundant;
5+
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
6+
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
7+
insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
8+
insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
9+
insert into t1 select * from t1;
10+
insert into t1 select * from t1;
11+
insert into t1 select * from t1;
12+
insert into t1 select * from t1;
13+
insert into t1 select * from t1;
14+
insert into t1 select * from t1;
15+
insert into t1 select * from t1;
16+
insert into t1 select * from t1;
17+
insert into t1 select * from t1;
18+
insert into t1 select * from t1;
19+
SET GLOBAL innodb_file_per_table=OFF;
20+
create table t2 (a int not null, d varchar(15) not null, b
21+
varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
22+
row_format=redundant;
23+
insert into t2 select * from t1;
24+
create table t3 (a int not null, d varchar(15) not null, b varchar(198),
25+
c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
26+
row_format=redundant;
27+
insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
28+
insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
29+
SET GLOBAL innodb_fast_shutdown=0;
30+
SELECT COUNT(*) FROM t1;
31+
COUNT(*)
32+
4096
33+
SELECT COUNT(*) FROM t2;
34+
COUNT(*)
35+
4096
36+
SELECT COUNT(*) FROM t3;
37+
COUNT(*)
38+
2
39+
TRUNCATE TABLE t1;
40+
ERROR HY000: Table 't1' is read only
41+
TRUNCATE TABLE t2;
42+
ERROR HY000: Table 't2' is read only
43+
TRUNCATE TABLE t3;
44+
ERROR HY000: Table 't3' is read only
45+
TRUNCATE TABLE t1;
46+
TRUNCATE TABLE t2;
47+
TRUNCATE TABLE t3;
48+
DROP TABLE t1,t2,t3;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
--source include/innodb_page_size.inc
2+
# Embedded mode doesn't allow restarting
3+
--source include/not_embedded.inc
4+
5+
# MDEV-13059 XtraDB hangs on Windows due to failing to release
6+
# block->lock X-latch in innodb_read_only mode
7+
if (`SELECT count(*) FROM information_schema.plugins WHERE
8+
plugin_name = 'innodb' AND plugin_status = 'active' AND
9+
plugin_description LIKE '%xtradb%'`){
10+
if (`SELECT @@version_compile_os IN ('Win32','Win64','Windows')`) {
11+
skip MDEV-13059 XtraDB hangs on Windows in innodb_read_only mode;
12+
}
13+
}
14+
15+
create table t1 (a int not null, d varchar(15) not null, b
16+
varchar(198) not null, c char(156),
17+
fulltext ftsic(c)) engine=InnoDB
18+
row_format=redundant;
19+
20+
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
21+
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
22+
insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
23+
insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
24+
insert into t1 select * from t1;
25+
insert into t1 select * from t1;
26+
insert into t1 select * from t1;
27+
insert into t1 select * from t1;
28+
insert into t1 select * from t1;
29+
insert into t1 select * from t1;
30+
insert into t1 select * from t1;
31+
insert into t1 select * from t1;
32+
insert into t1 select * from t1;
33+
insert into t1 select * from t1;
34+
35+
SET GLOBAL innodb_file_per_table=OFF;
36+
create table t2 (a int not null, d varchar(15) not null, b
37+
varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
38+
row_format=redundant;
39+
40+
insert into t2 select * from t1;
41+
42+
create table t3 (a int not null, d varchar(15) not null, b varchar(198),
43+
c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
44+
row_format=redundant;
45+
46+
insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
47+
insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
48+
49+
# read-only restart requires the change buffer to be empty; therefore we
50+
# do a slow shutdown.
51+
SET GLOBAL innodb_fast_shutdown=0;
52+
--let $restart_parameters = --innodb-read-only
53+
--source include/restart_mysqld.inc
54+
55+
SELECT COUNT(*) FROM t1;
56+
SELECT COUNT(*) FROM t2;
57+
SELECT COUNT(*) FROM t3;
58+
59+
--error ER_OPEN_AS_READONLY
60+
TRUNCATE TABLE t1;
61+
--error ER_OPEN_AS_READONLY
62+
TRUNCATE TABLE t2;
63+
--error ER_OPEN_AS_READONLY
64+
TRUNCATE TABLE t3;
65+
66+
--let $restart_parameters =
67+
--source include/restart_mysqld.inc
68+
69+
TRUNCATE TABLE t1;
70+
TRUNCATE TABLE t2;
71+
TRUNCATE TABLE t3;
72+
73+
# TODO: Shutdown, corrupt the SYS_TABLES.TYPE of the tables, restart
74+
75+
DROP TABLE t1,t2,t3;

mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner;
1+
SET GLOBAL innodb_sched_priority_cleaner=39;
22
SELECT @@GLOBAL.innodb_sched_priority_cleaner;
33
@@GLOBAL.innodb_sched_priority_cleaner
44
19

mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44

55
# A dynamic, global variable
66

7-
SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner;
7+
# Test in read-only mode
8+
--let $restart_parameters= --innodb-read-only
9+
--source include/restart_mysqld.inc
10+
--let $restart_parameters=
11+
12+
# This has no actual effect in innodb_read_only mode
13+
SET GLOBAL innodb_sched_priority_cleaner=39;
14+
15+
--source include/restart_mysqld.inc
816

917
# Default value
1018
SELECT @@GLOBAL.innodb_sched_priority_cleaner;

storage/innobase/buf/buf0flu.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ is set to TRUE by the page_cleaner thread when it is spawned and is set
6262
back to FALSE at shutdown by the page_cleaner as well. Therefore no
6363
need to protect it by a mutex. It is only ever read by the thread
6464
doing the shutdown */
65-
UNIV_INTERN ibool buf_page_cleaner_is_active = FALSE;
65+
UNIV_INTERN bool buf_page_cleaner_is_active;
6666

6767
#ifdef UNIV_PFS_THREAD
6868
UNIV_INTERN mysql_pfs_key_t buf_page_cleaner_thread_key;
@@ -2326,7 +2326,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
23262326
fprintf(stderr, "InnoDB: page_cleaner thread running, id %lu\n",
23272327
os_thread_pf(os_thread_get_curr_id()));
23282328
#endif /* UNIV_DEBUG_THREAD_CREATION */
2329-
buf_page_cleaner_is_active = TRUE;
23302329

23312330
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
23322331

@@ -2422,7 +2421,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
24222421
/* We have lived our life. Time to die. */
24232422

24242423
thread_exit:
2425-
buf_page_cleaner_is_active = FALSE;
2424+
buf_page_cleaner_is_active = false;
24262425

24272426
my_thread_end();
24282427
/* We count the number of threads in os_thread_exit(). A created

storage/innobase/dict/dict0stats_bg.cc

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
4+
Copyright (c) 2017, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -39,12 +39,18 @@ Created Apr 25, 2012 Vasil Dimov
3939
/** Minimum time interval between stats recalc for a given table */
4040
#define MIN_RECALC_INTERVAL 10 /* seconds */
4141

42-
#define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
43-
4442
/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
4543
or shutdown. Not protected by any mutex. */
4644
UNIV_INTERN os_event_t dict_stats_event;
4745

46+
/** Variable to initiate shutdown the dict stats thread. Note we don't
47+
use 'srv_shutdown_state' because we want to shutdown dict stats thread
48+
before purge thread. */
49+
static bool dict_stats_start_shutdown;
50+
51+
/** Event to wait for shutdown of the dict stats thread */
52+
static os_event_t dict_stats_shutdown_event;
53+
4854
/** This mutex protects the "recalc_pool" variable. */
4955
static ib_mutex_t recalc_pool_mutex;
5056
static ib_mutex_t defrag_pool_mutex;
@@ -340,11 +346,11 @@ Must be called before dict_stats_thread() is started. */
340346
UNIV_INTERN
341347
void
342348
dict_stats_thread_init()
343-
/*====================*/
344349
{
345350
ut_a(!srv_read_only_mode);
346351

347352
dict_stats_event = os_event_create();
353+
dict_stats_shutdown_event = os_event_create();
348354

349355
/* The recalc_pool_mutex is acquired from:
350356
1) the background stats gathering thread before any other latch
@@ -389,6 +395,9 @@ dict_stats_thread_deinit()
389395

390396
os_event_free(dict_stats_event);
391397
dict_stats_event = NULL;
398+
os_event_free(dict_stats_shutdown_event);
399+
dict_stats_shutdown_event = NULL;
400+
dict_stats_start_shutdown = false;
392401
}
393402

394403
/*****************************************************************//**
@@ -532,7 +541,7 @@ DECLARE_THREAD(dict_stats_thread)(void*)
532541
my_thread_init();
533542
ut_a(!srv_read_only_mode);
534543

535-
while (!SHUTTING_DOWN()) {
544+
while (!dict_stats_start_shutdown) {
536545

537546
/* Wake up periodically even if not signaled. This is
538547
because we may lose an event - if the below call to
@@ -542,7 +551,7 @@ DECLARE_THREAD(dict_stats_thread)(void*)
542551
os_event_wait_time(
543552
dict_stats_event, MIN_RECALC_INTERVAL * 1000000);
544553

545-
if (SHUTTING_DOWN()) {
554+
if (dict_stats_start_shutdown) {
546555
break;
547556
}
548557

@@ -556,10 +565,20 @@ DECLARE_THREAD(dict_stats_thread)(void*)
556565

557566
srv_dict_stats_thread_active = false;
558567

568+
os_event_set(dict_stats_shutdown_event);
559569
my_thread_end();
560570
/* We count the number of threads in os_thread_exit(). A created
561571
thread should always use that to exit instead of return(). */
562572
os_thread_exit(NULL);
563573

564574
OS_THREAD_DUMMY_RETURN;
565575
}
576+
577+
/** Shut down the dict_stats_thread. */
578+
void
579+
dict_stats_shutdown()
580+
{
581+
dict_stats_start_shutdown = true;
582+
os_event_set(dict_stats_event);
583+
os_event_wait(dict_stats_shutdown_event);
584+
}

storage/innobase/fsp/fsp0fsp.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,7 +2731,6 @@ fsp_reserve_free_extents(
27312731
ibool success;
27322732
ulint n_pages_added;
27332733
size_t total_reserved = 0;
2734-
ulint rounds = 0;
27352734

27362735
ut_ad(mtr);
27372736
*n_reserved = n_ext;
@@ -2811,17 +2810,7 @@ fsp_reserve_free_extents(
28112810
space_header, mtr);
28122811

28132812
if (success && n_pages_added > 0) {
2814-
2815-
rounds++;
28162813
total_reserved += n_pages_added;
2817-
2818-
if (rounds > 50) {
2819-
ib_logf(IB_LOG_LEVEL_INFO,
2820-
"Space id %lu trying to reserve %lu extents actually reserved %lu "
2821-
" reserve %lu free %lu size %lu rounds %lu total_reserved %llu",
2822-
space, n_ext, n_pages_added, reserve, n_free, size, rounds, (ullint) total_reserved);
2823-
}
2824-
28252814
goto try_again;
28262815
}
28272816

0 commit comments

Comments
 (0)