~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-10-23 00:05:28 UTC
  • Revision ID: monty@inaugust.com-20081023000528-grdvrd8c4058nutm
Moved my_handler to myisam, which is where it actually belongs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
 
Copyright (c) 2008, 2009, Google Inc.
5
 
 
6
 
Portions of this file contain modifications contributed and copyrighted by
7
 
Google, Inc. Those modifications are gratefully acknowledged and are described
8
 
briefly in the InnoDB documentation. The contributions by Google are
9
 
incorporated with their permission, and subject to the conditions contained in
10
 
the file COPYING.Google.
11
 
 
12
 
This program is free software; you can redistribute it and/or modify it under
13
 
the terms of the GNU General Public License as published by the Free Software
14
 
Foundation; version 2 of the License.
15
 
 
16
 
This program is distributed in the hope that it will be useful, but WITHOUT
17
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
 
 
20
 
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22
 
Place, Suite 330, Boston, MA 02111-1307 USA
23
 
 
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
 
***********************************************************************/
51
 
 
52
 
/**************************************************//**
53
 
@file include/srv0srv.h
54
 
The server main program
55
 
 
56
 
Created 10/10/1995 Heikki Tuuri
57
 
*******************************************************/
58
 
 
59
 
#ifndef srv0srv_h
60
 
#define srv0srv_h
61
 
 
62
 
#include "univ.i"
63
 
#ifndef UNIV_HOTBACKUP
64
 
#include "sync0sync.h"
65
 
#include "os0sync.h"
66
 
#include "que0types.h"
67
 
#include "trx0types.h"
68
 
 
69
 
extern const char*      srv_main_thread_op_info;
70
 
 
71
 
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
72
 
extern const char       srv_mysql50_table_name_prefix[9];
73
 
 
74
 
/* When this event is set the lock timeout and InnoDB monitor
75
 
thread starts running */
76
 
extern os_event_t       srv_lock_timeout_thread_event;
77
 
 
78
 
/* If the last data file is auto-extended, we add this many pages to it
79
 
at a time */
80
 
#define SRV_AUTO_EXTEND_INCREMENT       \
81
 
        (srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
82
 
 
83
 
/* This is set to TRUE if the MySQL user has set it in MySQL */
84
 
extern ibool    srv_lower_case_table_names;
85
 
 
86
 
/* Mutex for locking srv_monitor_file */
87
 
extern mutex_t  srv_monitor_file_mutex;
88
 
/* Temporary file for innodb monitor output */
89
 
extern FILE*    srv_monitor_file;
90
 
/* Mutex for locking srv_dict_tmpfile.
91
 
This mutex has a very high rank; threads reserving it should not
92
 
be holding any InnoDB latches. */
93
 
extern mutex_t  srv_dict_tmpfile_mutex;
94
 
/* Temporary file for output from the data dictionary */
95
 
extern FILE*    srv_dict_tmpfile;
96
 
/* Mutex for locking srv_misc_tmpfile.
97
 
This mutex has a very low rank; threads reserving it should not
98
 
acquire any further latches or sleep before releasing this one. */
99
 
extern mutex_t  srv_misc_tmpfile_mutex;
100
 
/* Temporary file for miscellanous diagnostic output */
101
 
extern FILE*    srv_misc_tmpfile;
102
 
 
103
 
/* Server parameters which are read from the initfile */
104
 
 
105
 
extern char*    srv_data_home;
106
 
#ifdef UNIV_LOG_ARCHIVE
107
 
extern char*    srv_arch_dir;
108
 
#endif /* UNIV_LOG_ARCHIVE */
109
 
 
110
 
/** store to its own file each table created by an user; data
111
 
dictionary tables are in the system tablespace 0 */
112
 
#ifndef UNIV_HOTBACKUP
113
 
extern my_bool  srv_file_per_table;
114
 
#else
115
 
extern ibool    srv_file_per_table;
116
 
#endif /* UNIV_HOTBACKUP */
117
 
/** The file format to use on new *.ibd files. */
118
 
extern ulint    srv_file_format;
119
 
/** Whether to check file format during startup.  A value of
120
 
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE.  The default is to
121
 
set it to the highest format we support. */
122
 
extern ulint    srv_check_file_format_at_startup;
123
 
/** Place locks to records only i.e. do not use next-key locking except
124
 
on duplicate key checking and foreign key checking */
125
 
extern ibool    srv_locks_unsafe_for_binlog;
126
 
#endif /* !UNIV_HOTBACKUP */
127
 
 
128
 
extern ulint    srv_n_data_files;
129
 
extern char**   srv_data_file_names;
130
 
extern ulint*   srv_data_file_sizes;
131
 
extern ulint*   srv_data_file_is_raw_partition;
132
 
 
133
 
extern ibool    srv_auto_extend_last_data_file;
134
 
extern ulint    srv_last_file_size_max;
135
 
extern char**   srv_log_group_home_dirs;
136
 
#ifndef UNIV_HOTBACKUP
137
 
extern unsigned int srv_auto_extend_increment;
138
 
 
139
 
extern ibool    srv_created_new_raw;
140
 
 
141
 
extern ulint    srv_n_log_groups;
142
 
extern ulint    srv_n_log_files;
143
 
extern ulint    srv_log_file_size;
144
 
extern ulint    srv_log_buffer_size;
145
 
extern ulong    srv_flush_log_at_trx_commit;
146
 
extern bool     srv_adaptive_flushing;
147
 
 
148
 
 
149
 
/* The sort order table of the MySQL latin1_swedish_ci character set
150
 
collation */
151
 
#if defined(BUILD_DRIZZLE)
152
 
extern const byte  srv_latin1_ordering[256];
153
 
extern bool     srv_use_sys_malloc;
154
 
#else
155
 
extern const byte*     srv_latin1_ordering;
156
 
# ifndef UNIV_HOTBACKUP
157
 
extern my_bool srv_use_sys_malloc;
158
 
# else
159
 
extern ibool   srv_use_sys_malloc;
160
 
# endif /* UNIV_HOTBACKUP */
161
 
#endif /* BUILD_DRIZZLE */
162
 
extern ulint    srv_buf_pool_size;      /*!< requested size in bytes */
163
 
extern ulint    srv_buf_pool_old_size;  /*!< previously requested size */
164
 
extern ulint    srv_buf_pool_curr_size; /*!< current size in bytes */
165
 
extern ulint    srv_mem_pool_size;
166
 
extern ulint    srv_lock_table_size;
167
 
 
168
 
extern ulint    srv_n_file_io_threads;
169
 
extern ulong    srv_read_ahead_threshold;
170
 
extern ulint    srv_n_read_io_threads;
171
 
extern ulint    srv_n_write_io_threads;
172
 
 
173
 
/* Number of IO operations per second the server can do */
174
 
extern ulong    srv_io_capacity;
175
 
/* Returns the number of IO operations that is X percent of the
176
 
capacity. PCT_IO(5) -> returns the number of IO operations that
177
 
is 5% of the max where max is srv_io_capacity.  */
178
 
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
179
 
 
180
 
#ifdef UNIV_LOG_ARCHIVE
181
 
extern ibool    srv_log_archive_on;
182
 
extern ibool    srv_archive_recovery;
183
 
extern dulint   srv_archive_recovery_limit_lsn;
184
 
#endif /* UNIV_LOG_ARCHIVE */
185
 
 
186
 
extern char*    srv_file_flush_method_str;
187
 
extern ulint    srv_unix_file_flush_method;
188
 
extern ulint    srv_win_file_flush_method;
189
 
 
190
 
extern ulint    srv_max_n_open_files;
191
 
 
192
 
extern ulint    srv_max_dirty_pages_pct;
193
 
 
194
 
extern ulint    srv_force_recovery;
195
 
extern ulong    srv_thread_concurrency;
196
 
 
197
 
extern ulint    srv_max_n_threads;
198
 
 
199
 
extern lint     srv_conc_n_threads;
200
 
 
201
 
extern ulint    srv_fast_shutdown;       /* If this is 1, do not do a
202
 
                                         purge and index buffer merge.
203
 
                                         If this 2, do not even flush the
204
 
                                         buffer pool to data files at the
205
 
                                         shutdown: we effectively 'crash'
206
 
                                         InnoDB (but lose no committed
207
 
                                         transactions). */
208
 
extern ibool    srv_innodb_status;
209
 
 
210
 
extern ib_uint64_t      srv_stats_sample_pages;
211
 
 
212
 
extern ibool    srv_use_doublewrite_buf;
213
 
extern ibool    srv_use_checksums;
214
 
 
215
 
extern ulong    srv_max_buf_pool_modified_pct;
216
 
extern ulong    srv_max_purge_lag;
217
 
 
218
 
extern ulong    srv_replication_delay;
219
 
/*-------------------------------------------*/
220
 
 
221
 
extern ulint    srv_n_rows_inserted;
222
 
extern ulint    srv_n_rows_updated;
223
 
extern ulint    srv_n_rows_deleted;
224
 
extern ulint    srv_n_rows_read;
225
 
 
226
 
extern ibool    srv_print_innodb_monitor;
227
 
extern ibool    srv_print_innodb_lock_monitor;
228
 
extern ibool    srv_print_innodb_tablespace_monitor;
229
 
extern ibool    srv_print_verbose_log;
230
 
extern ibool    srv_print_innodb_table_monitor;
231
 
 
232
 
extern ibool    srv_lock_timeout_and_monitor_active;
233
 
extern ibool    srv_error_monitor_active;
234
 
 
235
 
extern ulong    srv_n_spin_wait_rounds;
236
 
extern ulong    srv_n_free_tickets_to_enter;
237
 
extern ulong    srv_thread_sleep_delay;
238
 
extern ulong    srv_spin_wait_delay;
239
 
extern ibool    srv_priority_boost;
240
 
 
241
 
 
242
 
#ifdef UNIV_DEBUG
243
 
extern  ibool   srv_print_thread_releases;
244
 
extern  ibool   srv_print_lock_waits;
245
 
extern  ibool   srv_print_buf_io;
246
 
extern  ibool   srv_print_log_io;
247
 
extern  ibool   srv_print_latch_waits;
248
 
#else /* UNIV_DEBUG */
249
 
# define srv_print_thread_releases      FALSE
250
 
# define srv_print_lock_waits           FALSE
251
 
# define srv_print_buf_io               FALSE
252
 
# define srv_print_log_io               FALSE
253
 
# define srv_print_latch_waits          FALSE
254
 
#endif /* UNIV_DEBUG */
255
 
 
256
 
extern ulint    srv_activity_count;
257
 
extern ulint    srv_fatal_semaphore_wait_threshold;
258
 
extern ulint    srv_dml_needed_delay;
259
 
 
260
 
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
261
 
                                query threads, and lock table: we allocate
262
 
                                it from dynamic memory to get it to the
263
 
                                same DRAM page as other hotspot semaphores */
264
 
#define kernel_mutex (*kernel_mutex_temp)
265
 
 
266
 
#define SRV_MAX_N_IO_THREADS    130
267
 
 
268
 
/* Array of English strings describing the current state of an
269
 
i/o handler thread */
270
 
extern const char* srv_io_thread_op_info[];
271
 
extern const char* srv_io_thread_function[];
272
 
 
273
 
/* the number of the log write requests done */
274
 
extern ulint srv_log_write_requests;
275
 
 
276
 
/* the number of physical writes to the log performed */
277
 
extern ulint srv_log_writes;
278
 
 
279
 
/* amount of data written to the log files in bytes */
280
 
extern ulint srv_os_log_written;
281
 
 
282
 
/* amount of writes being done to the log files */
283
 
extern ulint srv_os_log_pending_writes;
284
 
 
285
 
/* we increase this counter, when there we don't have enough space in the
286
 
log buffer and have to flush it */
287
 
extern ulint srv_log_waits;
288
 
 
289
 
/* variable that counts amount of data read in total (in bytes) */
290
 
extern ulint srv_data_read;
291
 
 
292
 
/* here we count the amount of data written in total (in bytes) */
293
 
extern ulint srv_data_written;
294
 
 
295
 
/* this variable counts the amount of times, when the doublewrite buffer
296
 
was flushed */
297
 
extern ulint srv_dblwr_writes;
298
 
 
299
 
/* here we store the number of pages that have been flushed to the
300
 
doublewrite buffer */
301
 
extern ulint srv_dblwr_pages_written;
302
 
 
303
 
/* in this variable we store the number of write requests issued */
304
 
extern ulint srv_buf_pool_write_requests;
305
 
 
306
 
/* here we store the number of times when we had to wait for a free page
307
 
in the buffer pool. It happens when the buffer pool is full and we need
308
 
to make a flush, in order to be able to read or create a page. */
309
 
extern ulint srv_buf_pool_wait_free;
310
 
 
311
 
/* variable to count the number of pages that were written from the
312
 
buffer pool to disk */
313
 
extern ulint srv_buf_pool_flushed;
314
 
 
315
 
/** Number of buffer pool reads that led to the
316
 
reading of a disk page */
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;
322
 
 
323
 
/** Status variables to be passed to MySQL */
324
 
typedef struct export_var_struct export_struc;
325
 
 
326
 
/** Status variables to be passed to MySQL */
327
 
extern export_struc export_vars;
328
 
 
329
 
/** The server system */
330
 
typedef struct srv_sys_struct   srv_sys_t;
331
 
 
332
 
/** The server system */
333
 
extern srv_sys_t*       srv_sys;
334
 
#endif /* !UNIV_HOTBACKUP */
335
 
 
336
 
/** Types of raw partitions in innodb_data_file_path */
337
 
enum {
338
 
        SRV_NOT_RAW = 0,        /*!< Not a raw partition */
339
 
        SRV_NEW_RAW,            /*!< A 'newraw' partition, only to be
340
 
                                initialized */
341
 
        SRV_OLD_RAW             /*!< An initialized raw partition */
342
 
};
343
 
 
344
 
/** Alternatives for the file flush option in Unix; see the InnoDB manual
345
 
about what these mean */
346
 
enum {
347
 
        SRV_UNIX_FSYNC = 1,     /*!< fsync, the default */
348
 
        SRV_UNIX_O_DSYNC,       /*!< open log files in O_SYNC mode */
349
 
        SRV_UNIX_LITTLESYNC,    /*!< do not call os_file_flush()
350
 
                                when writing data files, but do flush
351
 
                                after writing to log files */
352
 
        SRV_UNIX_NOSYNC,        /*!< do not flush after writing */
353
 
        SRV_UNIX_O_DIRECT       /*!< invoke os_file_set_nocache() on
354
 
                                data files */
355
 
};
356
 
 
357
 
/** Alternatives for file i/o in Windows */
358
 
enum {
359
 
        SRV_WIN_IO_NORMAL = 1,  /*!< buffered I/O */
360
 
        SRV_WIN_IO_UNBUFFERED   /*!< unbuffered I/O; this is the default */
361
 
};
362
 
 
363
 
/** Alternatives for srv_force_recovery. Non-zero values are intended
364
 
to help the user get a damaged database up so that he can dump intact
365
 
tables and rows with SELECT INTO OUTFILE. The database must not otherwise
366
 
be used with these options! A bigger number below means that all precautions
367
 
of lower numbers are included. */
368
 
enum {
369
 
        SRV_FORCE_IGNORE_CORRUPT = 1,   /*!< let the server run even if it
370
 
                                        detects a corrupt page */
371
 
        SRV_FORCE_NO_BACKGROUND = 2,    /*!< prevent the main thread from
372
 
                                        running: if a crash would occur
373
 
                                        in purge, this prevents it */
374
 
        SRV_FORCE_NO_TRX_UNDO = 3,      /*!< do not run trx rollback after
375
 
                                        recovery */
376
 
        SRV_FORCE_NO_IBUF_MERGE = 4,    /*!< prevent also ibuf operations:
377
 
                                        if they would cause a crash, better
378
 
                                        not do them */
379
 
        SRV_FORCE_NO_UNDO_LOG_SCAN = 5, /*!< do not look at undo logs when
380
 
                                        starting the database: InnoDB will
381
 
                                        treat even incomplete transactions
382
 
                                        as committed */
383
 
        SRV_FORCE_NO_LOG_REDO = 6       /*!< do not do the log roll-forward
384
 
                                        in connection with recovery */
385
 
};
386
 
 
387
 
#ifndef UNIV_HOTBACKUP
388
 
/** Types of threads existing in the system. */
389
 
enum srv_thread_type {
390
 
        SRV_COM = 1,    /**< threads serving communication and queries */
391
 
        SRV_CONSOLE,    /**< thread serving console */
392
 
        SRV_WORKER,     /**< threads serving parallelized queries and
393
 
                        queries released from lock wait */
394
 
#if 0
395
 
        /* Utility threads */
396
 
        SRV_BUFFER,     /**< thread flushing dirty buffer blocks */
397
 
        SRV_RECOVERY,   /**< threads finishing a recovery */
398
 
        SRV_INSERT,     /**< thread flushing the insert buffer to disk */
399
 
#endif
400
 
        SRV_MASTER      /**< the master thread, (whose type number must
401
 
                        be biggest) */
402
 
};
403
 
 
404
 
/*********************************************************************//**
405
 
Boots Innobase server.
406
 
@return DB_SUCCESS or error code */
407
 
UNIV_INTERN
408
 
ulint
409
 
srv_boot(void);
410
 
/*==========*/
411
 
/*********************************************************************//**
412
 
Initializes the server. */
413
 
UNIV_INTERN
414
 
void
415
 
srv_init(void);
416
 
/*==========*/
417
 
/*********************************************************************//**
418
 
Frees the OS fast mutex created in srv_boot(). */
419
 
UNIV_INTERN
420
 
void
421
 
srv_free(void);
422
 
/*==========*/
423
 
/*********************************************************************//**
424
 
Initializes the synchronization primitives, memory system, and the thread
425
 
local storage. */
426
 
UNIV_INTERN
427
 
void
428
 
srv_general_init(void);
429
 
/*==================*/
430
 
/*********************************************************************//**
431
 
Gets the number of threads in the system.
432
 
@return sum of srv_n_threads[] */
433
 
UNIV_INTERN
434
 
ulint
435
 
srv_get_n_threads(void);
436
 
/*===================*/
437
 
/*********************************************************************//**
438
 
Returns the calling thread type.
439
 
@return SRV_COM, ... */
440
 
 
441
 
enum srv_thread_type
442
 
srv_get_thread_type(void);
443
 
/*=====================*/
444
 
/*********************************************************************//**
445
 
Sets the info describing an i/o thread current state. */
446
 
UNIV_INTERN
447
 
void
448
 
srv_set_io_thread_op_info(
449
 
/*======================*/
450
 
        ulint           i,      /*!< in: the 'segment' of the i/o thread */
451
 
        const char*     str);   /*!< in: constant char string describing the
452
 
                                state */
453
 
/*********************************************************************//**
454
 
Releases threads of the type given from suspension in the thread table.
455
 
NOTE! The server mutex has to be reserved by the caller!
456
 
@return number of threads released: this may be less than n if not
457
 
enough threads were suspended at the moment */
458
 
UNIV_INTERN
459
 
ulint
460
 
srv_release_threads(
461
 
/*================*/
462
 
        enum srv_thread_type    type,   /*!< in: thread type */
463
 
        ulint                   n);     /*!< in: number of threads to release */
464
 
/*********************************************************************//**
465
 
The master thread controlling the server.
466
 
@return a dummy parameter */
467
 
UNIV_INTERN
468
 
os_thread_ret_t
469
 
srv_master_thread(
470
 
/*==============*/
471
 
        void*   arg);   /*!< in: a dummy parameter required by
472
 
                        os_thread_create */
473
 
/*******************************************************************//**
474
 
Tells the Innobase server that there has been activity in the database
475
 
and wakes up the master thread if it is suspended (not sleeping). Used
476
 
in the MySQL interface. Note that there is a small chance that the master
477
 
thread stays suspended (we do not protect our operation with the kernel
478
 
mutex, for performace reasons). */
479
 
UNIV_INTERN
480
 
void
481
 
srv_active_wake_master_thread(void);
482
 
/*===============================*/
483
 
/*******************************************************************//**
484
 
Wakes up the master thread if it is suspended or being suspended. */
485
 
UNIV_INTERN
486
 
void
487
 
srv_wake_master_thread(void);
488
 
/*========================*/
489
 
/*********************************************************************//**
490
 
Puts an OS thread to wait if there are too many concurrent threads
491
 
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
492
 
UNIV_INTERN
493
 
void
494
 
srv_conc_enter_innodb(
495
 
/*==================*/
496
 
        trx_t*  trx);   /*!< in: transaction object associated with the
497
 
                        thread */
498
 
/*********************************************************************//**
499
 
This lets a thread enter InnoDB regardless of the number of threads inside
500
 
InnoDB. This must be called when a thread ends a lock wait. */
501
 
UNIV_INTERN
502
 
void
503
 
srv_conc_force_enter_innodb(
504
 
/*========================*/
505
 
        trx_t*  trx);   /*!< in: transaction object associated with the
506
 
                        thread */
507
 
/*********************************************************************//**
508
 
This must be called when a thread exits InnoDB in a lock wait or at the
509
 
end of an SQL statement. */
510
 
UNIV_INTERN
511
 
void
512
 
srv_conc_force_exit_innodb(
513
 
/*=======================*/
514
 
        trx_t*  trx);   /*!< in: transaction object associated with the
515
 
                        thread */
516
 
/*********************************************************************//**
517
 
This must be called when a thread exits InnoDB. */
518
 
UNIV_INTERN
519
 
void
520
 
srv_conc_exit_innodb(
521
 
/*=================*/
522
 
        trx_t*  trx);   /*!< in: transaction object associated with the
523
 
                        thread */
524
 
/***************************************************************//**
525
 
Puts a MySQL OS thread to wait for a lock to be released. If an error
526
 
occurs during the wait trx->error_state associated with thr is
527
 
!= DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK
528
 
are possible errors. DB_DEADLOCK is returned if selective deadlock
529
 
resolution chose this transaction as a victim. */
530
 
UNIV_INTERN
531
 
void
532
 
srv_suspend_mysql_thread(
533
 
/*=====================*/
534
 
        que_thr_t*      thr);   /*!< in: query thread associated with the MySQL
535
 
                                OS thread */
536
 
/********************************************************************//**
537
 
Releases a MySQL OS thread waiting for a lock to be released, if the
538
 
thread is already suspended. */
539
 
UNIV_INTERN
540
 
void
541
 
srv_release_mysql_thread_if_suspended(
542
 
/*==================================*/
543
 
        que_thr_t*      thr);   /*!< in: query thread associated with the
544
 
                                MySQL OS thread  */
545
 
/*********************************************************************//**
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.
548
 
@return a dummy parameter */
549
 
UNIV_INTERN
550
 
os_thread_ret_t
551
 
srv_lock_timeout_and_monitor_thread(
552
 
/*================================*/
553
 
        void*   arg);   /*!< in: a dummy parameter required by
554
 
                        os_thread_create */
555
 
/*********************************************************************//**
556
 
A thread which prints warnings about semaphore waits which have lasted
557
 
too long. These can be used to track bugs which cause hangs.
558
 
@return a dummy parameter */
559
 
UNIV_INTERN
560
 
os_thread_ret_t
561
 
srv_error_monitor_thread(
562
 
/*=====================*/
563
 
        void*   arg);   /*!< in: a dummy parameter required by
564
 
                        os_thread_create */
565
 
/******************************************************************//**
566
 
Outputs to a file the output of the InnoDB Monitor. */
567
 
UNIV_INTERN
568
 
void
569
 
srv_printf_innodb_monitor(
570
 
/*======================*/
571
 
        FILE*   file,           /*!< in: output stream */
572
 
        ulint*  trx_start,      /*!< out: file position of the start of
573
 
                                the list of active transactions */
574
 
        ulint*  trx_end);       /*!< out: file position of the end of
575
 
                                the list of active transactions */
576
 
 
577
 
/******************************************************************//**
578
 
Function to pass InnoDB status variables to MySQL */
579
 
UNIV_INTERN
580
 
void
581
 
srv_export_innodb_status(void);
582
 
/*==========================*/
583
 
 
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;
589
 
 
590
 
/** Status variables to be passed to MySQL */
591
 
struct export_var_struct{
592
 
        ulint innodb_data_pending_reads;        /*!< Pending reads */
593
 
        ulint innodb_data_pending_writes;       /*!< Pending writes */
594
 
        ulint innodb_data_pending_fsyncs;       /*!< Pending fsyncs */
595
 
        ulint innodb_data_fsyncs;               /*!< Number of fsyncs so far */
596
 
        ulint innodb_data_read;                 /*!< Data bytes read */
597
 
        ulint innodb_data_writes;               /*!< I/O write requests */
598
 
        ulint innodb_data_written;              /*!< Data bytes written */
599
 
        ulint innodb_data_reads;                /*!< I/O read requests */
600
 
        ulint innodb_buffer_pool_pages_total;   /*!< Buffer pool size */
601
 
        ulint innodb_buffer_pool_pages_data;    /*!< Data pages */
602
 
        ulint innodb_buffer_pool_pages_dirty;   /*!< Dirty data pages */
603
 
        ulint innodb_buffer_pool_pages_misc;    /*!< Miscellanous pages */
604
 
        ulint innodb_buffer_pool_pages_free;    /*!< Free pages */
605
 
#ifdef UNIV_DEBUG
606
 
        ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
607
 
#endif /* UNIV_DEBUG */
608
 
        ulint innodb_buffer_pool_read_requests; /*!< buf_pool->n_page_gets */
609
 
        ulint innodb_buffer_pool_reads;         /*!< srv_buf_pool_reads */
610
 
        ulint innodb_buffer_pool_wait_free;     /*!< srv_buf_pool_wait_free */
611
 
        ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
612
 
        ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
613
 
        ulint innodb_buffer_pool_read_ahead_seq;/*!< srv_read_ahead_seq */
614
 
        ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
615
 
        ulint innodb_dblwr_pages_written;       /*!< srv_dblwr_pages_written */
616
 
        ulint innodb_dblwr_writes;              /*!< srv_dblwr_writes */
617
 
        ibool innodb_have_atomic_builtins;      /*!< HAVE_ATOMIC_BUILTINS */
618
 
        ulint innodb_log_waits;                 /*!< srv_log_waits */
619
 
        ulint innodb_log_write_requests;        /*!< srv_log_write_requests */
620
 
        ulint innodb_log_writes;                /*!< srv_log_writes */
621
 
        ulint innodb_os_log_written;            /*!< srv_os_log_written */
622
 
        ulint innodb_os_log_fsyncs;             /*!< fil_n_log_flushes */
623
 
        ulint innodb_os_log_pending_writes;     /*!< srv_os_log_pending_writes */
624
 
        ulint innodb_os_log_pending_fsyncs;     /*!< fil_n_pending_log_flushes */
625
 
        ulint innodb_page_size;                 /*!< UNIV_PAGE_SIZE */
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 */
629
 
        ulint innodb_row_lock_waits;            /*!< srv_n_lock_wait_count */
630
 
        ulint innodb_row_lock_current_waits;    /*!< srv_n_lock_wait_current_count */
631
 
        ib_int64_t innodb_row_lock_time;        /*!< srv_n_lock_wait_time
632
 
                                                / 1000 */
633
 
        ulint innodb_row_lock_time_avg;         /*!< srv_n_lock_wait_time
634
 
                                                / 1000
635
 
                                                / srv_n_lock_wait_count */
636
 
        ulint innodb_row_lock_time_max;         /*!< srv_n_lock_max_wait_time
637
 
                                                / 1000 */
638
 
        ulint innodb_rows_read;                 /*!< srv_n_rows_read */
639
 
        ulint innodb_rows_inserted;             /*!< srv_n_rows_inserted */
640
 
        ulint innodb_rows_updated;              /*!< srv_n_rows_updated */
641
 
        ulint innodb_rows_deleted;              /*!< srv_n_rows_deleted */
642
 
};
643
 
 
644
 
/** The server system struct */
645
 
struct srv_sys_struct{
646
 
        srv_table_t*    threads;        /*!< server thread table */
647
 
        UT_LIST_BASE_NODE_T(que_thr_t)
648
 
                        tasks;          /*!< task queue */
649
 
};
650
 
 
651
 
extern ulint    srv_n_threads_active[];
652
 
 
653
 
#else /* !UNIV_HOTBACKUP */
654
 
# define srv_use_checksums                      TRUE
655
 
# define srv_use_adaptive_hash_indexes          FALSE
656
 
# define srv_force_recovery                     0UL
657
 
# define srv_set_io_thread_op_info(t,info)      ((void) 0)
658
 
# define srv_is_being_started                   0
659
 
# define srv_win_file_flush_method              SRV_WIN_IO_UNBUFFERED
660
 
# define srv_unix_file_flush_method             SRV_UNIX_O_DSYNC
661
 
# define srv_start_raw_disk_in_use              0
662
 
# define srv_file_per_table                     1
663
 
#endif /* !UNIV_HOTBACKUP */
664
 
 
665
 
 
666
 
#endif