~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/srv0srv.h

  • Committer: Andrew Hutchings
  • Date: 2010-11-09 13:38:01 UTC
  • mto: (1919.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 1920.
  • Revision ID: andrew@linuxjedi.co.uk-20101109133801-byjzsao76346395x
Add FLUSH GLOBAL STATUS; command
Clears the global status variables for the server

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
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.
6
5
 
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.
12
11
 
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
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
31
23
 
32
24
*****************************************************************************/
 
25
/***********************************************************************
 
26
 
 
27
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
28
Copyright (c) 2009, Percona Inc.
 
29
 
 
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
 
35
COPYING.Percona.
 
36
 
 
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.
 
40
 
 
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.
 
45
 
 
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
 
49
 
 
50
***********************************************************************/
33
51
 
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 */
109
127
 
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;
115
 
#ifdef __WIN__
116
 
extern ibool    srv_use_native_conditions;
117
 
#endif
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)))
170
179
 
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 */
176
185
 
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;
222
231
 
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;
226
234
 
227
235
extern ulong    srv_n_spin_wait_rounds;
230
238
extern ulong    srv_spin_wait_delay;
231
239
extern ibool    srv_priority_boost;
232
240
 
233
 
extern ulint    srv_truncated_status_writes;
234
241
 
235
242
#ifdef UNIV_DEBUG
236
243
extern  ibool   srv_print_thread_releases;
279
286
log buffer and have to flush it */
280
287
extern ulint srv_log_waits;
281
288
 
282
 
/* the number of purge threads to use from the worker pool (currently 0 or 1) */
283
 
extern ulong srv_n_purge_threads;
284
 
 
285
 
/* the number of records to purge in one batch */
286
 
extern ulong srv_purge_batch_size;
287
 
 
288
289
/* variable that counts amount of data read in total (in bytes) */
289
290
extern ulint srv_data_read;
290
291
 
326
327
 
327
328
/** The server system */
328
329
extern srv_sys_t*       srv_sys;
329
 
 
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;
338
 
 
339
 
/* This macro register the current thread and its key with performance
340
 
schema */
341
 
#  define pfs_register_thread(key)                      \
342
 
do {                                                            \
343
 
        if (PSI_server) {                                       \
344
 
                struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
345
 
                if (psi) {                                      \
346
 
                        PSI_server->set_thread(psi);            \
347
 
                }                                               \
348
 
        }                                                       \
349
 
} while (0)
350
 
 
351
 
/* This macro delist the current thread from performance schema */
352
 
#  define pfs_delete_thread()                           \
353
 
do {                                                            \
354
 
        if (PSI_server) {                                       \
355
 
                PSI_server->delete_current_thread();            \
356
 
        }                                                       \
357
 
} while (0)
358
 
# endif /* UNIV_PFS_THREAD */
359
 
 
360
330
#endif /* !UNIV_HOTBACKUP */
361
331
 
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. */
501
 
UNIV_INTERN
502
 
void
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
518
482
void
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). */
527
 
UNIV_INTERN
528
 
void
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 */
590
545
UNIV_INTERN
591
546
os_thread_ret_t
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 */
599
 
UNIV_INTERN
600
 
os_thread_ret_t
601
 
srv_monitor_thread(
602
 
/*===============*/
603
 
        void*   arg);   /*!< in: a dummy parameter required by
604
 
                        os_thread_create */
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. */
619
563
UNIV_INTERN
620
 
ibool
 
564
void
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
/*==========================*/
636
579
 
637
 
/******************************************************************//**
638
 
Increment the server activity counter. */
639
 
UNIV_INTERN
640
 
void
641
 
srv_inc_activity_count(void);
642
 
/*=========================*/
643
 
 
644
 
/*********************************************************************//**
645
 
Asynchronous purge thread.
646
 
@return a dummy parameter */
647
 
UNIV_INTERN
648
 
os_thread_ret_t
649
 
srv_purge_thread(
650
 
/*=============*/
651
 
        void*   arg __attribute__((unused))); /*!< in: a dummy parameter
652
 
                                              required by os_thread_create */
653
 
 
654
 
/**********************************************************************//**
655
 
Enqueues a task to server task queue and releases a worker thread, if there
656
 
is a suspended one. */
657
 
UNIV_INTERN
658
 
void
659
 
srv_que_task_enqueue_low(
660
 
/*=====================*/
661
 
        que_thr_t*      thr);   /*!< in: query thread */
662
 
 
663
 
/**********************************************************************//**
664
 
Check whether any background thread is active.
665
 
@return FALSE if all are are suspended or have exited. */
666
 
UNIV_INTERN
667
 
ibool
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;
 
582
 
 
583
/** Thread table is an array of slots */
 
584
typedef srv_slot_t      srv_table_t;
670
585
 
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 */
724
638
};
725
639
 
726
 
/** Thread slot in the thread table */
727
 
typedef struct srv_slot_struct  srv_slot_t;
728
 
 
729
 
/** Thread table is an array of slots */
730
 
typedef srv_slot_t      srv_table_t;
731
 
 
732
640
/** The server system struct */
733
641
struct srv_sys_struct{
734
642
        srv_table_t*    threads;        /*!< server thread table */
737
645
};
738
646
 
739
647
extern ulint    srv_n_threads_active[];
 
648
 
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