1 /*****************************************************************************
2 
3 Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
4 Copyright (c) 2008, 2009, Google Inc.
5 Copyright (c) 2009, Percona Inc.
6 
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.
12 
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
18 COPYING.Percona.
19 
20 This program is free software; you can redistribute it and/or modify
21 it under the terms of the GNU General Public License, version 2.0,
22 as published by the Free Software Foundation.
23 
24 This program is also distributed with certain software (including
25 but not limited to OpenSSL) that is licensed under separate terms,
26 as designated in a particular file or component or in included license
27 documentation.  The authors of MySQL hereby grant you an additional
28 permission to link the program and your derivative works with the
29 separately licensed software that they have included with MySQL.
30 
31 This program is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34 GNU General Public License, version 2.0, for more details.
35 
36 You should have received a copy of the GNU General Public License along with
37 this program; if not, write to the Free Software Foundation, Inc.,
38 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
39 
40 *****************************************************************************/
41 
42 /**************************************************//**
43 @file include/srv0srv.h
44 The server main program
45 
46 Created 10/10/1995 Heikki Tuuri
47 *******************************************************/
48 
49 #ifndef srv0srv_h
50 #define srv0srv_h
51 
52 #include "univ.i"
53 #ifndef UNIV_HOTBACKUP
54 #include "log0log.h"
55 #include "sync0sync.h"
56 #include "os0sync.h"
57 #include "que0types.h"
58 #include "trx0types.h"
59 #include "srv0conc.h"
60 #include "buf0checksum.h"
61 #include "ut0counter.h"
62 
63 #include <sql_class.h>
64 
65 /* Global counters used inside InnoDB. */
66 struct srv_stats_t {
67 	typedef ib_counter_t<lsn_t, 1, single_indexer_t> lsn_ctr_1_t;
68 	typedef ib_counter_t<ulint, 1, single_indexer_t> ulint_ctr_1_t;
69 	typedef ib_counter_t<lint, 1, single_indexer_t> lint_ctr_1_t;
70 	typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
71 	typedef ib_counter_t<ib_int64_t, 1, single_indexer_t> ib_int64_ctr_1_t;
72 
73 	/** Count the amount of data written in total (in bytes) */
74 	ulint_ctr_1_t		data_written;
75 
76 	/** Number of the log write requests done */
77 	ulint_ctr_1_t		log_write_requests;
78 
79 	/** Number of physical writes to the log performed */
80 	ulint_ctr_1_t		log_writes;
81 
82 	/** Amount of data written to the log files in bytes */
83 	lsn_ctr_1_t		os_log_written;
84 
85 	/** Number of writes being done to the log files */
86 	lint_ctr_1_t		os_log_pending_writes;
87 
88 	/** We increase this counter, when we don't have enough
89 	space in the log buffer and have to flush it */
90 	ulint_ctr_1_t		log_waits;
91 
92 	/** Count the number of times the doublewrite buffer was flushed */
93 	ulint_ctr_1_t		dblwr_writes;
94 
95 	/** Store the number of pages that have been flushed to the
96 	doublewrite buffer */
97 	ulint_ctr_1_t		dblwr_pages_written;
98 
99 	/** Store the number of write requests issued */
100 	ulint_ctr_1_t		buf_pool_write_requests;
101 
102 	/** Store the number of times when we had to wait for a free page
103 	in the buffer pool. It happens when the buffer pool is full and we
104 	need to make a flush, in order to be able to read or create a page. */
105 	ulint_ctr_1_t		buf_pool_wait_free;
106 
107 	/** Count the number of pages that were written from buffer
108 	pool to the disk */
109 	ulint_ctr_1_t		buf_pool_flushed;
110 
111 	/** Number of buffer pool reads that led to the reading of
112 	a disk page */
113 	ulint_ctr_1_t		buf_pool_reads;
114 
115 	/** Number of data read in total (in bytes) */
116 	ulint_ctr_1_t		data_read;
117 
118 	/** Wait time of database locks */
119 	ib_int64_ctr_1_t	n_lock_wait_time;
120 
121 	/** Number of database lock waits */
122 	ulint_ctr_1_t		n_lock_wait_count;
123 
124 	/** Number of threads currently waiting on database locks */
125 	lint_ctr_1_t		n_lock_wait_current_count;
126 
127 	/** Number of rows read. */
128 	ulint_ctr_64_t		n_rows_read;
129 
130 	/** Number of rows updated */
131 	ulint_ctr_64_t		n_rows_updated;
132 
133 	/** Number of rows deleted */
134 	ulint_ctr_64_t		n_rows_deleted;
135 
136 	/** Number of rows inserted */
137 	ulint_ctr_64_t		n_rows_inserted;
138 
139 	ulint_ctr_1_t		lock_deadlock_count;
140 
141 	ulint_ctr_1_t		n_lock_max_wait_time;
142 
143 	/** Number of buffered aio requests submitted */
144 	ulint_ctr_64_t		n_aio_submitted;
145 };
146 
147 extern const char*	srv_main_thread_op_info;
148 
149 /** Prefix used by MySQL to indicate pre-5.1 table name encoding */
150 extern const char	srv_mysql50_table_name_prefix[10];
151 
152 /* The monitor thread waits on this event. */
153 extern os_event_t	srv_monitor_event;
154 
155 /* The error monitor thread waits on this event. */
156 extern os_event_t	srv_error_event;
157 
158 /** The buffer pool dump/load thread waits on this event. */
159 extern os_event_t	srv_buf_dump_event;
160 
161 /** The buffer pool dump/load file name */
162 #define SRV_BUF_DUMP_FILENAME_DEFAULT	"ib_buffer_pool"
163 extern char*		srv_buf_dump_filename;
164 
165 /** Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown
166 and/or load it during startup. */
167 extern char		srv_buffer_pool_dump_at_shutdown;
168 extern char		srv_buffer_pool_load_at_startup;
169 
170 /* Whether to disable file system cache if it is defined */
171 extern char		srv_disable_sort_file_cache;
172 
173 /* This event is set on checkpoint completion to wake the redo log parser
174 thread */
175 extern os_event_t	srv_checkpoint_completed_event;
176 
177 /* This event is set on the online redo log following thread after a successful
178 log tracking iteration */
179 extern os_event_t	srv_redo_log_tracked_event;
180 
181 /** Whether the redo log tracker thread has been started. Does not take into
182 account whether the tracking is currently enabled (see srv_track_changed_pages
183 for that) */
184 extern bool		srv_redo_log_thread_started;
185 
186 /* If the last data file is auto-extended, we add this many pages to it
187 at a time */
188 #define SRV_AUTO_EXTEND_INCREMENT	\
189 	(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
190 
191 /* Mutex for locking srv_monitor_file. Not created if srv_read_only_mode */
192 extern ib_mutex_t	srv_monitor_file_mutex;
193 
194 /* prototypes for new functions added to ha_innodb.cc */
195 ibool	innobase_get_slow_log();
196 
197 /* Temporary file for innodb monitor output */
198 extern FILE*	srv_monitor_file;
199 /* Mutex for locking srv_dict_tmpfile. Only created if !srv_read_only_mode.
200 This mutex has a very high rank; threads reserving it should not
201 be holding any InnoDB latches. */
202 extern ib_mutex_t	srv_dict_tmpfile_mutex;
203 /* Temporary file for output from the data dictionary */
204 extern FILE*	srv_dict_tmpfile;
205 /* Mutex for locking srv_misc_tmpfile. Only created if !srv_read_only_mode.
206 This mutex has a very low rank; threads reserving it should not
207 acquire any further latches or sleep before releasing this one. */
208 extern ib_mutex_t	srv_misc_tmpfile_mutex;
209 /* Temporary file for miscellanous diagnostic output */
210 extern FILE*	srv_misc_tmpfile;
211 
212 /* Server parameters which are read from the initfile */
213 
214 extern char*	srv_data_home;
215 
216 #ifdef UNIV_LOG_ARCHIVE
217 extern char*	srv_arch_dir;
218 #endif /* UNIV_LOG_ARCHIVE */
219 
220 /** Set if InnoDB must operate in read-only mode. We don't do any
221 recovery and open all tables in RO mode instead of RW mode. We don't
222 sync the max trx id to disk either. */
223 extern my_bool	srv_read_only_mode;
224 /** Set if InnoDB operates in read-only mode or innodb-force-recovery
225 is greater than SRV_FORCE_NO_TRX_UNDO. */
226 extern my_bool	high_level_read_only;
227 /** store to its own file each table created by an user; data
228 dictionary tables are in the system tablespace 0 */
229 extern my_bool	srv_file_per_table;
230 /** Sleep delay for threads waiting to enter InnoDB. In micro-seconds. */
231 extern	ulong	srv_thread_sleep_delay;
232 #if defined(HAVE_ATOMIC_BUILTINS)
233 /** Maximum sleep delay (in micro-seconds), value of 0 disables it.*/
234 extern	ulong	srv_adaptive_max_sleep_delay;
235 #endif /* HAVE_ATOMIC_BUILTINS */
236 
237 /** The file format to use on new *.ibd files. */
238 extern ulint	srv_file_format;
239 /** Whether to check file format during startup.  A value of
240 UNIV_FORMAT_MAX + 1 means no checking ie. FALSE.  The default is to
241 set it to the highest format we support. */
242 extern ulint	srv_max_file_format_at_startup;
243 /** Place locks to records only i.e. do not use next-key locking except
244 on duplicate key checking and foreign key checking */
245 extern ibool	srv_locks_unsafe_for_binlog;
246 
247 /** Sort buffer size in index creation */
248 extern ulong	srv_sort_buf_size;
249 /** Maximum modification log file size for online index creation */
250 extern unsigned long long	srv_online_max_size;
251 
252 /* If this flag is TRUE, then we will use the native aio of the
253 OS (provided we compiled Innobase with it in), otherwise we will
254 use simulated aio we build below with threads.
255 Currently we support native aio on windows and linux */
256 extern my_bool	srv_use_native_aio;
257 extern my_bool	srv_numa_interleave;
258 #ifdef __WIN__
259 extern ibool	srv_use_native_conditions;
260 #endif /* __WIN__ */
261 #endif /* !UNIV_HOTBACKUP */
262 
263 /** Server undo tablespaces directory, can be absolute path. */
264 extern char*	srv_undo_dir;
265 
266 /** Number of undo tablespaces to use. */
267 extern ulong	srv_undo_tablespaces;
268 
269 /** The number of UNDO tablespaces that are open and ready to use. */
270 extern ulint	srv_undo_tablespaces_open;
271 
272 /* The number of undo segments to use */
273 extern ulong	srv_undo_logs;
274 
275 extern ulint	srv_n_data_files;
276 extern char**	srv_data_file_names;
277 extern ulint*	srv_data_file_sizes;
278 extern ulint*	srv_data_file_is_raw_partition;
279 
280 
281 /** Whether the redo log tracking is currently enabled. Note that it is
282 possible for the log tracker thread to be running and the tracking to be
283 disabled */
284 extern my_bool		srv_track_changed_pages;
285 extern ulonglong	srv_max_bitmap_file_size;
286 
287 extern
288 ulonglong       srv_max_changed_pages;
289 
290 extern ibool	srv_auto_extend_last_data_file;
291 extern ulint	srv_last_file_size_max;
292 extern char*	srv_log_group_home_dir;
293 #ifndef UNIV_HOTBACKUP
294 extern ulong	srv_auto_extend_increment;
295 
296 extern ibool	srv_created_new_raw;
297 
298 /** Maximum number of srv_n_log_files, or innodb_log_files_in_group */
299 #define SRV_N_LOG_FILES_MAX 100
300 extern ulong	srv_n_log_files;
301 extern ib_uint64_t	srv_log_file_size;
302 extern ib_uint64_t	srv_log_file_size_requested;
303 extern ulint	srv_log_buffer_size;
304 extern uint	srv_flush_log_at_timeout;
305 extern char	srv_use_global_flush_log_at_trx_commit;
306 extern char	srv_adaptive_flushing;
307 
308 /* If this flag is TRUE, then we will load the indexes' (and tables') metadata
309 even if they are marked as "corrupted". Mostly it is for DBA to process
310 corrupted index and table */
311 extern my_bool	srv_load_corrupted;
312 
313 extern ulint    srv_show_locks_held;
314 extern ulint    srv_show_verbose_locks;
315 
316 /* The sort order table of the MySQL latin1_swedish_ci character set
317 collation */
318 extern const byte*	srv_latin1_ordering;
319 #ifndef UNIV_HOTBACKUP
320 extern my_bool	srv_use_sys_malloc;
321 #else
322 extern ibool	srv_use_sys_malloc;
323 #endif /* UNIV_HOTBACKUP */
324 extern ulint	srv_buf_pool_size;	/*!< requested size in bytes */
325 extern ulint    srv_buf_pool_instances; /*!< requested number of buffer pool instances */
326 extern ulong	srv_n_page_hash_locks;	/*!< number of locks to
327 					protect buf_pool->page_hash */
328 extern ulong	srv_LRU_scan_depth;	/*!< Scan depth for LRU
329 					flush batch */
330 extern ulong	srv_flush_neighbors;	/*!< whether or not to flush
331 					neighbors of a block */
332 extern ulint	srv_buf_pool_old_size;	/*!< previously requested size */
333 extern ulint	srv_buf_pool_curr_size;	/*!< current size in bytes */
334 extern ulint	srv_mem_pool_size;
335 extern ulint	srv_lock_table_size;
336 
337 extern ulint	srv_foreground_preflush;/*!< Query thread preflush algorithm */
338 
339 extern ulint	srv_cleaner_max_lru_time;/*!< the maximum time limit for a
340 					single LRU tail flush iteration by the
341 					page cleaner thread */
342 
343 extern ulint	srv_cleaner_max_flush_time;/*!< the maximum time limit for a
344 					single flush list flush iteration by
345 					the page cleaner thread */
346 
347 extern ulint	srv_cleaner_flush_chunk_size;
348 					/*!< page cleaner flush list flush
349 					batches are further divided into this
350 					chunk size  */
351 
352 extern ulint	srv_cleaner_lru_chunk_size;
353 					/*!< page cleaner LRU list flush
354 					batches are further divided into this
355 					chunk size  */
356 
357 extern ulint	srv_cleaner_free_list_lwm;/*!< if free list length is lower
358 					than this percentage of
359 					srv_LRU_scan_depth, page cleaner LRU
360 					flushes will issue flush batches to the
361 					same instance in a row  */
362 
363 extern my_bool	srv_cleaner_eviction_factor;
364 					/*!< if TRUE, page cleaner heuristics
365 					use evicted instead of flushed page
366 					counts for its heuristics  */
367 
368 extern ulong	srv_cleaner_lsn_age_factor;
369 					/*!< page cleaner LSN age factor
370 					formula option */
371 
372 extern ulong	srv_empty_free_list_algorithm;
373 					/*!< Empty free list for a query thread
374 					handling algorithm option */
375 
376 extern ulint	srv_n_file_io_threads;
377 extern my_bool	srv_random_read_ahead;
378 extern ulong	srv_read_ahead_threshold;
379 extern ulint	srv_n_read_io_threads;
380 extern ulint	srv_n_write_io_threads;
381 
382 /* Number of IO operations per second the server can do */
383 extern ulong    srv_io_capacity;
384 
385 /* We use this dummy default value at startup for max_io_capacity.
386 The real value is set based on the value of io_capacity. */
387 #define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT	(~0UL)
388 #define SRV_MAX_IO_CAPACITY_LIMIT		(~0UL)
389 extern ulong    srv_max_io_capacity;
390 /* Returns the number of IO operations that is X percent of the
391 capacity. PCT_IO(5) -> returns the number of IO operations that
392 is 5% of the max where max is srv_io_capacity.  */
393 #define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) (p) / 100.0)))
394 
395 /* The "innodb_stats_method" setting, decides how InnoDB is going
396 to treat NULL value when collecting statistics. It is not defined
397 as enum type because the configure option takes unsigned integer type. */
398 extern ulong	srv_innodb_stats_method;
399 
400 #ifdef UNIV_LOG_ARCHIVE
401 extern ibool		srv_log_archive_on;
402 #endif /* UNIV_LOG_ARCHIVE */
403 
404 extern char*	srv_file_flush_method_str;
405 extern ulint	srv_unix_file_flush_method;
406 extern ulint	srv_win_file_flush_method;
407 
408 extern ulint	srv_max_n_open_files;
409 
410 extern ulong	srv_max_dirty_pages_pct;
411 extern ulong	srv_max_dirty_pages_pct_lwm;
412 
413 extern ulong	srv_adaptive_flushing_lwm;
414 extern ulong	srv_flushing_avg_loops;
415 
416 extern ulong	srv_force_recovery;
417 #ifndef DBUG_OFF
418 extern ulong	srv_force_recovery_crash;
419 #endif /* !DBUG_OFF */
420 
421 extern ulint	srv_fast_shutdown;	/*!< If this is 1, do not do a
422 					purge and index buffer merge.
423 					If this 2, do not even flush the
424 					buffer pool to data files at the
425 					shutdown: we effectively 'crash'
426 					InnoDB (but lose no committed
427 					transactions). */
428 extern ibool	srv_innodb_status;
429 
430 extern unsigned long long	srv_stats_transient_sample_pages;
431 extern my_bool			srv_stats_persistent;
432 extern unsigned long long	srv_stats_persistent_sample_pages;
433 extern my_bool			srv_stats_auto_recalc;
434 extern my_bool			srv_stats_include_delete_marked;
435 
436 extern ibool	srv_use_doublewrite_buf;
437 extern ulong	srv_doublewrite_batch_size;
438 extern ibool	srv_use_atomic_writes;
439 #ifdef HAVE_POSIX_FALLOCATE
440 extern ibool	srv_use_posix_fallocate;
441 #endif
442 
443 extern ulong	srv_log_arch_expire_sec;
444 
445 extern ulong	srv_max_buf_pool_modified_pct;
446 extern ulong	srv_max_purge_lag;
447 extern ulong	srv_max_purge_lag_delay;
448 
449 extern ulong	srv_replication_delay;
450 
451 extern ulint	srv_pass_corrupt_table;
452 
453 extern ulint	srv_log_checksum_algorithm;
454 
455 /* Helper macro to support srv_pass_corrupt_table checks. If 'cond' is FALSE,
456 execute 'code' if srv_pass_corrupt_table is non-zero, or trigger a fatal error
457 otherwise. The break statement in 'code' will obviously not work as
458 expected. */
459 
460 #define SRV_CORRUPT_TABLE_CHECK(cond,code)		\
461 	do {						\
462 		if (UNIV_UNLIKELY(!(cond))) {		\
463 			if (srv_pass_corrupt_table) {	\
464 				code			\
465 			} else {			\
466 				ut_error;		\
467 			}				\
468 		}					\
469 	} while(0)
470 
471 /*-------------------------------------------*/
472 
473 extern ulint	srv_read_views_memory;
474 extern ulint	srv_descriptors_memory;
475 
476 extern my_bool	srv_print_innodb_monitor;
477 extern my_bool	srv_print_innodb_lock_monitor;
478 extern ibool	srv_print_innodb_tablespace_monitor;
479 extern ibool	srv_print_verbose_log;
480 #define DEPRECATED_MSG_INNODB_TABLE_MONITOR \
481 	"Using innodb_table_monitor is deprecated and it may be removed " \
482 	"in future releases. Please use the InnoDB INFORMATION_SCHEMA " \
483 	"tables instead, see " REFMAN "innodb-i_s-tables.html"
484 extern ibool	srv_print_innodb_table_monitor;
485 
486 extern ibool	srv_monitor_active;
487 extern ibool	srv_error_monitor_active;
488 
489 /* TRUE during the lifetime of the buffer pool dump/load thread */
490 extern ibool	srv_buf_dump_thread_active;
491 
492 /* TRUE during the lifetime of the stats thread */
493 extern ibool	srv_dict_stats_thread_active;
494 
495 extern ulong	srv_n_spin_wait_rounds;
496 extern ulong	srv_n_free_tickets_to_enter;
497 extern ulong	srv_thread_sleep_delay;
498 extern ulong	srv_spin_wait_delay;
499 extern ibool	srv_priority_boost;
500 
501 extern ulint	srv_truncated_status_writes;
502 extern ulint	srv_available_undo_logs;
503 
504 extern ulint	srv_column_compressed;
505 extern ulint	srv_column_decompressed;
506 
507 extern	ulint	srv_mem_pool_size;
508 extern	ulint	srv_lock_table_size;
509 
510 #ifdef UNIV_DEBUG
511 extern	ibool	srv_print_thread_releases;
512 extern	ibool	srv_print_lock_waits;
513 extern	ibool	srv_print_buf_io;
514 extern	ibool	srv_print_log_io;
515 extern	ibool	srv_print_latch_waits;
516 #else /* UNIV_DEBUG */
517 # define srv_print_thread_releases	FALSE
518 # define srv_print_lock_waits		FALSE
519 # define srv_print_buf_io		FALSE
520 # define srv_print_log_io		FALSE
521 # define srv_print_latch_waits		FALSE
522 #endif /* UNIV_DEBUG */
523 
524 #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
525 extern my_bool	srv_ibuf_disable_background_merge;
526 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
527 
528 #ifdef UNIV_DEBUG
529 extern my_bool	srv_purge_view_update_only_debug;
530 #endif /* UNIV_DEBUG */
531 
532 extern ulint	srv_fatal_semaphore_wait_threshold;
533 #define SRV_SEMAPHORE_WAIT_EXTENSION	7200
534 extern ulint	srv_dml_needed_delay;
535 extern lint	srv_kill_idle_transaction;
536 
537 #ifndef HAVE_ATOMIC_BUILTINS
538 /** Mutex protecting some server global variables. */
539 extern ib_mutex_t	server_mutex;
540 #endif /* !HAVE_ATOMIC_BUILTINS */
541 
542 #define SRV_MAX_N_IO_THREADS	130
543 
544 #define SRV_MAX_N_PURGE_THREADS 32
545 
546 /* Array of English strings describing the current state of an
547 i/o handler thread */
548 extern const char* srv_io_thread_op_info[];
549 extern const char* srv_io_thread_function[];
550 
551 /* The tid of the cleaner thread */
552 extern os_tid_t	srv_cleaner_tid;
553 
554 /* The tid of the LRU manager thread */
555 extern os_tid_t srv_lru_manager_tid;
556 
557 /* The tids of the purge threads */
558 extern os_tid_t srv_purge_tids[];
559 
560 /* The tids of the I/O threads */
561 extern os_tid_t	srv_io_tids[];
562 
563 /* The tid of the master thread */
564 extern os_tid_t	srv_master_tid;
565 
566 /* The relative scheduling priority of the cleaner and LRU manager threads */
567 extern ulint	srv_sched_priority_cleaner;
568 
569 /* The relative scheduling priority of the purge threads */
570 extern ulint	srv_sched_priority_purge;
571 
572 /* The relative scheduling priority of the I/O threads */
573 extern ulint	srv_sched_priority_io;
574 
575 /* The relative scheduling priority of the master thread */
576 extern ulint	srv_sched_priority_master;
577 
578 /* The relative priority of the purge coordinator and worker threads.  */
579 extern my_bool srv_purge_thread_priority;
580 
581 /* The relative priority of the I/O threads.  */
582 extern my_bool srv_io_thread_priority;
583 
584 /* The relative priority of the cleaner thread.  */
585 extern my_bool srv_cleaner_thread_priority;
586 
587 /* The relative priority of the master thread.  */
588 extern my_bool srv_master_thread_priority;
589 
590 /* the number of purge threads to use from the worker pool (currently 0 or 1) */
591 extern ulong srv_n_purge_threads;
592 
593 /* the number of pages to purge in one batch */
594 extern ulong srv_purge_batch_size;
595 
596 /* the number of sync wait arrays */
597 extern ulong srv_sync_array_size;
598 
599 /* print all user-level transactions deadlocks to mysqld stderr */
600 extern my_bool srv_print_all_deadlocks;
601 
602 /* print lock wait timeout info to mysqld stderr */
603 extern my_bool srv_print_lock_wait_timeout_info;
604 
605 extern my_bool	srv_cmp_per_index_enabled;
606 
607 /** Number of times secondary index lookup triggered cluster lookup */
608 extern ulint	srv_sec_rec_cluster_reads;
609 /** Number of times prefix optimization avoided triggering cluster lookup */
610 extern ulint	srv_sec_rec_cluster_reads_avoided;
611 
612 /** Status variables to be passed to MySQL */
613 extern struct export_var_t export_vars;
614 
615 /** Global counters */
616 extern srv_stats_t	srv_stats;
617 
618 /** When TRUE, fake change transcations take S rather than X row locks.
619 When FALSE, row locks are not taken at all. */
620 extern my_bool srv_fake_changes_locks;
621 
622 
623 # ifdef UNIV_PFS_THREAD
624 /* Keys to register InnoDB threads with performance schema */
625 extern mysql_pfs_key_t	buf_page_cleaner_thread_key;
626 extern mysql_pfs_key_t	buf_lru_manager_thread_key;
627 extern mysql_pfs_key_t	trx_rollback_clean_thread_key;
628 extern mysql_pfs_key_t	io_handler_thread_key;
629 extern mysql_pfs_key_t	srv_lock_timeout_thread_key;
630 extern mysql_pfs_key_t	srv_error_monitor_thread_key;
631 extern mysql_pfs_key_t	srv_monitor_thread_key;
632 extern mysql_pfs_key_t	srv_master_thread_key;
633 extern mysql_pfs_key_t	srv_purge_thread_key;
634 extern mysql_pfs_key_t	recv_writer_thread_key;
635 extern mysql_pfs_key_t	srv_log_tracking_thread_key;
636 
637 /* This macro register the current thread and its key with performance
638 schema */
639 #  define pfs_register_thread(key)			\
640 do {								\
641 	struct PSI_thread* psi = PSI_THREAD_CALL(new_thread)(key, NULL, 0);\
642 	PSI_THREAD_CALL(set_thread)(psi);			\
643 } while (0)
644 
645 /* This macro delist the current thread from performance schema */
646 #  define pfs_delete_thread()				\
647 do {								\
648 	PSI_THREAD_CALL(delete_current_thread)();		\
649 } while (0)
650 # endif /* UNIV_PFS_THREAD */
651 
652 #endif /* !UNIV_HOTBACKUP */
653 
654 /** Types of raw partitions in innodb_data_file_path */
655 enum {
656 	SRV_NOT_RAW = 0,	/*!< Not a raw partition */
657 	SRV_NEW_RAW,		/*!< A 'newraw' partition, only to be
658 				initialized */
659 	SRV_OLD_RAW		/*!< An initialized raw partition */
660 };
661 
662 /** Alternatives for the file flush option in Unix; see the InnoDB manual
663 about what these mean */
664 enum {
665 	SRV_UNIX_FSYNC = 1,	/*!< fsync, the default */
666 	SRV_UNIX_O_DSYNC,	/*!< open log files in O_SYNC mode */
667 	SRV_UNIX_LITTLESYNC,	/*!< do not call os_file_flush()
668 				when writing data files, but do flush
669 				after writing to log files */
670 	SRV_UNIX_NOSYNC,	/*!< do not flush after writing */
671 	SRV_UNIX_O_DIRECT,	/*!< invoke os_file_set_nocache() on
672 				data files. This implies using
673 				non-buffered IO but still using fsync,
674 				the reason for which is that some FS
675 				do not flush meta-data when
676 				unbuffered IO happens */
677 	SRV_UNIX_O_DIRECT_NO_FSYNC,
678 				/*!< do not use fsync() when using
679 				direct IO i.e.: it can be set to avoid
680 				the fsync() call that we make when
681 				using SRV_UNIX_O_DIRECT. However, in
682 				this case user/DBA should be sure about
683 				the integrity of the meta-data */
684 	SRV_UNIX_ALL_O_DIRECT   /*!< similar to O_DIRECT, invokes
685 				os_file_set_nocache() on data and log files.
686 				This implies using non-buffered IO but still
687 				using fsync for data but not log files. */
688 };
689 
690 /** Alternatives for file i/o in Windows */
691 enum {
692 	SRV_WIN_IO_NORMAL = 1,	/*!< buffered I/O */
693 	SRV_WIN_IO_UNBUFFERED	/*!< unbuffered I/O; this is the default */
694 };
695 
696 /** Alternatives for srv_force_recovery. Non-zero values are intended
697 to help the user get a damaged database up so that he can dump intact
698 tables and rows with SELECT INTO OUTFILE. The database must not otherwise
699 be used with these options! A bigger number below means that all precautions
700 of lower numbers are included. */
701 enum {
702 	SRV_FORCE_IGNORE_CORRUPT = 1,	/*!< let the server run even if it
703 					detects a corrupt page */
704 	SRV_FORCE_NO_BACKGROUND	= 2,	/*!< prevent the main thread from
705 					running: if a crash would occur
706 					in purge, this prevents it */
707 	SRV_FORCE_NO_TRX_UNDO = 3,	/*!< do not run trx rollback after
708 					recovery */
709 	SRV_FORCE_NO_IBUF_MERGE = 4,	/*!< prevent also ibuf operations:
710 					if they would cause a crash, better
711 					not do them */
712 	SRV_FORCE_NO_UNDO_LOG_SCAN = 5,	/*!< do not look at undo logs when
713 					starting the database: InnoDB will
714 					treat even incomplete transactions
715 					as committed */
716 	SRV_FORCE_NO_LOG_REDO = 6	/*!< do not do the log roll-forward
717 					in connection with recovery */
718 };
719 
720 /* Alternatives for srv_innodb_stats_method, which could be changed by
721 setting innodb_stats_method */
722 enum srv_stats_method_name_enum {
723 	SRV_STATS_NULLS_EQUAL,		/* All NULL values are treated as
724 					equal. This is the default setting
725 					for innodb_stats_method */
726 	SRV_STATS_NULLS_UNEQUAL,	/* All NULL values are treated as
727 					NOT equal. */
728 	SRV_STATS_NULLS_IGNORED		/* NULL values are ignored */
729 };
730 
731 typedef enum srv_stats_method_name_enum		srv_stats_method_name_t;
732 
733 #ifndef UNIV_HOTBACKUP
734 /** Types of threads existing in the system. */
735 enum srv_thread_type {
736 	SRV_NONE,			/*!< None */
737 	SRV_WORKER,			/*!< threads serving parallelized
738 					queries and queries released from
739 					lock wait */
740 	SRV_PURGE,			/*!< Purge coordinator thread */
741 	SRV_MASTER			/*!< the master thread, (whose type
742 					number must be biggest) */
743 };
744 
745 /*********************************************************************//**
746 Boots Innobase server. */
747 UNIV_INTERN
748 void
749 srv_boot(void);
750 /*==========*/
751 /*********************************************************************//**
752 Initializes the server. */
753 UNIV_INTERN
754 void
755 srv_init(void);
756 /*==========*/
757 /*********************************************************************//**
758 Frees the data structures created in srv_init(). */
759 UNIV_INTERN
760 void
761 srv_free(void);
762 /*==========*/
763 /*********************************************************************//**
764 Initializes the synchronization primitives, memory system, and the thread
765 local storage. */
766 UNIV_INTERN
767 void
768 srv_general_init(void);
769 /*==================*/
770 /*********************************************************************//**
771 Sets the info describing an i/o thread current state. */
772 UNIV_INTERN
773 void
774 srv_set_io_thread_op_info(
775 /*======================*/
776 	ulint		i,	/*!< in: the 'segment' of the i/o thread */
777 	const char*	str);	/*!< in: constant char string describing the
778 				state */
779 /*********************************************************************//**
780 Resets the info describing an i/o thread current state. */
781 UNIV_INTERN
782 void
783 srv_reset_io_thread_op_info();
784 /*=========================*/
785 /*******************************************************************//**
786 Tells the purge thread that there has been activity in the database
787 and wakes up the purge thread if it is suspended (not sleeping).  Note
788 that there is a small chance that the purge thread stays suspended
789 (we do not protect our operation with the srv_sys_t:mutex, for
790 performance reasons). */
791 UNIV_INTERN
792 void
793 srv_wake_purge_thread_if_not_active(void);
794 /*=====================================*/
795 /*******************************************************************//**
796 Tells the Innobase server that there has been activity in the database
797 and wakes up the master thread if it is suspended (not sleeping). Used
798 in the MySQL interface. Note that there is a small chance that the master
799 thread stays suspended (we do not protect our operation with the kernel
800 mutex, for performace reasons). */
801 UNIV_INTERN
802 void
803 srv_active_wake_master_thread(void);
804 /*===============================*/
805 /*******************************************************************//**
806 Wakes up the master thread if it is suspended or being suspended. */
807 UNIV_INTERN
808 void
809 srv_wake_master_thread(void);
810 /*========================*/
811 /******************************************************************//**
812 A thread which follows the redo log and outputs the changed page bitmap.
813 @return a dummy value */
814 extern "C"
815 UNIV_INTERN
816 os_thread_ret_t
817 DECLARE_THREAD(srv_redo_log_follow_thread)(
818 /*=======================*/
819 	void*	arg);	/*!< in: a dummy parameter required by
820 			os_thread_create */
821 /******************************************************************//**
822 Outputs to a file the output of the InnoDB Monitor.
823 @return FALSE if not all information printed
824 due to failure to obtain necessary mutex */
825 UNIV_INTERN
826 ibool
827 srv_printf_innodb_monitor(
828 /*======================*/
829 	FILE*	file,		/*!< in: output stream */
830 	ibool	nowait,		/*!< in: whether to wait for the
831 				lock_sys_t::mutex */
832 	ulint*	trx_start,	/*!< out: file position of the start of
833 				the list of active transactions */
834 	ulint*	trx_end);	/*!< out: file position of the end of
835 				the list of active transactions */
836 
837 /******************************************************************//**
838 Function to pass InnoDB status variables to MySQL */
839 UNIV_INTERN
840 void
841 srv_export_innodb_status(void);
842 /*==========================*/
843 /*************************************************************//**
844 Removes old archived transaction log files.
845 Both parameters couldn't be provided at the same time.
846 @return DB_SUCCESS on success, otherwise DB_ERROR */
847 UNIV_INTERN
848 dberr_t
849 purge_archived_logs(
850 	time_t	before_date,		/*!< in: all files modified
851 					before timestamp should be removed */
852 	lsn_t	before_lsn);		/*!< in: files with this lsn in name
853 					and earler should be removed */
854 /*==========================*/
855 /*******************************************************************//**
856 Get current server activity count. We don't hold srv_sys::mutex while
857 reading this value as it is only used in heuristics.
858 @return activity count. */
859 UNIV_INTERN
860 ulint
861 srv_get_activity_count(void);
862 /*========================*/
863 /*******************************************************************//**
864 Check if there has been any activity. Considers background change buffer
865 merge as regular server activity unless a non-default
866 old_ibuf_merge_activity_count value is passed, in which case the merge will be
867 treated as keeping server idle.
868 @return FALSE if no change in activity counter. */
869 UNIV_INTERN
870 ibool
871 srv_check_activity(
872 /*===============*/
873 	ulint		old_activity_count,	/*!< old activity count */
874 						/*!< old change buffer merge
875 						activity count, or
876 						ULINT_UNDEFINED */
877 	ulint		old_ibuf_merge_activity_count = ULINT_UNDEFINED);
878 /******************************************************************//**
879 Increment the server activity counter. */
880 UNIV_INTERN
881 void
882 srv_inc_activity_count(
883 /*===================*/
884 	bool ibuf_merge_activity = false);	/*!< whether this activity bump
885 						is caused by the background
886 						change buffer merge */
887 
888 /**********************************************************************//**
889 Enqueues a task to server task queue and releases a worker thread, if there
890 is a suspended one. */
891 UNIV_INTERN
892 void
893 srv_que_task_enqueue_low(
894 /*=====================*/
895 	que_thr_t*	thr);	/*!< in: query thread */
896 
897 /**********************************************************************//**
898 Check whether any background thread is active. If so, return the thread
899 type.
900 @return SRV_NONE if all are are suspended or have exited, thread
901 type if any are still active. */
902 UNIV_INTERN
903 enum srv_thread_type
904 srv_get_active_thread_type(void);
905 /*============================*/
906 
907 extern "C" {
908 
909 /*********************************************************************//**
910 A thread which prints the info output by various InnoDB monitors.
911 @return	a dummy parameter */
912 UNIV_INTERN
913 os_thread_ret_t
914 DECLARE_THREAD(srv_monitor_thread)(
915 /*===============================*/
916 	void*	arg);	/*!< in: a dummy parameter required by
917 			os_thread_create */
918 
919 /*********************************************************************//**
920 The master thread controlling the server.
921 @return	a dummy parameter */
922 UNIV_INTERN
923 os_thread_ret_t
924 DECLARE_THREAD(srv_master_thread)(
925 /*==============================*/
926 	void*	arg);	/*!< in: a dummy parameter required by
927 			os_thread_create */
928 
929 /*************************************************************************
930 A thread which prints warnings about semaphore waits which have lasted
931 too long. These can be used to track bugs which cause hangs.
932 @return	a dummy parameter */
933 UNIV_INTERN
934 os_thread_ret_t
935 DECLARE_THREAD(srv_error_monitor_thread)(
936 /*=====================================*/
937 	void*	arg);	/*!< in: a dummy parameter required by
938 			os_thread_create */
939 
940 /*********************************************************************//**
941 Purge coordinator thread that schedules the purge tasks.
942 @return	a dummy parameter */
943 UNIV_INTERN
944 os_thread_ret_t
945 DECLARE_THREAD(srv_purge_coordinator_thread)(
946 /*=========================================*/
947 	void*	arg MY_ATTRIBUTE((unused)));	/*!< in: a dummy parameter
948 						required by os_thread_create */
949 
950 /*********************************************************************//**
951 Worker thread that reads tasks from the work queue and executes them.
952 @return	a dummy parameter */
953 UNIV_INTERN
954 os_thread_ret_t
955 DECLARE_THREAD(srv_worker_thread)(
956 /*==============================*/
957 	void*	arg MY_ATTRIBUTE((unused)));	/*!< in: a dummy parameter
958 						required by os_thread_create */
959 } /* extern "C" */
960 
961 /**********************************************************************//**
962 Get count of tasks in the queue.
963 @return number of tasks in queue  */
964 UNIV_INTERN
965 ulint
966 srv_get_task_queue_length(void);
967 /*===========================*/
968 
969 /*********************************************************************//**
970 Releases threads of the type given from suspension in the thread table.
971 NOTE! The server mutex has to be reserved by the caller!
972 @return number of threads released: this may be less than n if not
973 enough threads were suspended at the moment */
974 UNIV_INTERN
975 ulint
976 srv_release_threads(
977 /*================*/
978 	enum srv_thread_type	type,	/*!< in: thread type */
979 	ulint			n);	/*!< in: number of threads to release */
980 
981 /**********************************************************************//**
982 Check whether any background thread are active. If so print which thread
983 is active. Send the threads wakeup signal.
984 @return name of thread that is active or NULL */
985 UNIV_INTERN
986 const char*
987 srv_any_background_threads_are_active(void);
988 /*=======================================*/
989 
990 /**********************************************************************//**
991 Wakeup the purge threads. */
992 UNIV_INTERN
993 void
994 srv_purge_wakeup(void);
995 /*==================*/
996 
997 /** Check whether given space id is undo tablespace id
998 @param[in]	space_id	space id to check
999 @return true if it is undo tablespace else false. */
1000 bool
1001 srv_is_undo_tablespace(
1002 	ulint	space_id);
1003 
1004 /** Status variables to be passed to MySQL */
1005 struct export_var_t{
1006 	ulint innodb_adaptive_hash_hash_searches;
1007 	ulint innodb_adaptive_hash_non_hash_searches;
1008 	ulint innodb_background_log_sync;
1009 	ulint innodb_data_pending_reads;	/*!< Pending reads */
1010 	ulint innodb_data_pending_writes;	/*!< Pending writes */
1011 	ulint innodb_data_pending_fsyncs;	/*!< Pending fsyncs */
1012 	ulint innodb_data_fsyncs;		/*!< Number of fsyncs so far */
1013 	ulint innodb_data_read;			/*!< Data bytes read */
1014 	ulint innodb_data_writes;		/*!< I/O write requests */
1015 	ulint innodb_data_written;		/*!< Data bytes written */
1016 	ulint innodb_data_reads;		/*!< I/O read requests */
1017 	char  innodb_buffer_pool_dump_status[512];/*!< Buf pool dump status */
1018 	char  innodb_buffer_pool_load_status[512];/*!< Buf pool load status */
1019 	ulint innodb_buffer_pool_pages_total;	/*!< Buffer pool size */
1020 	ulint innodb_buffer_pool_pages_data;	/*!< Data pages */
1021 	ulint innodb_buffer_pool_bytes_data;	/*!< File bytes used */
1022 	ulint innodb_buffer_pool_pages_dirty;	/*!< Dirty data pages */
1023 	ulint innodb_buffer_pool_bytes_dirty;	/*!< File bytes modified */
1024 	ulint innodb_buffer_pool_pages_misc;	/*!< Miscellanous pages */
1025 	ulint innodb_buffer_pool_pages_free;	/*!< Free pages */
1026 #ifdef UNIV_DEBUG
1027 	ulint innodb_buffer_pool_pages_latched;	/*!< Latched pages */
1028 #endif /* UNIV_DEBUG */
1029 	ulint innodb_buffer_pool_pages_made_not_young;
1030 	ulint innodb_buffer_pool_pages_made_young;
1031 	ulint innodb_buffer_pool_pages_old;
1032 	ulint innodb_buffer_pool_read_requests;	/*!< buf_pool->stat.n_page_gets */
1033 	ulint innodb_buffer_pool_reads;		/*!< srv_buf_pool_reads */
1034 	ulint innodb_buffer_pool_wait_free;	/*!< srv_buf_pool_wait_free */
1035 	ulint innodb_buffer_pool_pages_flushed;	/*!< srv_buf_pool_flushed */
1036 	ulint innodb_buffer_pool_pages_LRU_flushed;	/*!< buf_lru_flush_page_count */
1037 	ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
1038 	ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
1039 	ulint innodb_buffer_pool_read_ahead;	/*!< srv_read_ahead */
1040 	ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
1041 	ulint innodb_checkpoint_age;
1042 	ulint innodb_checkpoint_max_age;
1043 	ulint innodb_dblwr_pages_written;	/*!< srv_dblwr_pages_written */
1044 	ulint innodb_dblwr_writes;		/*!< srv_dblwr_writes */
1045 	ulint innodb_deadlocks;
1046 	ibool innodb_have_atomic_builtins;	/*!< HAVE_ATOMIC_BUILTINS */
1047 	ulint innodb_history_list_length;
1048 	ulint innodb_ibuf_size;
1049 	ulint innodb_ibuf_free_list;
1050 	ulint innodb_ibuf_segment_size;
1051 	ulint innodb_ibuf_merges;
1052 	ulint innodb_ibuf_merged_inserts;
1053 	ulint innodb_ibuf_merged_delete_marks;
1054 	ulint innodb_ibuf_merged_deletes;
1055 	ulint innodb_ibuf_discarded_inserts;
1056 	ulint innodb_ibuf_discarded_delete_marks;
1057 	ulint innodb_ibuf_discarded_deletes;
1058 	ulint innodb_log_waits;			/*!< srv_log_waits */
1059 	ulint innodb_log_write_requests;	/*!< srv_log_write_requests */
1060 	ulint innodb_log_writes;		/*!< srv_log_writes */
1061 	lsn_t innodb_os_log_written;		/*!< srv_os_log_written */
1062 	lsn_t innodb_lsn_current;
1063 	lsn_t innodb_lsn_flushed;
1064 	lsn_t innodb_lsn_last_checkpoint;
1065 	ulint innodb_master_thread_active_loops;/*!< srv_main_active_loops */
1066 	ulint innodb_master_thread_idle_loops;	/*!< srv_main_idle_loops */
1067 	ib_int64_t innodb_max_trx_id;
1068 	ulint innodb_mem_adaptive_hash;
1069 	ulint innodb_mem_dictionary;
1070 	ulint innodb_mem_total;
1071 	ib_int64_t innodb_mutex_os_waits;
1072 	ib_int64_t innodb_mutex_spin_rounds;
1073 	ib_int64_t innodb_mutex_spin_waits;
1074 	ib_int64_t innodb_oldest_view_low_limit_trx_id;
1075 	ulint innodb_os_log_fsyncs;		/*!< fil_n_log_flushes */
1076 	ulint innodb_os_log_pending_writes;	/*!< srv_os_log_pending_writes */
1077 	ulint innodb_os_log_pending_fsyncs;	/*!< fil_n_pending_log_flushes */
1078 	ulint innodb_page_size;			/*!< UNIV_PAGE_SIZE */
1079 	ulint innodb_pages_created;		/*!< buf_pool->stat.n_pages_created */
1080 	ulint innodb_pages_read;		/*!< buf_pool->stat.n_pages_read */
1081 	ulint innodb_pages_written;		/*!< buf_pool->stat.n_pages_written */
1082 	ib_int64_t innodb_purge_trx_id;
1083 	ib_int64_t innodb_purge_undo_no;
1084 	ulint innodb_row_lock_waits;		/*!< srv_n_lock_wait_count */
1085 	ulint innodb_row_lock_current_waits;	/*!< srv_n_lock_wait_current_count */
1086 	ib_int64_t innodb_row_lock_time;	/*!< srv_n_lock_wait_time
1087 						/ 1000 */
1088 	ulint innodb_row_lock_time_avg;		/*!< srv_n_lock_wait_time
1089 						/ 1000
1090 						/ srv_n_lock_wait_count */
1091 	ulint innodb_row_lock_time_max;		/*!< srv_n_lock_max_wait_time
1092 						/ 1000 */
1093 	ulint innodb_current_row_locks;
1094 	ulint innodb_rows_read;			/*!< srv_n_rows_read */
1095 	ulint innodb_rows_inserted;		/*!< srv_n_rows_inserted */
1096 	ulint innodb_rows_updated;		/*!< srv_n_rows_updated */
1097 	ulint innodb_rows_deleted;		/*!< srv_n_rows_deleted */
1098 	ulint innodb_num_open_files;		/*!< fil_n_file_opened */
1099 	ulint innodb_truncated_status_writes;	/*!< srv_truncated_status_writes */
1100 	ulint innodb_available_undo_logs;       /*!< srv_available_undo_logs */
1101 	ulint innodb_read_views_memory;		/*!< srv_read_views_memory */
1102 	ulint innodb_descriptors_memory;	/*!< srv_descriptors_memory */
1103 	ib_int64_t innodb_s_lock_os_waits;
1104 	ib_int64_t innodb_s_lock_spin_rounds;
1105 	ib_int64_t innodb_s_lock_spin_waits;
1106 	ib_int64_t innodb_x_lock_os_waits;
1107 	ib_int64_t innodb_x_lock_spin_rounds;
1108 	ib_int64_t innodb_x_lock_spin_waits;
1109 #ifdef UNIV_DEBUG
1110 	ulint innodb_purge_trx_id_age;		/*!< rw_max_trx_id - purged trx_id */
1111 	ulint innodb_purge_view_trx_id_age;	/*!< rw_max_trx_id
1112 						- purged view's min trx_id */
1113 #endif /* UNIV_DEBUG */
1114 	ulint innodb_column_compressed;		/*!< srv_column_compressed */
1115 	ulint innodb_column_decompressed;	/*!< srv_column_decompressed */
1116 
1117 	ulint innodb_sec_rec_cluster_reads;	/*!< srv_sec_rec_cluster_reads */
1118 	ulint innodb_sec_rec_cluster_reads_avoided; /*!< srv_sec_rec_cluster_reads_avoided */
1119 
1120 	ulint innodb_buffered_aio_submitted;
1121 
1122 	fragmentation_stats_t innodb_fragmentation_stats;/*!< Fragmentation
1123 						statistics */
1124 };
1125 
1126 /** Thread slot in the thread table.  */
1127 struct srv_slot_t{
1128 	srv_thread_type type;			/*!< thread type: user,
1129 						utility etc. */
1130 	ibool		in_use;			/*!< TRUE if this slot
1131 						is in use */
1132 	ibool		suspended;		/*!< TRUE if the thread is
1133 						waiting for the event of this
1134 						slot */
1135 	ib_time_t	suspend_time;		/*!< time when the thread was
1136 						suspended. Initialized by
1137 						lock_wait_table_reserve_slot()
1138 						for lock wait */
1139 	ulong		wait_timeout;		/*!< wait time that if exceeded
1140 						the thread will be timed out.
1141 						Initialized by
1142 						lock_wait_table_reserve_slot()
1143 						for lock wait */
1144 	os_event_t	event;			/*!< event used in suspending
1145 						the thread when it has nothing
1146 						to do */
1147 	que_thr_t*	thr;			/*!< suspended query thread
1148 						(only used for user threads) */
1149 };
1150 
1151 #else /* !UNIV_HOTBACKUP */
1152 # define srv_use_adaptive_hash_indexes		FALSE
1153 # define srv_use_native_aio			FALSE
1154 # define srv_numa_interleave			FALSE
1155 # define srv_force_recovery			0UL
1156 # define srv_set_io_thread_op_info(t,info)	((void) 0)
1157 # define srv_reset_io_thread_op_info()		((void) 0)
1158 # define srv_is_being_started			0
1159 # define srv_win_file_flush_method		SRV_WIN_IO_UNBUFFERED
1160 # define srv_unix_file_flush_method		SRV_UNIX_O_DSYNC
1161 # define srv_start_raw_disk_in_use		0
1162 # define srv_file_per_table			1
1163 #endif /* !UNIV_HOTBACKUP */
1164 
1165 #ifndef DBUG_OFF
1166 /** false before InnoDB monitor has been printed at least once, true
1167 afterwards */
1168 extern bool	srv_debug_monitor_printed;
1169 #else
1170 #define	srv_debug_monitor_printed	false
1171 #endif
1172 
1173 #endif
1174