~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-09-15 20:24:31 UTC
  • mto: (1766.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1767.
  • Revision ID: brian@tangent.org-20100915202431-wbrrl4vg6rzjvdiu
Adding opt for optional schedulers and making them --plugin-add only.

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.
26
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27
19
 
28
20
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
 
21
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
22
Place, Suite 330, Boston, MA 02111-1307 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
59 Temple Place, Suite 330, Boston, MA 02111-1307 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
 
314
315
/** Number of buffer pool reads that led to the
315
316
reading of a disk page */
316
317
extern ulint srv_buf_pool_reads;
 
318
/** Number of sequential read-aheads */
 
319
extern ulint srv_read_ahead_seq;
 
320
/** Number of random read-aheads */
 
321
extern ulint srv_read_ahead_rnd;
317
322
 
318
323
/** Status variables to be passed to MySQL */
319
324
typedef struct export_var_struct export_struc;
326
331
 
327
332
/** The server system */
328
333
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
334
#endif /* !UNIV_HOTBACKUP */
361
335
 
362
336
/** Types of raw partitions in innodb_data_file_path */
441
415
srv_init(void);
442
416
/*==========*/
443
417
/*********************************************************************//**
444
 
Frees the data structures created in srv_init(). */
 
418
Frees the OS fast mutex created in srv_boot(). */
445
419
UNIV_INTERN
446
420
void
447
421
srv_free(void);
497
471
        void*   arg);   /*!< in: a dummy parameter required by
498
472
                        os_thread_create */
499
473
/*******************************************************************//**
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
474
Tells the Innobase server that there has been activity in the database
507
475
and wakes up the master thread if it is suspended (not sleeping). Used
508
476
in the MySQL interface. Note that there is a small chance that the master
518
486
void
519
487
srv_wake_master_thread(void);
520
488
/*========================*/
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
489
/*********************************************************************//**
532
490
Puts an OS thread to wait if there are too many concurrent threads
533
491
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
586
544
                                MySQL OS thread  */
587
545
/*********************************************************************//**
588
546
A thread which wakes up threads whose lock wait may have lasted too long.
 
547
This also prints the info output by various InnoDB monitors.
589
548
@return a dummy parameter */
590
549
UNIV_INTERN
591
550
os_thread_ret_t
592
 
srv_lock_timeout_thread(
593
 
/*====================*/
 
551
srv_lock_timeout_and_monitor_thread(
 
552
/*================================*/
594
553
        void*   arg);   /*!< in: a dummy parameter required by
595
554
                        os_thread_create */
596
555
/*********************************************************************//**
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
556
A thread which prints warnings about semaphore waits which have lasted
607
557
too long. These can be used to track bugs which cause hangs.
608
558
@return a dummy parameter */
613
563
        void*   arg);   /*!< in: a dummy parameter required by
614
564
                        os_thread_create */
615
565
/******************************************************************//**
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 */
 
566
Outputs to a file the output of the InnoDB Monitor. */
619
567
UNIV_INTERN
620
 
ibool
 
568
void
621
569
srv_printf_innodb_monitor(
622
570
/*======================*/
623
571
        FILE*   file,           /*!< in: output stream */
624
 
        ibool   nowait,         /*!< in: whether to wait for kernel mutex */
625
572
        ulint*  trx_start,      /*!< out: file position of the start of
626
573
                                the list of active transactions */
627
574
        ulint*  trx_end);       /*!< out: file position of the end of
634
581
srv_export_innodb_status(void);
635
582
/*==========================*/
636
583
 
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
 
/*======================================*/
 
584
/** Thread slot in the thread table */
 
585
typedef struct srv_slot_struct  srv_slot_t;
 
586
 
 
587
/** Thread table is an array of slots */
 
588
typedef srv_slot_t      srv_table_t;
670
589
 
671
590
/** Status variables to be passed to MySQL */
672
591
struct export_var_struct{
686
605
#ifdef UNIV_DEBUG
687
606
        ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
688
607
#endif /* UNIV_DEBUG */
689
 
        ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
 
608
        ulint innodb_buffer_pool_read_requests; /*!< buf_pool->n_page_gets */
690
609
        ulint innodb_buffer_pool_reads;         /*!< srv_buf_pool_reads */
691
610
        ulint innodb_buffer_pool_wait_free;     /*!< srv_buf_pool_wait_free */
692
611
        ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
693
612
        ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
694
 
        ulint innodb_buffer_pool_read_ahead;    /*!< srv_read_ahead */
695
 
        ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
 
613
        ulint innodb_buffer_pool_read_ahead_seq;/*!< srv_read_ahead_seq */
 
614
        ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
696
615
        ulint innodb_dblwr_pages_written;       /*!< srv_dblwr_pages_written */
697
616
        ulint innodb_dblwr_writes;              /*!< srv_dblwr_writes */
698
617
        ibool innodb_have_atomic_builtins;      /*!< HAVE_ATOMIC_BUILTINS */
704
623
        ulint innodb_os_log_pending_writes;     /*!< srv_os_log_pending_writes */
705
624
        ulint innodb_os_log_pending_fsyncs;     /*!< fil_n_pending_log_flushes */
706
625
        ulint innodb_page_size;                 /*!< UNIV_PAGE_SIZE */
707
 
        ulint innodb_pages_created;             /*!< buf_pool->stat.n_pages_created */
708
 
        ulint innodb_pages_read;                /*!< buf_pool->stat.n_pages_read */
709
 
        ulint innodb_pages_written;             /*!< buf_pool->stat.n_pages_written */
 
626
        ulint innodb_pages_created;             /*!< buf_pool->n_pages_created */
 
627
        ulint innodb_pages_read;                /*!< buf_pool->n_pages_read */
 
628
        ulint innodb_pages_written;             /*!< buf_pool->n_pages_written */
710
629
        ulint innodb_row_lock_waits;            /*!< srv_n_lock_wait_count */
711
630
        ulint innodb_row_lock_current_waits;    /*!< srv_n_lock_wait_current_count */
712
631
        ib_int64_t innodb_row_lock_time;        /*!< srv_n_lock_wait_time
720
639
        ulint innodb_rows_inserted;             /*!< srv_n_rows_inserted */
721
640
        ulint innodb_rows_updated;              /*!< srv_n_rows_updated */
722
641
        ulint innodb_rows_deleted;              /*!< srv_n_rows_deleted */
723
 
        ulint innodb_truncated_status_writes;   /*!< srv_truncated_status_writes */
724
642
};
725
643
 
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
644
/** The server system struct */
733
645
struct srv_sys_struct{
734
646
        srv_table_t*    threads;        /*!< server thread table */
737
649
};
738
650
 
739
651
extern ulint    srv_n_threads_active[];
 
652
 
740
653
#else /* !UNIV_HOTBACKUP */
 
654
# define srv_use_checksums                      TRUE
741
655
# define srv_use_adaptive_hash_indexes          FALSE
742
 
# define srv_use_checksums                      TRUE
743
 
# define srv_use_native_aio                     FALSE
744
656
# define srv_force_recovery                     0UL
745
657
# define srv_set_io_thread_op_info(t,info)      ((void) 0)
746
658
# define srv_is_being_started                   0