1
1
/*****************************************************************************
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
4
Copyright (c) 2008, 2009, Google Inc.
5
Copyright (c) 2009, Percona Inc.
7
6
Portions of this file contain modifications contributed and copyrighted by
8
7
Google, Inc. Those modifications are gratefully acknowledged and are described
10
9
incorporated with their permission, and subject to the conditions contained in
11
10
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
12
This program is free software; you can redistribute it and/or modify it under
21
13
the terms of the GNU General Public License as published by the Free Software
22
14
Foundation; version 2 of the License.
30
22
St, Fifth Floor, Boston, MA 02110-1301 USA
32
24
*****************************************************************************/
25
/***********************************************************************
27
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
28
Copyright (c) 2009, Percona Inc.
30
Portions of this file contain modifications contributed and copyrighted
31
by Percona Inc.. Those modifications are
32
gratefully acknowledged and are described briefly in the InnoDB
33
documentation. The contributions by Percona Inc. are incorporated with
34
their permission, and subject to the conditions contained in the file
37
This program is free software; you can redistribute it and/or modify it
38
under the terms of the GNU General Public License as published by the
39
Free Software Foundation; version 2 of the License.
41
This program is distributed in the hope that it will be useful, but
42
WITHOUT ANY WARRANTY; without even the implied warranty of
43
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
44
Public License for more details.
46
You should have received a copy of the GNU General Public License along
47
with this program; if not, write to the Free Software Foundation, Inc.,
48
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
50
***********************************************************************/
34
52
/**************************************************//**
35
53
@file include/srv0srv.h
101
119
/** Whether to check file format during startup. A value of
102
120
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to
103
121
set it to the highest format we support. */
104
extern ulint srv_max_file_format_at_startup;
122
extern ulint srv_check_file_format_at_startup;
105
123
/** Place locks to records only i.e. do not use next-key locking except
106
124
on duplicate key checking and foreign key checking */
107
125
extern ibool srv_locks_unsafe_for_binlog;
108
126
#endif /* !UNIV_HOTBACKUP */
110
/* If this flag is TRUE, then we will use the native aio of the
111
OS (provided we compiled Innobase with it in), otherwise we will
112
use simulated aio we build below with threads.
113
Currently we support native aio on windows and linux */
114
extern my_bool srv_use_native_aio;
116
extern ibool srv_use_native_conditions;
118
128
extern ulint srv_n_data_files;
119
129
extern char** srv_data_file_names;
120
130
extern ulint* srv_data_file_sizes;
150
160
# endif /* UNIV_HOTBACKUP */
151
161
#endif /* BUILD_DRIZZLE */
152
162
extern ulint srv_buf_pool_size; /*!< requested size in bytes */
153
extern ulint srv_buf_pool_instances; /*!< requested number of buffer pool instances */
154
163
extern ulint srv_buf_pool_old_size; /*!< previously requested size */
155
164
extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
156
165
extern ulint srv_mem_pool_size;
169
178
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
171
180
#ifdef UNIV_LOG_ARCHIVE
172
extern ibool srv_log_archive_on;
173
extern ibool srv_archive_recovery;
174
extern ib_uint64_t srv_archive_recovery_limit_lsn;
181
extern ibool srv_log_archive_on;
182
extern ibool srv_archive_recovery;
183
extern dulint srv_archive_recovery_limit_lsn;
175
184
#endif /* UNIV_LOG_ARCHIVE */
177
186
extern char* srv_file_flush_method_str;
220
229
extern ibool srv_print_verbose_log;
221
230
extern ibool srv_print_innodb_table_monitor;
223
extern ibool srv_lock_timeout_active;
224
extern ibool srv_monitor_active;
232
extern ibool srv_lock_timeout_and_monitor_active;
225
233
extern ibool srv_error_monitor_active;
227
235
extern ulong srv_n_spin_wait_rounds;
279
286
log buffer and have to flush it */
280
287
extern ulint srv_log_waits;
282
/* the number of purge threads to use from the worker pool (currently 0 or 1) */
283
extern ulong srv_n_purge_threads;
285
/* the number of records to purge in one batch */
286
extern ulong srv_purge_batch_size;
288
289
/* variable that counts amount of data read in total (in bytes) */
289
290
extern ulint srv_data_read;
327
328
/** The server system */
328
329
extern srv_sys_t* srv_sys;
330
# ifdef UNIV_PFS_THREAD
331
/* Keys to register InnoDB threads with performance schema */
332
extern mysql_pfs_key_t trx_rollback_clean_thread_key;
333
extern mysql_pfs_key_t io_handler_thread_key;
334
extern mysql_pfs_key_t srv_lock_timeout_thread_key;
335
extern mysql_pfs_key_t srv_error_monitor_thread_key;
336
extern mysql_pfs_key_t srv_monitor_thread_key;
337
extern mysql_pfs_key_t srv_master_thread_key;
339
/* This macro register the current thread and its key with performance
341
# define pfs_register_thread(key) \
344
struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
346
PSI_server->set_thread(psi); \
351
/* This macro delist the current thread from performance schema */
352
# define pfs_delete_thread() \
355
PSI_server->delete_current_thread(); \
358
# endif /* UNIV_PFS_THREAD */
360
330
#endif /* !UNIV_HOTBACKUP */
362
332
/** Types of raw partitions in innodb_data_file_path */
497
467
void* arg); /*!< in: a dummy parameter required by
498
468
os_thread_create */
499
469
/*******************************************************************//**
500
Wakes up the purge thread if it's not already awake. */
503
srv_wake_purge_thread(void);
504
/*=======================*/
505
/*******************************************************************//**
506
470
Tells the Innobase server that there has been activity in the database
507
471
and wakes up the master thread if it is suspended (not sleeping). Used
508
472
in the MySQL interface. Note that there is a small chance that the master
519
483
srv_wake_master_thread(void);
520
484
/*========================*/
521
/*******************************************************************//**
522
Tells the purge thread that there has been activity in the database
523
and wakes up the purge thread if it is suspended (not sleeping). Note
524
that there is a small chance that the purge thread stays suspended
525
(we do not protect our operation with the kernel mutex, for
526
performace reasons). */
529
srv_wake_purge_thread_if_not_active(void);
530
/*=====================================*/
531
485
/*********************************************************************//**
532
486
Puts an OS thread to wait if there are too many concurrent threads
533
487
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
586
540
MySQL OS thread */
587
541
/*********************************************************************//**
588
542
A thread which wakes up threads whose lock wait may have lasted too long.
543
This also prints the info output by various InnoDB monitors.
589
544
@return a dummy parameter */
592
srv_lock_timeout_thread(
593
/*====================*/
547
srv_lock_timeout_and_monitor_thread(
548
/*================================*/
594
549
void* arg); /*!< in: a dummy parameter required by
595
550
os_thread_create */
596
551
/*********************************************************************//**
597
A thread which prints the info output by various InnoDB monitors.
598
@return a dummy parameter */
603
void* arg); /*!< in: a dummy parameter required by
605
/*************************************************************************
606
552
A thread which prints warnings about semaphore waits which have lasted
607
553
too long. These can be used to track bugs which cause hangs.
608
554
@return a dummy parameter */
613
559
void* arg); /*!< in: a dummy parameter required by
614
560
os_thread_create */
615
561
/******************************************************************//**
616
Outputs to a file the output of the InnoDB Monitor.
617
@return FALSE if not all information printed
618
due to failure to obtain necessary mutex */
562
Outputs to a file the output of the InnoDB Monitor. */
621
565
srv_printf_innodb_monitor(
622
566
/*======================*/
623
567
FILE* file, /*!< in: output stream */
624
ibool nowait, /*!< in: whether to wait for kernel mutex */
625
568
ulint* trx_start, /*!< out: file position of the start of
626
569
the list of active transactions */
627
570
ulint* trx_end); /*!< out: file position of the end of
634
577
srv_export_innodb_status(void);
635
578
/*==========================*/
637
/******************************************************************//**
638
Increment the server activity counter. */
641
srv_inc_activity_count(void);
642
/*=========================*/
644
/*********************************************************************//**
645
Asynchronous purge thread.
646
@return a dummy parameter */
651
void* arg __attribute__((unused))); /*!< in: a dummy parameter
652
required by os_thread_create */
654
/**********************************************************************//**
655
Enqueues a task to server task queue and releases a worker thread, if there
656
is a suspended one. */
659
srv_que_task_enqueue_low(
660
/*=====================*/
661
que_thr_t* thr); /*!< in: query thread */
663
/**********************************************************************//**
664
Check whether any background thread is active.
665
@return FALSE if all are are suspended or have exited. */
668
srv_is_any_background_thread_active(void);
669
/*======================================*/
580
/** Thread slot in the thread table */
581
typedef struct srv_slot_struct srv_slot_t;
583
/** Thread table is an array of slots */
584
typedef srv_slot_t srv_table_t;
671
586
/** Status variables to be passed to MySQL */
672
587
struct export_var_struct{
720
635
ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */
721
636
ulint innodb_rows_updated; /*!< srv_n_rows_updated */
722
637
ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
723
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
726
/** Thread slot in the thread table */
727
typedef struct srv_slot_struct srv_slot_t;
729
/** Thread table is an array of slots */
730
typedef srv_slot_t srv_table_t;
732
640
/** The server system struct */
733
641
struct srv_sys_struct{
734
642
srv_table_t* threads; /*!< server thread table */
739
647
extern ulint srv_n_threads_active[];
740
649
#else /* !UNIV_HOTBACKUP */
650
# define srv_use_checksums TRUE
741
651
# define srv_use_adaptive_hash_indexes FALSE
742
# define srv_use_checksums TRUE
743
# define srv_use_native_aio FALSE
744
652
# define srv_force_recovery 0UL
745
653
# define srv_set_io_thread_op_info(t,info) ((void) 0)
746
654
# define srv_is_being_started 0