~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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.
4
 
Copyright (c) 2008, 2009, Google Inc.
5
 
Copyright (c) 2009, Percona Inc.
 
3
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
 
4
Copyright (C) 2008, 2009, Google Inc.
 
5
Copyright (C) 2009, Percona Inc.
6
6
 
7
7
Portions of this file contain modifications contributed and copyrighted by
8
8
Google, Inc. Those modifications are gratefully acknowledged and are described
48
48
#include "que0types.h"
49
49
#include "trx0types.h"
50
50
 
 
51
#include <string>
 
52
 
51
53
extern const char*      srv_main_thread_op_info;
52
54
 
53
55
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
54
 
extern const char       srv_mysql50_table_name_prefix[9];
 
56
/** LOOKIE HERE!!!! This used to be srv_mysql50_table_name_prefix[10]
 
57
    which was a buffer overrun, because it didn't allow for the trailing
 
58
    '\0'. Thanks C++! */
 
59
static const std::string srv_mysql50_table_name_prefix("#mysql50#");
55
60
 
56
61
/* When this event is set the lock timeout and InnoDB monitor
57
62
thread starts running */
58
63
extern os_event_t       srv_lock_timeout_thread_event;
59
64
 
 
65
/* The monitor thread waits on this event. */
 
66
extern os_event_t       srv_monitor_event;
 
67
 
 
68
/* The lock timeout thread waits on this event. */
 
69
extern os_event_t       srv_timeout_event;
 
70
 
 
71
/* The error monitor thread waits on this event. */
 
72
extern os_event_t       srv_error_event;
 
73
 
60
74
/* If the last data file is auto-extended, we add this many pages to it
61
75
at a time */
62
76
#define SRV_AUTO_EXTEND_INCREMENT       \
101
115
/** Whether to check file format during startup.  A value of
102
116
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE.  The default is to
103
117
set it to the highest format we support. */
104
 
extern ulint    srv_check_file_format_at_startup;
 
118
extern ulint    srv_max_file_format_at_startup;
105
119
/** Place locks to records only i.e. do not use next-key locking except
106
120
on duplicate key checking and foreign key checking */
107
121
extern ibool    srv_locks_unsafe_for_binlog;
108
122
#endif /* !UNIV_HOTBACKUP */
109
123
 
 
124
/* If this flag is TRUE, then we will use the native aio of the
 
125
OS (provided we compiled Innobase with it in), otherwise we will
 
126
use simulated aio we build below with threads.
 
127
Currently we support native aio on windows and linux */
 
128
extern my_bool  srv_use_native_aio;
 
129
#ifdef __WIN__
 
130
extern ibool    srv_use_native_conditions;
 
131
#endif
110
132
extern ulint    srv_n_data_files;
111
133
extern char**   srv_data_file_names;
112
134
extern ulint*   srv_data_file_sizes;
142
164
# endif /* UNIV_HOTBACKUP */
143
165
#endif /* BUILD_DRIZZLE */
144
166
extern ulint    srv_buf_pool_size;      /*!< requested size in bytes */
 
167
extern ulint    srv_buf_pool_instances; /*!< requested number of buffer pool instances */
145
168
extern ulint    srv_buf_pool_old_size;  /*!< previously requested size */
146
169
extern ulint    srv_buf_pool_curr_size; /*!< current size in bytes */
147
170
extern ulint    srv_mem_pool_size;
160
183
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
161
184
 
162
185
#ifdef UNIV_LOG_ARCHIVE
163
 
extern ibool    srv_log_archive_on;
164
 
extern ibool    srv_archive_recovery;
165
 
extern dulint   srv_archive_recovery_limit_lsn;
 
186
extern ibool            srv_log_archive_on;
 
187
extern ibool            srv_archive_recovery;
 
188
extern ib_uint64_t      srv_archive_recovery_limit_lsn;
166
189
#endif /* UNIV_LOG_ARCHIVE */
167
190
 
168
191
extern char*    srv_file_flush_method_str;
221
244
extern ulong    srv_spin_wait_delay;
222
245
extern ibool    srv_priority_boost;
223
246
 
 
247
extern ulint    srv_truncated_status_writes;
224
248
 
225
249
#ifdef UNIV_DEBUG
226
250
extern  ibool   srv_print_thread_releases;
244
268
                                query threads, and lock table: we allocate
245
269
                                it from dynamic memory to get it to the
246
270
                                same DRAM page as other hotspot semaphores */
 
271
extern mutex_t* commit_id_mutex_temp;
 
272
 
247
273
#define kernel_mutex (*kernel_mutex_temp)
 
274
#define commit_id_mutex (*commit_id_mutex_temp)
248
275
 
249
276
#define SRV_MAX_N_IO_THREADS    130
250
277
 
269
296
log buffer and have to flush it */
270
297
extern ulint srv_log_waits;
271
298
 
 
299
/* the number of purge threads to use from the worker pool (currently 0 or 1) */
 
300
extern ulong srv_n_purge_threads;
 
301
 
 
302
/* the number of records to purge in one batch */
 
303
extern ulong srv_purge_batch_size;
 
304
 
272
305
/* variable that counts amount of data read in total (in bytes) */
273
306
extern ulint srv_data_read;
274
307
 
310
343
 
311
344
/** The server system */
312
345
extern srv_sys_t*       srv_sys;
 
346
 
 
347
# ifdef UNIV_PFS_THREAD
 
348
/* Keys to register InnoDB threads with performance schema */
 
349
extern mysql_pfs_key_t  trx_rollback_clean_thread_key;
 
350
extern mysql_pfs_key_t  io_handler_thread_key;
 
351
extern mysql_pfs_key_t  srv_lock_timeout_thread_key;
 
352
extern mysql_pfs_key_t  srv_error_monitor_thread_key;
 
353
extern mysql_pfs_key_t  srv_monitor_thread_key;
 
354
extern mysql_pfs_key_t  srv_master_thread_key;
 
355
 
 
356
/* This macro register the current thread and its key with performance
 
357
schema */
 
358
#  define pfs_register_thread(key)                      \
 
359
do {                                                            \
 
360
        if (PSI_server) {                                       \
 
361
                struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
 
362
                if (psi) {                                      \
 
363
                        PSI_server->set_thread(psi);            \
 
364
                }                                               \
 
365
        }                                                       \
 
366
} while (0)
 
367
 
 
368
/* This macro delist the current thread from performance schema */
 
369
#  define pfs_delete_thread()                           \
 
370
do {                                                            \
 
371
        if (PSI_server) {                                       \
 
372
                PSI_server->delete_current_thread();            \
 
373
        }                                                       \
 
374
} while (0)
 
375
# endif /* UNIV_PFS_THREAD */
 
376
 
313
377
#endif /* !UNIV_HOTBACKUP */
314
378
 
315
379
/** Types of raw partitions in innodb_data_file_path */
450
514
        void*   arg);   /*!< in: a dummy parameter required by
451
515
                        os_thread_create */
452
516
/*******************************************************************//**
 
517
Wakes up the purge thread if it's not already awake. */
 
518
UNIV_INTERN
 
519
void
 
520
srv_wake_purge_thread(void);
 
521
/*=======================*/
 
522
/*******************************************************************//**
453
523
Tells the Innobase server that there has been activity in the database
454
524
and wakes up the master thread if it is suspended (not sleeping). Used
455
525
in the MySQL interface. Note that there is a small chance that the master
465
535
void
466
536
srv_wake_master_thread(void);
467
537
/*========================*/
 
538
/*******************************************************************//**
 
539
Tells the purge thread that there has been activity in the database
 
540
and wakes up the purge thread if it is suspended (not sleeping).  Note
 
541
that there is a small chance that the purge thread stays suspended
 
542
(we do not protect our operation with the kernel mutex, for
 
543
performace reasons). */
 
544
UNIV_INTERN
 
545
void
 
546
srv_wake_purge_thread_if_not_active(void);
 
547
/*=====================================*/
468
548
/*********************************************************************//**
469
549
Puts an OS thread to wait if there are too many concurrent threads
470
550
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
571
651
srv_export_innodb_status(void);
572
652
/*==========================*/
573
653
 
574
 
/** Thread slot in the thread table */
575
 
typedef struct srv_slot_struct  srv_slot_t;
576
 
 
577
 
/** Thread table is an array of slots */
578
 
typedef srv_slot_t      srv_table_t;
 
654
/******************************************************************//**
 
655
Increment the server activity counter. */
 
656
UNIV_INTERN
 
657
void
 
658
srv_inc_activity_count(void);
 
659
/*=========================*/
 
660
 
 
661
/*********************************************************************//**
 
662
Asynchronous purge thread.
 
663
@return a dummy parameter */
 
664
UNIV_INTERN
 
665
os_thread_ret_t
 
666
srv_purge_thread(
 
667
/*=============*/
 
668
        void*   /*arg __attribute__((unused))*/); /*!< in: a dummy parameter
 
669
                                              required by os_thread_create */
 
670
 
 
671
/**********************************************************************//**
 
672
Enqueues a task to server task queue and releases a worker thread, if there
 
673
is a suspended one. */
 
674
UNIV_INTERN
 
675
void
 
676
srv_que_task_enqueue_low(
 
677
/*=====================*/
 
678
        que_thr_t*      thr);   /*!< in: query thread */
 
679
 
 
680
/**********************************************************************//**
 
681
Check whether any background thread is active.
 
682
@return FALSE if all are are suspended or have exited. */
 
683
UNIV_INTERN
 
684
ibool
 
685
srv_is_any_background_thread_active(void);
 
686
/*======================================*/
579
687
 
580
688
/** Status variables to be passed to MySQL */
581
689
struct export_var_struct{
629
737
        ulint innodb_rows_inserted;             /*!< srv_n_rows_inserted */
630
738
        ulint innodb_rows_updated;              /*!< srv_n_rows_updated */
631
739
        ulint innodb_rows_deleted;              /*!< srv_n_rows_deleted */
 
740
        ulint innodb_truncated_status_writes;   /*!< srv_truncated_status_writes */
632
741
};
633
742
 
 
743
/** Thread slot in the thread table */
 
744
typedef struct srv_slot_struct  srv_slot_t;
 
745
 
 
746
/** Thread table is an array of slots */
 
747
typedef srv_slot_t      srv_table_t;
 
748
 
634
749
/** The server system struct */
635
750
struct srv_sys_struct{
636
751
        srv_table_t*    threads;        /*!< server thread table */
639
754
};
640
755
 
641
756
extern ulint    srv_n_threads_active[];
642
 
 
643
757
#else /* !UNIV_HOTBACKUP */
 
758
# define srv_use_adaptive_hash_indexes          FALSE
644
759
# define srv_use_checksums                      TRUE
645
 
# define srv_use_adaptive_hash_indexes          FALSE
 
760
# define srv_use_native_aio                     FALSE
646
761
# define srv_force_recovery                     0UL
647
762
# define srv_set_io_thread_op_info(t,info)      ((void) 0)
648
763
# define srv_is_being_started                   0