1
/*****************************************************************************
3
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
4
Copyright (c) 2008, Google Inc.
5
Copyright (c) 2009, Percona Inc.
7
Portions of this file contain modifications contributed and copyrighted by
8
Google, Inc. Those modifications are gratefully acknowledged and are described
9
briefly in the InnoDB documentation. The contributions by Google are
10
incorporated with their permission, and subject to the conditions contained in
11
the file COPYING.Google.
13
Portions of this file contain modifications contributed and copyrighted
14
by Percona Inc.. Those modifications are
15
gratefully acknowledged and are described briefly in the InnoDB
16
documentation. The contributions by Percona Inc. are incorporated with
17
their permission, and subject to the conditions contained in the file
20
This program is free software; you can redistribute it and/or modify it under
21
the terms of the GNU General Public License as published by the Free Software
22
Foundation; version 2 of the License.
24
This program is distributed in the hope that it will be useful, but WITHOUT
25
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
28
You should have received a copy of the GNU General Public License along with
29
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
30
St, Fifth Floor, Boston, MA 02110-1301 USA
32
*****************************************************************************/
34
/********************************************************************//**
1
/************************************************************************
36
2
Starts the InnoDB database server
4
(c) 1996-2000 Innobase Oy
38
6
Created 2/16/1996 Heikki Tuuri
39
7
*************************************************************************/
10
#include "sync0sync.h"
41
11
#include "ut0mem.h"
42
12
#include "mem0mem.h"
43
14
#include "data0data.h"
44
15
#include "data0type.h"
45
16
#include "dict0dict.h"
46
17
#include "buf0buf.h"
47
20
#include "os0file.h"
48
21
#include "os0thread.h"
49
22
#include "fil0fil.h"
50
23
#include "fsp0fsp.h"
51
24
#include "rem0rec.h"
52
26
#include "mtr0mtr.h"
53
27
#include "log0log.h"
54
28
#include "log0recv.h"
55
29
#include "page0page.h"
56
30
#include "page0cur.h"
57
31
#include "trx0trx.h"
32
#include "dict0boot.h"
33
#include "dict0load.h"
58
34
#include "trx0sys.h"
35
#include "dict0crea.h"
59
36
#include "btr0btr.h"
60
38
#include "btr0cur.h"
61
40
#include "rem0rec.h"
44
#include "lock0lock.h"
46
#include "trx0purge.h"
51
#include "row0mysql.h"
52
#include "lock0lock.h"
62
53
#include "ibuf0ibuf.h"
54
#include "pars0pars.h"
63
56
#include "srv0start.h"
65
#ifndef UNIV_HOTBACKUP
67
# include "sync0sync.h"
70
# include "dict0boot.h"
71
# include "dict0load.h"
73
# include "usr0sess.h"
74
# include "lock0lock.h"
75
# include "trx0roll.h"
76
# include "trx0purge.h"
77
# include "lock0lock.h"
78
# include "pars0pars.h"
81
# include "dict0crea.h"
86
# include "row0mysql.h"
87
# include "btr0pcur.h"
89
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
90
# include "zlib.h" /* for ZLIB_VERSION */
95
/** Log sequence number immediately after startup */
59
/* Log sequence number immediately after startup */
96
60
UNIV_INTERN ib_uint64_t srv_start_lsn;
97
/** Log sequence number at shutdown */
61
/* Log sequence number at shutdown */
98
62
UNIV_INTERN ib_uint64_t srv_shutdown_lsn;
100
64
#ifdef HAVE_DARWIN_THREADS
101
65
# include <sys/utsname.h>
102
/** TRUE if the F_FULLFSYNC option is available */
103
66
UNIV_INTERN ibool srv_have_fullfsync = FALSE;
106
/** TRUE if a raw partition is in use */
107
69
UNIV_INTERN ibool srv_start_raw_disk_in_use = FALSE;
109
/** TRUE if the server is being started, before rolling back any
110
incomplete transactions */
111
71
UNIV_INTERN ibool srv_startup_is_before_trx_rollback_phase = FALSE;
112
/** TRUE if the server is being started */
113
72
UNIV_INTERN ibool srv_is_being_started = FALSE;
114
/** TRUE if the server was successfully started */
115
73
UNIV_INTERN ibool srv_was_started = FALSE;
116
/** TRUE if innobase_start_or_create_for_mysql() has been called */
74
#ifndef UNIV_HOTBACKUP
117
75
static ibool srv_start_has_been_called = FALSE;
119
/** At a shutdown this value climbs from SRV_SHUTDOWN_NONE to
120
SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on */
121
UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
123
/** Files comprising the system tablespace */
76
#endif /* !UNIV_HOTBACKUP */
78
/* At a shutdown the value first climbs to SRV_SHUTDOWN_CLEANUP
79
and then to SRV_SHUTDOWN_LAST_PHASE */
80
UNIV_INTERN ulint srv_shutdown_state = 0;
82
#ifndef UNIV_HOTBACKUP
124
83
static os_file_t files[1000];
126
/** Mutex protecting the ios count */
127
85
static mutex_t ios_mutex;
128
/** Count of I/O operations in io_handler_thread() */
131
/** io_handler_thread parameters for thread identification */
132
static ulint n[SRV_MAX_N_IO_THREADS + 6];
133
/** io_handler_thread identifiers */
134
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6];
88
static ulint n[SRV_MAX_N_IO_THREADS + 5];
89
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5];
136
/** We use this mutex to test the return value of pthread_mutex_trylock
91
/* We use this mutex to test the return value of pthread_mutex_trylock
137
92
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
138
93
static os_fast_mutex_t srv_os_test_mutex;
140
/** Name of srv_monitor_file */
95
/* Name of srv_monitor_file */
141
96
static char* srv_monitor_file_name;
142
97
#endif /* !UNIV_HOTBACKUP */
145
99
#define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD
146
100
#define SRV_MAX_N_PENDING_SYNC_IOS 100
148
#ifdef UNIV_PFS_THREAD
149
/* Keys to register InnoDB threads with performance schema */
150
UNIV_INTERN mysql_pfs_key_t io_handler_thread_key;
151
UNIV_INTERN mysql_pfs_key_t srv_lock_timeout_thread_key;
152
UNIV_INTERN mysql_pfs_key_t srv_error_monitor_thread_key;
153
UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key;
154
UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
155
#endif /* UNIV_PFS_THREAD */
157
#ifdef UNIV_PFS_MUTEX
158
/* Key to register ios_mutex_key with performance schema */
159
UNIV_INTERN mysql_pfs_key_t ios_mutex_key;
160
#endif /* UNIV_PFS_MUTEX */
162
/*********************************************************************//**
163
Convert a numeric string that optionally ends in G or M, to a number
164
containing megabytes.
165
@return next character in string */
168
105
srv_parse_megabytes(
169
106
/*================*/
170
char* str, /*!< in: string containing a quantity in bytes */
171
ulint* megs) /*!< out: the number in megabytes */
107
/* out: next character in string */
108
char* str, /* in: string containing a quantity in bytes */
109
ulint* megs) /* out: the number in megabytes */
196
/*********************************************************************//**
134
/*************************************************************************
197
135
Reads the data files and their sizes from a character string given in
199
@return TRUE if ok, FALSE on parse error */
202
139
srv_parse_data_file_paths_and_sizes(
203
140
/*================================*/
204
char* str) /*!< in/out: the data file path string */
141
/* out: TRUE if ok, FALSE if parsing
143
char* str, /* in: the data file path string */
144
char*** data_file_names, /* out, own: array of data file
146
ulint** data_file_sizes, /* out, own: array of data file sizes
148
ulint** data_file_is_raw_partition,/* out, own: array of flags
149
showing which data files are raw
151
ulint* n_data_files, /* out: number of data files */
152
ibool* is_auto_extending, /* out: TRUE if the last data file is
154
ulint* max_auto_extend_size) /* out: max auto extend size for the
155
last file if specified, 0 if not */
211
srv_auto_extend_last_data_file = FALSE;
212
srv_last_file_size_max = 0;
213
srv_data_file_names = NULL;
214
srv_data_file_sizes = NULL;
215
srv_data_file_is_raw_partition = NULL;
162
*is_auto_extending = FALSE;
163
*max_auto_extend_size = 0;
452
/*********************************************************************//**
453
Frees the memory allocated by srv_parse_data_file_paths_and_sizes()
454
and srv_parse_log_group_home_dirs(). */
457
srv_free_paths_and_sizes(void)
458
/*==========================*/
460
free(srv_data_file_names);
461
srv_data_file_names = NULL;
462
free(srv_data_file_sizes);
463
srv_data_file_sizes = NULL;
464
free(srv_data_file_is_raw_partition);
465
srv_data_file_is_raw_partition = NULL;
466
free(srv_log_group_home_dirs);
467
srv_log_group_home_dirs = NULL;
470
399
#ifndef UNIV_HOTBACKUP
471
/********************************************************************//**
472
I/o-handler thread function.
473
@return OS_THREAD_DUMMY_RETURN */
400
/************************************************************************
401
I/o-handler thread function. */
476
405
io_handler_thread(
477
406
/*==============*/
478
void* arg) /*!< in: pointer to the number of the segment in
483
412
segment = *((ulint*)arg);
461
/*************************************************************************
462
Adds a slash or a backslash to the end of a string if it is missing
463
and the string is not empty. */
466
srv_add_path_separator_if_needed(
467
/*=============================*/
468
/* out: string which has the separator if the
469
string is not empty */
470
char* str) /* in: null-terminated character string */
473
ulint len = ut_strlen(str);
475
if (len == 0 || str[len - 1] == SRV_PATH_SEPARATOR) {
480
out_str = ut_malloc(len + 2);
481
memcpy(out_str, str, len);
482
out_str[len] = SRV_PATH_SEPARATOR;
483
out_str[len + 1] = 0;
537
488
#ifndef UNIV_HOTBACKUP
538
/*********************************************************************//**
489
/*************************************************************************
539
490
Calculates the low 32 bits when a file size which is given as a number
540
database pages is converted to the number of bytes.
541
@return low 32 bytes of file size when expressed in bytes */
491
database pages is converted to the number of bytes. */
546
ulint file_size) /*!< in: file size in database pages */
496
/* out: low 32 bytes of file size when
497
expressed in bytes */
498
ulint file_size) /* in: file size in database pages */
548
500
return(0xFFFFFFFFUL & (file_size << UNIV_PAGE_SIZE_SHIFT));
551
/*********************************************************************//**
503
/*************************************************************************
552
504
Calculates the high 32 bits when a file size which is given as a number
553
database pages is converted to the number of bytes.
554
@return high 32 bytes of file size when expressed in bytes */
505
database pages is converted to the number of bytes. */
559
ulint file_size) /*!< in: file size in database pages */
510
/* out: high 32 bytes of file size when
511
expressed in bytes */
512
ulint file_size) /* in: file size in database pages */
561
514
return(file_size >> (32 - UNIV_PAGE_SIZE_SHIFT));
564
/*********************************************************************//**
565
Creates or opens the log files and closes them.
566
@return DB_SUCCESS or error code */
517
/*************************************************************************
518
Creates or opens the log files and closes them. */
569
521
open_or_create_log_file(
570
522
/*====================*/
571
ibool create_new_db, /*!< in: TRUE if we should create a
523
/* out: DB_SUCCESS or error code */
524
ibool create_new_db, /* in: TRUE if we should create a
573
ibool* log_file_created, /*!< out: TRUE if new log file
526
ibool* log_file_created, /* out: TRUE if new log file
575
ibool log_file_has_been_opened,/*!< in: TRUE if a log file has been
528
ibool log_file_has_been_opened,/* in: TRUE if a log file has been
576
529
opened before: then it is an error
577
530
to try to create another log file */
578
ulint k, /*!< in: log group number */
579
ulint i) /*!< in: log file number in group */
531
ulint k, /* in: log group number */
532
ulint i) /* in: log file number in group */
584
537
char name[10000];
587
539
UT_NOT_USED(create_new_db);
589
541
*log_file_created = FALSE;
591
543
srv_normalize_path_for_win(srv_log_group_home_dirs[k]);
593
dirnamelen = strlen(srv_log_group_home_dirs[k]);
594
ut_a(dirnamelen < (sizeof name) - 10 - sizeof "ib_logfile");
595
memcpy(name, srv_log_group_home_dirs[k], dirnamelen);
597
/* Add a path separator if needed. */
598
if (dirnamelen && name[dirnamelen - 1] != SRV_PATH_SEPARATOR) {
599
name[dirnamelen++] = SRV_PATH_SEPARATOR;
602
sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i);
604
files[i] = os_file_create(innodb_file_log_key, name,
605
OS_FILE_CREATE, OS_FILE_NORMAL,
544
srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed(
545
srv_log_group_home_dirs[k]);
547
ut_a(strlen(srv_log_group_home_dirs[k])
548
< (sizeof name) - 10 - sizeof "ib_logfile");
549
sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k],
550
"ib_logfile", (ulong) i);
552
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
606
553
OS_LOG_FILE, &ret);
607
554
if (ret == FALSE) {
608
555
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
721
667
return(DB_SUCCESS);
724
/*********************************************************************//**
725
Creates or opens database data files and closes them.
726
@return DB_SUCCESS or error code */
670
/*************************************************************************
671
Creates or opens database data files and closes them. */
729
674
open_or_create_data_files(
730
675
/*======================*/
731
ibool* create_new_db, /*!< out: TRUE if new database should be
676
/* out: DB_SUCCESS or error code */
677
ibool* create_new_db, /* out: TRUE if new database should be
733
679
#ifdef UNIV_LOG_ARCHIVE
734
ulint* min_arch_log_no,/*!< out: min of archived log
680
ulint* min_arch_log_no,/* out: min of archived log
735
681
numbers in data files */
736
ulint* max_arch_log_no,/*!< out: max of archived log
682
ulint* max_arch_log_no,/* out: max of archived log
737
683
numbers in data files */
738
684
#endif /* UNIV_LOG_ARCHIVE */
739
ib_uint64_t* min_flushed_lsn,/*!< out: min of flushed lsn
740
values in data files */
741
ib_uint64_t* max_flushed_lsn,/*!< out: max of flushed lsn
742
values in data files */
743
ulint* sum_of_new_sizes)/*!< out: sum of sizes of the
685
ib_uint64_t* min_flushed_lsn,/* out: min of flushed lsn
686
values in data files */
687
ib_uint64_t* max_flushed_lsn,/* out: max of flushed lsn
688
values in data files */
689
ulint* sum_of_new_sizes)/* out: sum of sizes of the
744
690
new files added */
764
710
*create_new_db = FALSE;
766
712
srv_normalize_path_for_win(srv_data_home);
713
srv_data_home = srv_add_path_separator_if_needed(srv_data_home);
768
715
for (i = 0; i < srv_n_data_files; i++) {
771
716
srv_normalize_path_for_win(srv_data_file_names[i]);
772
dirnamelen = strlen(srv_data_home);
774
ut_a(dirnamelen + strlen(srv_data_file_names[i])
718
ut_a(strlen(srv_data_home) + strlen(srv_data_file_names[i])
775
719
< (sizeof name) - 1);
776
memcpy(name, srv_data_home, dirnamelen);
777
/* Add a path separator if needed. */
778
if (dirnamelen && name[dirnamelen - 1] != SRV_PATH_SEPARATOR) {
779
name[dirnamelen++] = SRV_PATH_SEPARATOR;
782
strcpy(name + dirnamelen, srv_data_file_names[i]);
720
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]);
784
722
if (srv_data_file_is_raw_partition[i] == 0) {
786
724
/* First we try to create the file: if it already
787
725
exists, ret will get value FALSE */
789
files[i] = os_file_create(innodb_file_data_key,
790
name, OS_FILE_CREATE,
727
files[i] = os_file_create(name, OS_FILE_CREATE,
792
729
OS_DATA_FILE, &ret);
1147
1057
srv_is_being_started = TRUE;
1148
1058
srv_startup_is_before_trx_rollback_phase = TRUE;
1059
os_aio_use_native_aio = FALSE;
1151
switch (os_get_os_version()) {
1062
if (os_get_os_version() == OS_WIN95
1063
|| os_get_os_version() == OS_WIN31
1064
|| os_get_os_version() == OS_WINNT) {
1155
1066
/* On Win 95, 98, ME, Win32 subsystem for Windows 3.1,
1156
1067
and NT use simulated aio. In NT Windows provides async i/o,
1157
1068
but when run in conjunction with InnoDB Hot Backup, it seemed
1158
1069
to corrupt the data files. */
1160
srv_use_native_aio = FALSE;
1165
/* On 2000 and XP, async IO is available. */
1166
srv_use_native_aio = TRUE;
1170
/* Vista and later have both async IO and condition variables */
1171
srv_use_native_aio = TRUE;
1172
srv_use_native_conditions = TRUE;
1176
#elif defined(LINUX_NATIVE_AIO)
1178
if (srv_use_native_aio) {
1179
ut_print_timestamp(stderr);
1181
" InnoDB: Using Linux native AIO\n");
1184
/* Currently native AIO is supported only on windows and linux
1185
and that also when the support is compiled in. In all other
1186
cases, we ignore the setting of innodb_use_native_aio. */
1187
srv_use_native_aio = FALSE;
1071
os_aio_use_native_aio = FALSE;
1073
/* On Win 2000 and XP use async i/o */
1074
os_aio_use_native_aio = TRUE;
1191
1077
if (srv_file_flush_method_str == NULL) {
1192
1078
/* These are the default options */
1288
mutex_create(srv_dict_tmpfile_mutex_key,
1289
&srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
1178
mutex_create(&srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
1291
1180
srv_dict_tmpfile = os_file_create_tmpfile();
1292
1181
if (!srv_dict_tmpfile) {
1293
1182
return(DB_ERROR);
1296
mutex_create(srv_misc_tmpfile_mutex_key,
1297
&srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
1185
mutex_create(&srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
1299
1187
srv_misc_tmpfile = os_file_create_tmpfile();
1300
1188
if (!srv_misc_tmpfile) {
1301
1189
return(DB_ERROR);
1304
/* innodb_file_io_threads used to be user settable.
1305
It is now just a combination of read_io_threads and
1306
write_io_threads that is set by innodb internally. */
1308
/* Now overwrite the value on srv_n_file_io_threads */
1309
srv_n_file_io_threads = 2 + srv_n_read_io_threads
1310
+ srv_n_write_io_threads;
1312
ut_a(srv_n_file_io_threads <= SRV_MAX_N_IO_THREADS);
1314
/* TODO: Investigate if SRV_N_PENDING_IOS_PER_THREAD (32) limit
1315
still applies to windows. */
1316
if (!srv_use_native_aio) {
1317
io_limit = 8 * SRV_N_PENDING_IOS_PER_THREAD;
1319
io_limit = SRV_N_PENDING_IOS_PER_THREAD;
1322
os_aio_init(io_limit,
1323
srv_n_read_io_threads,
1324
srv_n_write_io_threads,
1325
SRV_MAX_N_PENDING_SYNC_IOS);
1327
fil_init(srv_file_per_table ? 50000 : 5000,
1328
srv_max_n_open_files);
1330
/* Print time to initialize the buffer pool */
1331
ut_print_timestamp(stderr);
1333
" InnoDB: Initializing buffer pool, size =");
1335
if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
1338
((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1342
((double) srv_buf_pool_size) / (1024 * 1024));
1345
err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1347
ut_print_timestamp(stderr);
1349
" InnoDB: Completed initialization of buffer pool\n");
1351
if (err != DB_SUCCESS) {
1192
/* Restrict the maximum number of file i/o threads */
1193
if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) {
1195
srv_n_file_io_threads = SRV_MAX_N_IO_THREADS;
1198
if (!os_aio_use_native_aio) {
1199
/* In simulated aio we currently have use only for 4 threads */
1200
srv_n_file_io_threads = 4;
1202
os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
1203
* srv_n_file_io_threads,
1204
srv_n_file_io_threads,
1205
SRV_MAX_N_PENDING_SYNC_IOS);
1207
os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
1208
* srv_n_file_io_threads,
1209
srv_n_file_io_threads,
1210
SRV_MAX_N_PENDING_SYNC_IOS);
1213
fil_init(srv_max_n_open_files);
1215
ret = buf_pool_init();
1352
1218
fprintf(stderr,
1353
1219
"InnoDB: Fatal error: cannot allocate the memory"
1354
1220
" for the buffer pool\n");
1715
1576
/* fprintf(stderr, "Max allowed record size %lu\n",
1716
1577
page_get_free_space_of_empty() / 2); */
1718
if (trx_doublewrite == NULL) {
1719
/* Create the doublewrite buffer to a new tablespace */
1721
trx_sys_create_doublewrite_buf();
1724
/* Here the double write buffer has already been created and so
1725
any new rollback segments will be allocated after the double
1726
write buffer. The default segment should already exist.
1727
We create the new segments only if it's a new database or
1728
the database was shutdown cleanly. */
1730
/* Note: When creating the extra rollback segments during an upgrade
1731
we violate the latching order, even if the change buffer is empty.
1732
We make an exception in sync0sync.c and check srv_is_being_started
1733
for that violation. It cannot create a deadlock because we are still
1734
running in single threaded mode essentially. Only the IO threads
1735
should be running at this stage. */
1737
trx_sys_create_rsegs(TRX_SYS_N_RSEGS - 1);
1739
/* Create the thread which watches the timeouts for lock waits */
1740
os_thread_create(&srv_lock_timeout_thread, NULL,
1579
/* Create the thread which watches the timeouts for lock waits
1580
and prints InnoDB monitor info */
1582
os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL,
1741
1583
thread_ids + 2 + SRV_MAX_N_IO_THREADS);
1743
1585
/* Create the thread which warns of long semaphore waits */
1744
1586
os_thread_create(&srv_error_monitor_thread, NULL,
1745
1587
thread_ids + 3 + SRV_MAX_N_IO_THREADS);
1747
/* Create the thread which prints InnoDB monitor info */
1748
os_thread_create(&srv_monitor_thread, NULL,
1749
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
1751
1588
srv_is_being_started = FALSE;
1590
if (trx_doublewrite == NULL) {
1591
/* Create the doublewrite buffer to a new tablespace */
1593
trx_sys_create_doublewrite_buf();
1753
1596
err = dict_create_or_check_foreign_constraint_tables();
1755
1598
if (err != DB_SUCCESS) {
2073
1908
srv_misc_tmpfile = 0;
2076
/* This must be disabled before closing the buffer pool
2077
and closing the data dictionary. */
2078
btr_search_disable();
2084
1911
trx_sys_file_format_close();
2087
1913
mutex_free(&srv_monitor_file_mutex);
2088
1914
mutex_free(&srv_dict_tmpfile_mutex);
2089
1915
mutex_free(&srv_misc_tmpfile_mutex);
2091
btr_search_sys_free();
2093
1917
/* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
1921
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
2100
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
2102
1924
os_sync_free();
2104
/* 5. Free all allocated memory */
2108
buf_pool_free(srv_buf_pool_instances);
2111
/* ut_free_all_mem() frees all allocated memory not freed yet
2112
in shutdown, and it will also free the ut_list_mutex, so it
2113
should be the last one for all operation */
1926
/* Check that all read views are closed except read view owned
1929
if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
1931
"InnoDB: Error: all read views were not closed"
1932
" before shutdown:\n"
1933
"InnoDB: %lu read views open \n",
1934
UT_LIST_GET_LEN(trx_sys->view_list) - 1);
1937
/* 5. Free all allocated memory and the os_fast_mutex created in
2114
1941
ut_free_all_mem();
2116
1943
if (os_thread_count != 0