MySQL  8.0.12
Source Code Documentation
srv0srv.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39  The lines above are intentionally left blank
40 */
41 
42 /** @file include/srv0srv.h
43  The server main program
44 
45  Created 10/10/1995 Heikki Tuuri
46  *******************************************************/
47 
48 #ifndef srv0srv_h
49 #define srv0srv_h
50 
51 #include "buf0checksum.h"
52 #include "fil0fil.h"
53 #include "log0types.h"
54 #include "mysql/psi/mysql_stage.h"
55 #include "univ.i"
56 
57 #ifndef UNIV_HOTBACKUP
58 #include "log0ddl.h"
59 #include "os0event.h"
60 #include "os0file.h"
61 #include "que0types.h"
62 #include "srv0conc.h"
63 #include "trx0types.h"
64 #include "ut0counter.h"
65 
66 /* Global counters used inside InnoDB. */
67 struct srv_stats_t {
73 
74  /** Count the amount of data written in total (in bytes) */
75  ulint_ctr_1_t data_written;
76 
77  /** Number of the log write requests done */
78  ulint_ctr_1_t log_write_requests;
79 
80  /** Number of physical writes to the log performed */
81  ulint_ctr_1_t log_writes;
82 
83  /** Amount of data written to the log files in bytes */
84  lsn_ctr_1_t os_log_written;
85 
86  /** Number of writes being done to the log files */
87  lint_ctr_1_t os_log_pending_writes;
88 
89  /** We increase this counter, when we don't have enough
90  space in the log buffer and have to flush it */
91  ulint_ctr_1_t log_waits;
92 
93  /** Count the number of times the doublewrite buffer was flushed */
94  ulint_ctr_1_t dblwr_writes;
95 
96  /** Store the number of pages that have been flushed to the
97  doublewrite buffer */
98  ulint_ctr_1_t dblwr_pages_written;
99 
100  /** Store the number of write requests issued */
101  ulint_ctr_1_t buf_pool_write_requests;
102 
103  /** Store the number of times when we had to wait for a free page
104  in the buffer pool. It happens when the buffer pool is full and we
105  need to make a flush, in order to be able to read or create a page. */
106  ulint_ctr_1_t buf_pool_wait_free;
107 
108  /** Count the number of pages that were written from buffer
109  pool to the disk */
110  ulint_ctr_1_t buf_pool_flushed;
111 
112  /** Number of buffer pool reads that led to the reading of
113  a disk page */
114  ulint_ctr_1_t buf_pool_reads;
115 
116  /** Number of data read in total (in bytes) */
117  ulint_ctr_1_t data_read;
118 
119  /** Wait time of database locks */
120  int64_ctr_1_t n_lock_wait_time;
121 
122  /** Number of database lock waits */
123  ulint_ctr_1_t n_lock_wait_count;
124 
125  /** Number of threads currently waiting on database locks */
127 
128  /** Number of rows read. */
129  ulint_ctr_64_t n_rows_read;
130 
131  /** Number of rows updated */
132  ulint_ctr_64_t n_rows_updated;
133 
134  /** Number of rows deleted */
135  ulint_ctr_64_t n_rows_deleted;
136 
137  /** Number of rows inserted */
138  ulint_ctr_64_t n_rows_inserted;
139 };
140 
141 struct Srv_threads {
142  /** true if monitor thread is created */
144 
145  /** true if error monitor thread is created */
147 
148  /** true if buffer pool dump/load thread is created */
150 
151  /** true if buffer pool resize thread is created */
153 
154  /** true if stats thread is created */
156 
157  /** true if timeout thread is created */
159 
160  /** true if master thread is created */
162 };
163 
165  int n_cpu;
166  double utime_abs;
167  double stime_abs;
168  double utime_pct;
169  double stime_pct;
170 };
171 
172 /** Structure with state of srv background threads. */
173 extern Srv_threads srv_threads;
174 
175 /** Structure with cpu usage information. */
177 
178 extern Log_DDL *log_ddl;
179 
180 #ifdef INNODB_DD_TABLE
181 extern bool srv_is_upgrade_mode;
182 extern bool srv_downgrade_logs;
183 extern bool srv_upgrade_old_undo_found;
184 #endif /* INNODB_DD_TABLE */
185 
186 extern const char *srv_main_thread_op_info;
187 
188 /* The monitor thread waits on this event. */
190 
191 /* The error monitor thread waits on this event. */
193 
194 /** The buffer pool dump/load thread waits on this event. */
196 
197 /** The buffer pool resize thread waits on this event. */
199 #endif /* !UNIV_HOTBACKUP */
200 
201 /** The buffer pool dump/load file name */
202 #define SRV_BUF_DUMP_FILENAME_DEFAULT "ib_buffer_pool"
203 extern char *srv_buf_dump_filename;
204 
205 /** Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown
206 and/or load it during startup. */
209 
210 /* Whether to disable file system cache if it is defined */
211 extern bool srv_disable_sort_file_cache;
212 
213 /* If the last data file is auto-extended, we add this many pages to it
214 at a time */
215 #define SRV_AUTO_EXTEND_INCREMENT (srv_sys_space.get_autoextend_increment())
216 
217 #ifndef UNIV_HOTBACKUP
218 /** Mutex protecting page_zip_stat_per_index */
219 extern ib_mutex_t page_zip_stat_per_index_mutex;
220 /* Mutex for locking srv_monitor_file. Not created if srv_read_only_mode */
221 extern ib_mutex_t srv_monitor_file_mutex;
222 /* Temporary file for innodb monitor output */
223 extern FILE *srv_monitor_file;
224 /* Mutex for locking srv_dict_tmpfile. Only created if !srv_read_only_mode.
225 This mutex has a very high rank; threads reserving it should not
226 be holding any InnoDB latches. */
227 extern ib_mutex_t srv_dict_tmpfile_mutex;
228 /* Temporary file for output from the data dictionary */
229 extern FILE *srv_dict_tmpfile;
230 /* Mutex for locking srv_misc_tmpfile. Only created if !srv_read_only_mode.
231 This mutex has a very low rank; threads reserving it should not
232 acquire any further latches or sleep before releasing this one. */
233 extern ib_mutex_t srv_misc_tmpfile_mutex;
234 /* Temporary file for miscellanous diagnostic output */
235 extern FILE *srv_misc_tmpfile;
236 #endif /* !UNIV_HOTBACKUP */
237 
238 /* Server parameters which are read from the initfile */
239 
240 extern char *srv_data_home;
241 
242 /** Set if InnoDB must operate in read-only mode. We don't do any
243 recovery and open all tables in RO mode instead of RW mode. We don't
244 sync the max trx id to disk either. */
245 extern bool srv_read_only_mode;
246 /** Set if InnoDB operates in read-only mode or innodb-force-recovery
247 is greater than SRV_FORCE_NO_TRX_UNDO. */
248 extern bool high_level_read_only;
249 /** store to its own file each table created by an user; data
250 dictionary tables are in the system tablespace 0 */
251 extern bool srv_file_per_table;
252 /** Sleep delay for threads waiting to enter InnoDB. In micro-seconds. */
253 extern ulong srv_thread_sleep_delay;
254 /** Maximum sleep delay (in micro-seconds), value of 0 disables it.*/
255 extern ulong srv_adaptive_max_sleep_delay;
256 
257 /** Sort buffer size in index creation */
258 extern ulong srv_sort_buf_size;
259 
260 /** Maximum modification log file size for online index creation */
261 extern unsigned long long srv_online_max_size;
262 
263 /* If this flag is TRUE, then we will use the native aio of the
264 OS (provided we compiled Innobase with it in), otherwise we will
265 use simulated aio we build below with threads.
266 Currently we support native aio on windows and linux */
267 extern bool srv_use_native_aio;
268 extern bool srv_numa_interleave;
269 
270 /** Server undo tablespaces directory, can be absolute path. */
271 extern char *srv_undo_dir;
272 
273 /** Number of undo tablespaces to use. */
274 extern ulong srv_undo_tablespaces;
275 
276 /** The number of rollback segments per tablespace */
277 extern ulong srv_rollback_segments;
278 
279 /** Maximum size of undo tablespace. */
280 extern unsigned long long srv_max_undo_tablespace_size;
281 
282 /** Rate at which UNDO records should be purged. */
284 
285 /** Enable or Disable Truncate of UNDO tablespace. */
286 extern bool srv_undo_log_truncate;
287 
288 /** Enable or disable Encrypt of UNDO tablespace. */
289 extern bool srv_undo_log_encrypt;
290 
291 /** Default size of UNDO tablespace while it is created new. */
293 
294 extern char *srv_log_group_home_dir;
295 
296 /** Enable or Disable Encrypt of REDO tablespace. */
297 extern bool srv_redo_log_encrypt;
298 
299 /** Maximum number of srv_n_log_files, or innodb_log_files_in_group */
300 #define SRV_N_LOG_FILES_MAX 100
301 extern ulong srv_n_log_files;
302 
303 /** At startup, this is the current redo log file size.
304 During startup, if this is different from srv_log_file_size_requested
305 (innodb_log_file_size), the redo log will be rebuilt and this size
306 will be initialized to srv_log_file_size_requested.
307 When upgrading from a previous redo log format, this will be set to 0,
308 and writing to the redo log is not allowed.
309 
310 During startup, this is in bytes, and later converted to pages. */
312 
313 /** The value of the startup parameter innodb_log_file_size. */
315 
316 /** Space for log buffer, expressed in bytes. Note, that log buffer
317 will use only the largest power of two, which is not greater than
318 the assigned space. */
319 extern ulong srv_log_buffer_size;
320 
321 /** When log writer follows links in the log recent written buffer,
322 it stops when it has reached at least that many bytes to write,
323 limiting how many bytes can be written in single call. */
324 extern ulong srv_log_write_max_size;
325 
326 /** Size of block, used for writing ahead to avoid read-on-write. */
327 extern ulong srv_log_write_ahead_size;
328 
329 /** Number of events used for notifications about redo write. */
330 extern ulong srv_log_write_events;
331 
332 /** Number of events used for notifications about redo flush. */
333 extern ulong srv_log_flush_events;
334 
335 /** Number of slots in a small buffer, which is used to allow concurrent
336 writes to log buffer. The slots are addressed by LSN values modulo number
337 of the slots. */
338 extern ulong srv_log_recent_written_size;
339 
340 /** Number of slots in a small buffer, which is used to break requirement
341 for total order of dirty pages, when they are added to flush lists.
342 The slots are addressed by LSN values modulo number of the slots. */
343 extern ulong srv_log_recent_closed_size;
344 
345 /** Minimum absolute value of cpu time for which spin-delay is used. */
347 
348 /** Maximum percentage of cpu time for which spin-delay is used. */
350 
351 /** Number of spin iterations, when spinning and waiting for log buffer
352 written up to given LSN, before we fallback to loop with sleeps.
353 This is not used when user thread has to wait for log flushed to disk. */
355 
356 /** Timeout used when waiting for redo write (microseconds). */
357 extern ulong srv_log_wait_for_write_timeout;
358 
359 /** Number of spin iterations, when spinning and waiting for log flushed. */
361 
362 /** Maximum value of average log flush time for which spin-delay is used.
363 When flushing takes longer, user threads no longer spin when waiting for
364 flushed redo. Expressed in microseconds. */
366 
367 /** Timeout used when waiting for redo flush (microseconds). */
368 extern ulong srv_log_wait_for_flush_timeout;
369 
370 /** Number of spin iterations, for which log writer thread is waiting
371 for new data to write or flush without sleeping. */
372 extern ulong srv_log_writer_spin_delay;
373 
374 /** Initial timeout used to wait on writer_event. */
375 extern ulong srv_log_writer_timeout;
376 
377 /** Number of milliseconds every which a periodical checkpoint is written
378 by the log checkpointer thread (unless periodical checkpoints are disabled,
379 which is a case during initial phase of startup). */
380 extern ulong srv_log_checkpoint_every;
381 
382 /** Number of spin iterations, for which log flusher thread is waiting
383 for new data to flush, without sleeping. */
384 extern ulong srv_log_flusher_spin_delay;
385 
386 /** Initial timeout used to wait on flusher_event. */
387 extern ulong srv_log_flusher_timeout;
388 
389 /** Number of spin iterations, for which log write notifier thread is waiting
390 for advanced writeed_to_disk_lsn without sleeping. */
392 
393 /** Initial timeout used to wait on write_notifier_event. */
394 extern ulong srv_log_write_notifier_timeout;
395 
396 /** Number of spin iterations, for which log flush notifier thread is waiting
397 for advanced flushed_to_disk_lsn without sleeping. */
399 
400 /** Initial timeout used to wait on flush_notifier_event. */
401 extern ulong srv_log_flush_notifier_timeout;
402 
403 /** Number of spin iterations, for which log closerr thread is waiting
404 for a reachable untraversed link in recent_closed. */
405 extern ulong srv_log_closer_spin_delay;
406 
407 /** Initial sleep used in log closer after spin delay is finished. */
408 extern ulong srv_log_closer_timeout;
409 
410 /** Whether to generate and require checksums on the redo log pages. */
411 extern bool srv_log_checksums;
412 
413 #ifdef UNIV_DEBUG
414 
415 /** If true then disable checkpointing. */
416 extern bool srv_checkpoint_disabled;
417 
418 #endif /* UNIV_DEBUG */
419 
420 extern ulong srv_flush_log_at_trx_commit;
423 extern bool srv_adaptive_flushing;
424 extern bool srv_flush_sync;
425 
426 /* If this flag is TRUE, then we will load the indexes' (and tables') metadata
427 even if they are marked as "corrupted". Mostly it is for DBA to process
428 corrupted index and table */
429 extern bool srv_load_corrupted;
430 
431 /** Dedicated server setting */
432 extern bool srv_dedicated_server;
433 /** Requested size in bytes */
434 extern ulint srv_buf_pool_size;
435 /** Minimum pool size in bytes */
436 extern const ulint srv_buf_pool_min_size;
437 /** Default pool size in bytes */
438 extern const ulint srv_buf_pool_def_size;
439 /** Requested buffer pool chunk size. Each buffer pool instance consists
440 of one or more chunks. */
442 /** Requested number of buffer pool instances */
443 extern ulong srv_buf_pool_instances;
444 /** Default number of buffer pool instances */
445 extern const ulong srv_buf_pool_instances_default;
446 /** Number of locks to protect buf_pool->page_hash */
447 extern ulong srv_n_page_hash_locks;
448 /** Scan depth for LRU flush batch i.e.: number of blocks scanned*/
449 extern ulong srv_LRU_scan_depth;
450 /** Whether or not to flush neighbors of a block */
451 extern ulong srv_flush_neighbors;
452 /** Previously requested size. Accesses protected by memory barriers. */
453 extern ulint srv_buf_pool_old_size;
454 /** Current size as scaling factor for the other components */
455 extern ulint srv_buf_pool_base_size;
456 /** Current size in bytes */
457 extern long long srv_buf_pool_curr_size;
458 /** Dump this % of each buffer pool during BP dump */
459 extern ulong srv_buf_pool_dump_pct;
460 /** Lock table size in bytes */
461 extern ulint srv_lock_table_size;
462 
463 extern ulint srv_n_file_io_threads;
464 extern bool srv_random_read_ahead;
465 extern ulong srv_read_ahead_threshold;
466 extern ulong srv_n_read_io_threads;
467 extern ulong srv_n_write_io_threads;
468 
470 
471 /* Number of IO operations per second the server can do */
472 extern ulong srv_io_capacity;
473 
474 /* We use this dummy default value at startup for max_io_capacity.
475 The real value is set based on the value of io_capacity. */
476 #define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (~0UL)
477 #define SRV_MAX_IO_CAPACITY_LIMIT (~0UL)
478 extern ulong srv_max_io_capacity;
479 /* Returns the number of IO operations that is X percent of the
480 capacity. PCT_IO(5) -> returns the number of IO operations that
481 is 5% of the max where max is srv_io_capacity. */
482 #define PCT_IO(p) ((ulong)(srv_io_capacity * ((double)(p) / 100.0)))
483 
484 /** Maximum number of purge threads, including the purge coordinator */
485 #define MAX_PURGE_THREADS 32
486 
487 /* The "innodb_stats_method" setting, decides how InnoDB is going
488 to treat NULL value when collecting statistics. It is not defined
489 as enum type because the configure option takes unsigned integer type. */
490 extern ulong srv_innodb_stats_method;
491 
492 extern ulint srv_max_n_open_files;
493 
494 extern ulong srv_n_page_cleaners;
495 
496 extern double srv_max_dirty_pages_pct;
497 extern double srv_max_dirty_pages_pct_lwm;
498 
499 extern ulong srv_adaptive_flushing_lwm;
500 extern ulong srv_flushing_avg_loops;
501 
502 extern ulong srv_force_recovery;
503 #ifdef UNIV_DEBUG
504 extern ulong srv_force_recovery_crash;
505 #endif /* UNIV_DEBUG */
506 
507 /** The value of the configuration parameter innodb_fast_shutdown,
508 controlling the InnoDB shutdown.
509 
510 If innodb_fast_shutdown=0, InnoDB shutdown will purge all undo log
511 records (except XA PREPARE transactions) and complete the merge of the
512 entire change buffer, and then shut down the redo log.
513 
514 If innodb_fast_shutdown=1, InnoDB shutdown will only flush the buffer
515 pool to data files, cleanly shutting down the redo log.
516 
517 If innodb_fast_shutdown=2, shutdown will effectively 'crash' InnoDB
518 (but lose no committed transactions). */
519 extern ulong srv_fast_shutdown;
520 extern ibool srv_innodb_status;
521 
522 extern unsigned long long srv_stats_transient_sample_pages;
523 extern bool srv_stats_persistent;
524 extern unsigned long long srv_stats_persistent_sample_pages;
525 extern bool srv_stats_auto_recalc;
527 
528 extern ibool srv_use_doublewrite_buf;
529 extern ulong srv_doublewrite_batch_size;
530 extern ulong srv_checksum_algorithm;
531 
532 extern double srv_max_buf_pool_modified_pct;
533 extern ulong srv_max_purge_lag;
534 extern ulong srv_max_purge_lag_delay;
535 
536 extern ulong srv_replication_delay;
537 /*-------------------------------------------*/
538 
539 extern bool srv_print_innodb_monitor;
541 
542 extern ulong srv_n_spin_wait_rounds;
543 extern ulong srv_n_free_tickets_to_enter;
545 extern ulong srv_spin_wait_delay;
546 extern ibool srv_priority_boost;
547 
548 extern ulint srv_truncated_status_writes;
549 
550 #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
552 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
553 
554 #ifdef UNIV_DEBUG
555 extern bool srv_buf_pool_debug;
556 extern bool srv_sync_debug;
558 
559 /** Value of MySQL global used to disable master thread. */
561 #endif /* UNIV_DEBUG */
562 
564 #define SRV_SEMAPHORE_WAIT_EXTENSION 7200
565 extern ulint srv_dml_needed_delay;
566 
567 #ifdef UNIV_HOTBACKUP
568 // MAHI: changed from 130 to 1 assuming the apply-log is single threaded
569 #define SRV_MAX_N_IO_THREADS 1
570 #else /* UNIV_HOTBACKUP */
571 #define SRV_MAX_N_IO_THREADS 130
572 #endif /* UNIV_HOTBACKUP */
573 
574 /* Array of English strings describing the current state of an
575 i/o handler thread */
576 extern const char *srv_io_thread_op_info[];
577 extern const char *srv_io_thread_function[];
578 
579 /* the number of purge threads to use from the worker pool (currently 0 or 1) */
580 extern ulong srv_n_purge_threads;
581 
582 /* the number of pages to purge in one batch */
583 extern ulong srv_purge_batch_size;
584 
585 /* the number of sync wait arrays */
586 extern ulong srv_sync_array_size;
587 
588 /* print all user-level transactions deadlocks to mysqld stderr */
589 extern bool srv_print_all_deadlocks;
590 
591 /** Print all DDL logs to mysqld stderr */
592 extern bool srv_print_ddl_logs;
593 
594 extern bool srv_cmp_per_index_enabled;
595 
596 /** Status variables to be passed to MySQL */
597 extern struct export_var_t export_vars;
598 
599 #ifndef UNIV_HOTBACKUP
600 /** Global counters */
601 extern srv_stats_t srv_stats;
602 
603 /* Keys to register InnoDB threads with performance schema */
604 
605 #ifdef UNIV_PFS_THREAD
634 #endif /* UNIV_PFS_THREAD */
635 #endif /* !UNIV_HOTBACKUP */
636 
637 #ifdef HAVE_PSI_STAGE_INTERFACE
638 /** Performance schema stage event for monitoring ALTER TABLE progress
639 everything after flush log_make_checkpoint_at(). */
641 
642 /** Performance schema stage event for monitoring ALTER TABLE progress
643 log_make_checkpoint_at(). */
645 
646 /** Performance schema stage event for monitoring ALTER TABLE progress
647 row_merge_insert_index_tuples(). */
649 
650 /** Performance schema stage event for monitoring ALTER TABLE progress
651 row_log_apply(). */
653 
654 /** Performance schema stage event for monitoring ALTER TABLE progress
655 row_log_table_apply(). */
657 
658 /** Performance schema stage event for monitoring ALTER TABLE progress
659 row_merge_sort(). */
661 
662 /** Performance schema stage event for monitoring ALTER TABLE progress
663 row_merge_read_clustered_index(). */
665 
666 /** Performance schema stage event for monitoring buffer pool load progress. */
668 
669 /** Performance schema stage event for monitoring clone file copy progress. */
671 
672 /** Performance schema stage event for monitoring clone redo copy progress. */
674 
675 /** Performance schema stage event for monitoring clone page copy progress. */
677 #endif /* HAVE_PSI_STAGE_INTERFACE */
678 
679 #ifndef _WIN32
680 /** Alternatives for the file flush option in Unix.
681 @see innodb_flush_method_names */
683  SRV_UNIX_FSYNC = 0, /*!< fsync, the default */
684  SRV_UNIX_O_DSYNC, /*!< open log files in O_SYNC mode */
685  SRV_UNIX_LITTLESYNC, /*!< do not call os_file_flush()
686  when writing data files, but do flush
687  after writing to log files */
688  SRV_UNIX_NOSYNC, /*!< do not flush after writing */
689  SRV_UNIX_O_DIRECT, /*!< invoke os_file_set_nocache() on
690  data files. This implies using
691  non-buffered IO but still using fsync,
692  the reason for which is that some FS
693  do not flush meta-data when
694  unbuffered IO happens */
696  /*!< do not use fsync() when using
697  direct IO i.e.: it can be set to avoid
698  the fsync() call that we make when
699  using SRV_UNIX_O_DIRECT. However, in
700  this case user/DBA should be sure about
701  the integrity of the meta-data */
702 };
704 
705 inline bool srv_is_direct_io() {
708 }
709 
710 #else
711 /** Alternatives for file i/o in Windows. @see innodb_flush_method_names. */
712 enum srv_win_flush_t {
713  /** unbuffered I/O; this is the default */
714  SRV_WIN_IO_UNBUFFERED = 0,
715  /** buffered I/O */
716  SRV_WIN_IO_NORMAL,
717 };
718 extern enum srv_win_flush_t srv_win_file_flush_method;
719 
720 inline bool srv_is_direct_io() {
721  return (srv_win_file_flush_method == SRV_WIN_IO_UNBUFFERED);
722 }
723 
724 #endif /* _WIN32 */
725 
726 /** Alternatives for srv_force_recovery. Non-zero values are intended
727 to help the user get a damaged database up so that he can dump intact
728 tables and rows with SELECT INTO OUTFILE. The database must not otherwise
729 be used with these options! A bigger number below means that all precautions
730 of lower numbers are included. */
731 enum {
732  SRV_FORCE_IGNORE_CORRUPT = 1, /*!< let the server run even if it
733  detects a corrupt page */
734  SRV_FORCE_NO_BACKGROUND = 2, /*!< prevent the main thread from
735  running: if a crash would occur
736  in purge, this prevents it */
737  SRV_FORCE_NO_TRX_UNDO = 3, /*!< do not run trx rollback after
738  recovery */
739  SRV_FORCE_NO_IBUF_MERGE = 4, /*!< prevent also ibuf operations:
740  if they would cause a crash, better
741  not do them */
742  SRV_FORCE_NO_UNDO_LOG_SCAN = 5, /*!< do not look at undo logs when
743  starting the database: InnoDB will
744  treat even incomplete transactions
745  as committed */
746  SRV_FORCE_NO_LOG_REDO = 6 /*!< do not do the log roll-forward
747  in connection with recovery */
748 };
749 
750 /* Alternatives for srv_innodb_stats_method, which could be changed by
751 setting innodb_stats_method */
753  SRV_STATS_NULLS_EQUAL, /* All NULL values are treated as
754  equal. This is the default setting
755  for innodb_stats_method */
756  SRV_STATS_NULLS_UNEQUAL, /* All NULL values are treated as
757  NOT equal. */
758  SRV_STATS_NULLS_IGNORED /* NULL values are ignored */
759 };
760 
762 
763 #ifdef UNIV_DEBUG
764 /** Force all user tables to use page compression. */
765 extern ulong srv_debug_compress;
766 #endif /* UNIV_DEBUG */
767 
768 /** Types of threads existing in the system. */
770  SRV_NONE, /*!< None */
771  SRV_WORKER, /*!< threads serving parallelized
772  queries and queries released from
773  lock wait */
774  SRV_PURGE, /*!< Purge coordinator thread */
775  SRV_MASTER /*!< the master thread, (whose type
776  number must be biggest) */
777 };
778 
779 /** Boots Innobase server. */
780 void srv_boot(void);
781 /** Frees the data structures created in srv_init(). */
782 void srv_free(void);
783 /** Sets the info describing an i/o thread current state. */
785  ulint i, /*!< in: the 'segment' of the i/o thread */
786  const char *str); /*!< in: constant char string describing the
787  state */
788 /** Resets the info describing an i/o thread current state. */
790 /** Tells the purge thread that there has been activity in the database
791  and wakes up the purge thread if it is suspended (not sleeping). Note
792  that there is a small chance that the purge thread stays suspended
793  (we do not protect our operation with the srv_sys_t:mutex, for
794  performance reasons). */
796 /** Tells the Innobase server that there has been activity in the database
797  and wakes up the master thread if it is suspended (not sleeping). Used
798  in the MySQL interface. Note that there is a small chance that the master
799  thread stays suspended (we do not protect our operation with the kernel
800  mutex, for performace reasons). */
802 #define srv_active_wake_master_thread() \
803  do { \
804  if (!srv_read_only_mode) { \
805  srv_active_wake_master_thread_low(); \
806  } \
807  } while (0)
808 /** Wakes up the master thread if it is suspended or being suspended. */
809 void srv_wake_master_thread(void);
810 #ifndef UNIV_HOTBACKUP
811 /** Outputs to a file the output of the InnoDB Monitor.
812  @return false if not all information printed
813  due to failure to obtain necessary mutex */
815  FILE *file, /*!< in: output stream */
816  ibool nowait, /*!< in: whether to wait for the
817  lock_sys_t::mutex */
818  ulint *trx_start, /*!< out: file position of the start of
819  the list of active transactions */
820  ulint *trx_end); /*!< out: file position of the end of
821  the list of active transactions */
822 
823 /** Function to pass InnoDB status variables to MySQL */
824 void srv_export_innodb_status(void);
825 /** Get current server activity count. We don't hold srv_sys::mutex while
826  reading this value as it is only used in heuristics.
827  @return activity count. */
828 ulint srv_get_activity_count(void);
829 /** Check if there has been any activity.
830  @return false if no change in activity counter. */
831 ibool srv_check_activity(ulint old_activity_count); /*!< old activity count */
832 /** Increment the server activity counter. */
833 void srv_inc_activity_count(void);
834 
835 /** Enqueues a task to server task queue and releases a worker thread, if there
836  is a suspended one. */
837 void srv_que_task_enqueue_low(que_thr_t *thr); /*!< in: query thread */
838 
839 /** A thread which prints the info output by various InnoDB monitors. */
840 void srv_monitor_thread();
841 
842 /** A thread which prints warnings about semaphore waits which have lasted
843 too long. These can be used to track bugs which cause hangs. */
845 
846 /** The master thread controlling the server. */
847 void srv_master_thread();
848 
849 /** Purge coordinator thread that schedules the purge tasks. */
851 
852 /** Worker thread that reads tasks from the work queue and executes them. */
853 void srv_worker_thread();
854 
855 /** Get count of tasks in the queue.
856  @return number of tasks in queue */
857 ulint srv_get_task_queue_length(void);
858 
859 /** Releases threads of the type given from suspension in the thread table.
860  NOTE! The server mutex has to be reserved by the caller!
861  @return number of threads released: this may be less than n if not
862  enough threads were suspended at the moment */
863 ulint srv_release_threads(enum srv_thread_type type, /*!< in: thread type */
864  ulint n); /*!< in: number of threads to release */
865 
866 /** Check whether any background thread is created.
867 Send the threads wakeup signal.
868 
869 NOTE: this check is part of the final shutdown, when the first phase of
870 shutdown has already been completed.
871 @see srv_pre_dd_shutdown()
872 @see srv_master_thread_active()
873 @return name of thread that is active
874 @retval NULL if no thread is active */
876 
877 /** Check whether the master thread is active.
878 This is polled during the final phase of shutdown.
879 The first phase of server shutdown must have already been executed
880 (or the server must not have been fully started up).
881 @see srv_pre_dd_shutdown()
882 @see srv_any_background_threads_are_active()
883 @retval true if any thread is active
884 @retval false if no thread is active */
886 
887 /** Wakeup the purge threads. */
888 void srv_purge_wakeup(void);
889 
890 /** Check if the purge threads are active, both coordinator and worker threads
891 @return true if any thread is active, false if no thread is active */
893 
894 #ifdef UNIV_DEBUG
895 struct SYS_VAR;
896 
897 /** Disables master thread. It's used by:
898  SET GLOBAL innodb_master_thread_disabled_debug = 1 (0).
899 @param[in] thd thread handle
900 @param[in] var pointer to system variable
901 @param[out] var_ptr where the formal string goes
902 @param[in] save immediate result from check function */
904  void *var_ptr, const void *save);
905 #endif /* UNIV_DEBUG */
906 #endif /* !UNIV_HOTBACKUP */
907 
908 /** Status variables to be passed to MySQL */
909 struct export_var_t {
910  ulint innodb_data_pending_reads; /*!< Pending reads */
911  ulint innodb_data_pending_writes; /*!< Pending writes */
912  ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
913  ulint innodb_data_fsyncs; /*!< Number of fsyncs so far */
914  ulint innodb_data_read; /*!< Data bytes read */
915  ulint innodb_data_writes; /*!< I/O write requests */
916  ulint innodb_data_written; /*!< Data bytes written */
917  ulint innodb_data_reads; /*!< I/O read requests */
918  char innodb_buffer_pool_dump_status[OS_FILE_MAX_PATH +
919  128]; /*!< Buf pool dump status */
920  char innodb_buffer_pool_load_status[OS_FILE_MAX_PATH +
921  128]; /*!< Buf pool load status */
922  char innodb_buffer_pool_resize_status[512]; /*!< Buf pool resize status */
923  ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */
924  ulint innodb_buffer_pool_pages_data; /*!< Data pages */
925  ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */
926  ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */
927  ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */
928  ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */
929  ulint innodb_buffer_pool_pages_free; /*!< Free pages */
930 #ifdef UNIV_DEBUG
931  ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
932 #endif /* UNIV_DEBUG */
933  ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
934  ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
935  ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
936  ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
937  ulint innodb_buffer_pool_write_requests; /*!< srv_buf_pool_write_requests */
938  ulint innodb_buffer_pool_read_ahead_rnd; /*!< srv_read_ahead_rnd */
939  ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
940  ulint innodb_buffer_pool_read_ahead_evicted; /*!< srv_read_ahead evicted*/
941  ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
942  ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
943  ulint innodb_log_waits; /*!< srv_log_waits */
944  ulint innodb_log_write_requests; /*!< srv_log_write_requests */
945  ulint innodb_log_writes; /*!< srv_log_writes */
946  lsn_t innodb_os_log_written; /*!< srv_os_log_written */
947  ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */
948  ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
949  ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
950  ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */
951  ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
952  ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
953  ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
954  ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
955  ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
956  int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
957  / 1000 */
958  ulint innodb_row_lock_time_avg; /*!< srv_n_lock_wait_time
959  / 1000
960  / srv_n_lock_wait_count */
961  ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time
962  / 1000 */
963  ulint innodb_rows_read; /*!< srv_n_rows_read */
964  ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */
965  ulint innodb_rows_updated; /*!< srv_n_rows_updated */
966  ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
967  ulint innodb_num_open_files; /*!< fil_n_file_opened */
968  ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
969 #ifdef UNIV_DEBUG
970  ulint innodb_purge_trx_id_age; /*!< rw_max_trx_id - purged trx_id */
971  ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id
972  - purged view's min trx_id */
973  ulint innodb_ahi_drop_lookups; /*!< number of adaptive hash
974  index lookups when freeing
975  file pages */
976 #endif /* UNIV_DEBUG */
977 };
978 
979 #ifndef UNIV_HOTBACKUP
980 /** Thread slot in the thread table. */
981 struct srv_slot_t {
982  srv_thread_type type; /*!< thread type: user,
983  utility etc. */
984  ibool in_use; /*!< TRUE if this slot
985  is in use */
986  ibool suspended; /*!< TRUE if the thread is
987  waiting for the event of this
988  slot */
989  ib_time_t suspend_time; /*!< time when the thread was
990  suspended. Initialized by
991  lock_wait_table_reserve_slot()
992  for lock wait */
993  ulong wait_timeout; /*!< wait time that if exceeded
994  the thread will be timed out.
995  Initialized by
996  lock_wait_table_reserve_slot()
997  for lock wait */
998  os_event_t event; /*!< event used in suspending
999  the thread when it has nothing
1000  to do */
1001  que_thr_t *thr; /*!< suspended query thread
1002  (only used for user threads) */
1003 };
1004 #endif /* !UNIV_HOTBACKUP */
1005 
1006 #endif
void srv_master_thread()
The master thread controlling the server.
Definition: srv0srv.cc:2495
bool srv_stats_include_delete_marked
Definition: srv0srv.cc:508
ib_counter_t< int64_t, 1, single_indexer_t > int64_ctr_1_t
Definition: srv0srv.h:72
PSI_stage_info srv_stage_clone_file_copy
Performance schema stage event for monitoring clone file copy progress.
Definition: srv0srv.cc:781
ulint innodb_rows_deleted
srv_n_rows_deleted
Definition: srv0srv.h:966
unsigned long long int ulonglong
Definition: my_inttypes.h:69
lint_ctr_1_t n_lock_wait_current_count
Number of threads currently waiting on database locks.
Definition: srv0srv.h:126
mysql_pfs_key_t archiver_thread_key
PSI_stage_info srv_stage_alter_table_log_table
Performance schema stage event for monitoring ALTER TABLE progress row_log_table_apply().
Definition: srv0srv.cc:761
bool m_buf_resize_thread_active
true if buffer pool resize thread is created
Definition: srv0srv.h:152
mysql_pfs_key_t log_checkpointer_thread_key
ib_mutex_t page_zip_stat_per_index_mutex
Mutex protecting page_zip_stat_per_index.
Definition: srv0srv.cc:552
ib_mutex_t srv_dict_tmpfile_mutex
Mutex for locking srv_dict_tmpfile.
Definition: srv0srv.cc:562
ulong srv_undo_tablespaces
Number of undo tablespaces to use.
Definition: srv0srv.cc:129
uint32 page_no_t
Page number.
Definition: api0api.h:57
void srv_que_task_enqueue_low(que_thr_t *thr)
Enqueues a task to server task queue and releases a worker thread, if there is a suspended one...
Definition: srv0srv.cc:2984
mysql_pfs_key_t srv_purge_thread_key
ib_mutex_t srv_misc_tmpfile_mutex
Mutex for locking srv_misc_tmpfile.
Definition: srv0srv.cc:568
do not do the log roll-forward in connection with recovery
Definition: srv0srv.h:746
uint64_t lsn_t
Type used for all log sequence number storage and arithmetics.
Definition: log0types.h:59
ulong srv_debug_compress
Force all user tables to use page compression.
Definition: srv0srv.cc:195
FILE * srv_dict_tmpfile
Temporary file for output from the data dictionary.
Definition: srv0srv.cc:564
void srv_wake_master_thread(void)
Wakes up the master thread if it is suspended or being suspended.
Definition: srv0srv.cc:1835
char * srv_data_home
Definition: srv0srv.cc:123
None.
Definition: srv0srv.h:770
void srv_monitor_thread()
A thread which prints the info output by various InnoDB monitors.
Definition: srv0srv.cc:1557
ulint_ctr_1_t log_waits
We increase this counter, when we don&#39;t have enough space in the log buffer and have to flush it...
Definition: srv0srv.h:91
enum srv_unix_flush_t srv_unix_file_flush_method
Definition: srv0srv.cc:416
mysql_pfs_key_t log_writer_thread_key
bool srv_stats_persistent
Definition: srv0srv.cc:507
ulint innodb_dblwr_writes
srv_dblwr_writes
Definition: srv0srv.h:942
The low-level file system.
ulong srv_sync_array_size
User configured sync array size.
Definition: sync0arr.cc:167
ulint innodb_row_lock_time_avg
srv_n_lock_wait_time / 1000 / srv_n_lock_wait_count
Definition: srv0srv.h:958
ulong srv_sort_buf_size
Sort buffer size in index creation.
Definition: srv0srv.cc:175
void srv_error_monitor_thread()
A thread which prints warnings about semaphore waits which have lasted too long.
Definition: srv0srv.cc:1642
ulong srv_innodb_stats_method
Definition: srv0srv.cc:454
bool srv_load_corrupted
Definition: dict0load.cc:127
Definition: srv0srv.h:756
ulint innodb_buffer_pool_pages_latched
Latched pages.
Definition: srv0srv.h:931
Definition: sql_plugin_var.h:180
ulong srv_log_write_notifier_spin_delay
Number of spin iterations, for which log write notifier thread is waiting for advanced writeed_to_dis...
Definition: srv0srv.cc:309
ulint_ctr_1_t buf_pool_flushed
Count the number of pages that were written from buffer pool to the disk.
Definition: srv0srv.h:110
Srv_threads srv_threads
Structure with state of srv background threads.
Definition: srv0srv.cc:96
srv_stats_t srv_stats
Global counters.
Definition: srv0srv.cc:457
mysql_pfs_key_t srv_master_thread_key
ulong srv_log_wait_for_write_timeout
Timeout used when waiting for redo write (microseconds).
Definition: srv0srv.cc:277
ulong srv_n_page_cleaners
Definition: srv0srv.cc:428
Counter utility class.
ib_counter_t< ulint, 64 > ulint_ctr_64_t
Definition: srv0srv.h:68
bool m_timeout_thread_active
true if timeout thread is created
Definition: srv0srv.h:158
ulong srv_max_purge_lag
Maximum allowable purge history length.
Definition: trx0purge.cc:63
ulong srv_n_page_hash_locks
Number of locks to protect buf_pool->page_hash.
Definition: srv0srv.cc:383
ulong srv_n_log_files
Definition: srv0srv.cc:215
bool srv_ibuf_disable_background_merge
Definition: ibuf0ibuf.cc:45
time_t ib_time_t
Time stamp.
Definition: ut0ut.h:82
os_event_t srv_buf_dump_event
The buffer pool dump/load thread waits on this event.
Definition: srv0srv.cc:718
bool srv_redo_log_encrypt
Enable or Disable Encrypt of REDO tablespace.
Definition: srv0srv.cc:213
ulint innodb_buffer_pool_bytes_dirty
File bytes modified.
Definition: srv0srv.h:927
bool srv_sync_debug
Definition: sync0debug.cc:61
const char * srv_io_thread_function[]
Definition: srv0srv.cc:543
ulint innodb_data_writes
I/O write requests.
Definition: srv0srv.h:915
ulint innodb_buffer_pool_read_ahead_rnd
srv_read_ahead_rnd
Definition: srv0srv.h:938
ulint innodb_pages_written
buf_pool->stat.n_pages_written
Definition: srv0srv.h:953
void srv_wake_purge_thread_if_not_active(void)
Tells the purge thread that there has been activity in the database and wakes up the purge thread if ...
Definition: srv0srv.cc:1825
ulint innodb_data_pending_fsyncs
Pending fsyncs.
Definition: srv0srv.h:912
ulint_ctr_64_t n_rows_read
Number of rows read.
Definition: srv0srv.h:129
ulong srv_flush_neighbors
Whether or not to flush neighbors of a block.
Definition: srv0srv.cc:387
ulint innodb_log_write_requests
srv_log_write_requests
Definition: srv0srv.h:944
ulint innodb_data_read
Data bytes read.
Definition: srv0srv.h:914
ibool srv_use_doublewrite_buf
Definition: srv0srv.cc:512
ulong srv_LRU_scan_depth
Scan depth for LRU flush batch i.e.
Definition: srv0srv.cc:385
os_event_t srv_error_event
Event to signal the error thread.
Definition: srv0srv.cc:715
do not use fsync() when using direct IO i.e.
Definition: srv0srv.h:695
Purge coordinator thread.
Definition: srv0srv.h:774
double srv_max_dirty_pages_pct
unsigned long long srv_online_max_size
Maximum modification log file size for online index creation.
Definition: srv0srv.cc:177
uint srv_log_spin_cpu_pct_hwm
Maximum percentage of cpu time for which spin-delay is used.
Definition: srv0srv.cc:240
ulint innodb_row_lock_current_waits
srv_n_lock_wait_current_count
Definition: srv0srv.h:955
ulint innodb_log_writes
srv_log_writes
Definition: srv0srv.h:945
The interface to the operating system file io.
ulint innodb_rows_read
srv_n_rows_read
Definition: srv0srv.h:963
ulong srv_adaptive_flushing_lwm
Definition: srv0srv.cc:440
PSI_stage_info srv_stage_alter_table_log_index
Performance schema stage event for monitoring ALTER TABLE progress row_log_apply().
Definition: srv0srv.cc:755
bool m_monitor_thread_active
true if monitor thread is created
Definition: srv0srv.h:143
ulong srv_log_closer_timeout
Initial sleep used in log closer after spin delay is finished.
Definition: srv0srv.cc:330
ulong srv_buf_pool_instances
Requested number of buffer pool instances.
Definition: srv0srv.cc:379
ulint innodb_purge_view_trx_id_age
rw_max_trx_id
Definition: srv0srv.h:971
ulong srv_log_recent_closed_size
Number of slots in a small buffer, which is used to break requirement for total order of dirty pages...
Definition: srv0srv.cc:268
char * srv_log_group_home_dir
Definition: srv0srv.cc:210
ulint srv_truncated_status_writes
Definition: srv0srv.cc:534
ulint innodb_buffer_pool_wait_free
srv_buf_pool_wait_free
Definition: srv0srv.h:935
ulint innodb_pages_read
buf_pool->stat.n_pages_read
Definition: srv0srv.h:952
ulong wait_timeout
wait time that if exceeded the thread will be timed out.
Definition: srv0srv.h:993
PSI_stage_info srv_stage_clone_page_copy
Performance schema stage event for monitoring clone page copy progress.
Definition: srv0srv.cc:789
ulong srv_log_closer_spin_delay
Number of spin iterations, for which log closerr thread is waiting for a reachable untraversed link i...
Definition: srv0srv.cc:327
ulint innodb_buffer_pool_pages_free
Free pages.
Definition: srv0srv.h:929
double utime_abs
Definition: srv0srv.h:166
mysql_pfs_key_t buf_dump_thread_key
void srv_purge_coordinator_thread()
Purge coordinator thread that schedules the purge tasks.
Definition: srv0srv.cc:2869
ib_time_t suspend_time
time when the thread was suspended.
Definition: srv0srv.h:989
ulong srv_checksum_algorithm
the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we use srv_checksum_algorithm_t her...
Definition: checksum.cc:54
ulong srv_doublewrite_batch_size
doublewrite buffer is 1MB is size i.e.
Definition: srv0srv.cc:518
mysql_pfs_key_t io_log_thread_key
ulint srv_fatal_semaphore_wait_threshold
Definition: srv0srv.cc:110
prevent also ibuf operations: if they would cause a crash, better not do them
Definition: srv0srv.h:739
mysql_pfs_key_t dict_stats_thread_key
ulint innodb_data_reads
I/O read requests.
Definition: srv0srv.h:917
ulong srv_log_writer_spin_delay
Number of spin iterations, for which log writer thread is waiting for new data to write or flush with...
Definition: srv0srv.cc:290
void srv_master_thread_disabled_debug_update(THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
Disables master thread.
Definition: srv0srv.cc:1935
ulong srv_flush_log_at_trx_commit
Definition: srv0srv.cc:343
void srv_active_wake_master_thread_low(void)
Tells the Innobase server that there has been activity in the database and wakes up the master thread...
Definition: srv0srv.cc:1789
ulong srv_log_checkpoint_every
Number of milliseconds every which a periodical checkpoint is written by the log checkpointer thread ...
Definition: srv0srv.cc:298
mysql_pfs_key_t log_flusher_thread_key
ulong srv_force_recovery
Normally 0.
Definition: srv0srv.cc:467
bool srv_downgrade_logs
Query graph global types.
ulint_ctr_1_t dblwr_pages_written
Store the number of pages that have been flushed to the doublewrite buffer.
Definition: srv0srv.h:98
ulong srv_log_write_ahead_size
Size of block, used for writing ahead to avoid read-on-write.
Definition: srv0srv.h:422
ulint srv_dml_needed_delay
Definition: srv0srv.cc:114
ulong srv_io_capacity
Definition: srv0srv.cc:424
ulong srv_log_write_events
Number of events used for notifications about redo write.
Definition: srv0srv.cc:255
ulonglong srv_buf_pool_chunk_unit
Requested buffer pool chunk size.
Definition: srv0srv.cc:377
que_thr_t * thr
suspended query thread (only used for user threads)
Definition: srv0srv.h:1001
ulint_ctr_1_t data_read
Number of data read in total (in bytes)
Definition: srv0srv.h:117
Definition: srv0srv.h:164
const page_no_t SRV_UNDO_TABLESPACE_SIZE_IN_PAGES
Default size of UNDO tablespace while it is created new.
Definition: srv0srv.cc:162
void srv_free(void)
Frees the data structures created in srv_init().
Definition: srv0srv.cc:1112
ulong srv_log_flush_events
Number of events used for notifications about redo flush.
Definition: srv0srv.cc:258
PSI_stage_info srv_stage_alter_table_insert
Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples().
Definition: srv0srv.cc:750
ulint srv_buf_pool_base_size
Current size as scaling factor for the other components.
Definition: srv0srv.cc:391
ulong srv_rollback_segments
The number of rollback segments per tablespace.
Definition: srv0srv.cc:133
mysql_pfs_key_t trx_recovery_rollback_thread_key
os_event_t srv_monitor_event
Event to signal the monitor thread.
Definition: srv0srv.cc:712
ibool in_use
TRUE if this slot is in use.
Definition: srv0srv.h:984
bool m_buf_dump_thread_active
true if buffer pool dump/load thread is created
Definition: srv0srv.h:149
ulint_ctr_64_t n_rows_updated
Number of rows updated.
Definition: srv0srv.h:132
bool srv_purge_threads_active()
Check if the purge threads are active, both coordinator and worker threads.
Definition: srv0srv.cc:3029
bool srv_master_thread_disabled_debug
Value of MySQL global used to disable master thread.
Definition: srv0srv.cc:199
bool srv_master_thread_active()
Check whether the master thread is active.
Definition: srv0srv.cc:1769
ulint innodb_os_log_pending_writes
srv_os_log_pending_writes
Definition: srv0srv.h:948
ulint innodb_buffer_pool_read_ahead_evicted
srv_read_ahead evicted
Definition: srv0srv.h:940
ulong srv_log_writer_timeout
Initial timeout used to wait on writer_event.
Definition: srv0srv.cc:293
ulint innodb_buffer_pool_pages_misc
Miscellanous pages.
Definition: srv0srv.h:928
const ulong srv_buf_pool_instances_default
Default number of buffer pool instances.
Definition: srv0srv.cc:381
ulint_ctr_64_t n_rows_deleted
Number of rows deleted.
Definition: srv0srv.h:135
mysql_pfs_key_t page_flush_thread_key
ulong srv_log_flusher_timeout
Initial timeout used to wait on flusher_event.
Definition: srv0srv.cc:305
bool srv_flush_sync
Definition: srv0srv.cc:355
Redo log types.
Stage instrument information.
Definition: psi_stage_bits.h:71
bool srv_undo_log_truncate
Enable or Disable Truncate of UNDO tablespace.
Definition: srv0srv.cc:153
ibool srv_innodb_status
Definition: srv0srv.cc:498
ulint innodb_log_waits
srv_log_waits
Definition: srv0srv.h:943
char * srv_undo_dir
Server undo tablespaces directory, can be absolute path.
Definition: srv0srv.cc:126
mysql_pfs_key_t recv_writer_thread_key
mysql_pfs_key_t io_ibuf_thread_key
Definition: srv0srv.h:753
ulint_ctr_1_t buf_pool_write_requests
Store the number of write requests issued.
Definition: srv0srv.h:101
mysql_pfs_key_t log_closer_thread_key
ulong srv_read_ahead_threshold
Definition: srv0srv.cc:409
PSI_stage_info srv_stage_alter_table_flush
Performance schema stage event for monitoring ALTER TABLE progress log_make_checkpoint_at().
Definition: srv0srv.cc:745
void srv_worker_thread()
Worker thread that reads tasks from the work queue and executes them.
Definition: srv0srv.cc:2630
void srv_reset_io_thread_op_info()
Resets the info describing an i/o thread current state.
Definition: srv0srv.cc:817
mysql_pfs_key_t io_write_thread_key
srv_stats_method_name_enum
Definition: srv0srv.h:752
mysql_pfs_key_t buf_resize_thread_key
ulong srv_max_io_capacity
Definition: srv0srv.cc:425
ulong srv_max_purge_lag_delay
Max DML user threads delay in micro-seconds.
Definition: trx0purge.cc:66
char * srv_buf_dump_filename
The buffer pool dump/load file name.
Definition: srv0srv.cc:724
ulong srv_log_wait_for_flush_spin_delay
Number of spin iterations, when spinning and waiting for log flushed.
Definition: srv0srv.cc:281
ulint_ctr_1_t data_written
Count the amount of data written in total (in bytes)
Definition: srv0srv.h:75
Definition: srv0srv.h:67
ulint innodb_pages_created
buf_pool->stat.n_pages_created
Definition: srv0srv.h:951
lsn_t innodb_os_log_written
srv_os_log_written
Definition: srv0srv.h:946
unsigned long long srv_stats_transient_sample_pages
Definition: srv0srv.cc:506
lint_ctr_1_t os_log_pending_writes
Number of writes being done to the log files.
Definition: srv0srv.h:87
enum srv_stats_method_name_enum srv_stats_method_name_t
Definition: srv0srv.h:761
bool srv_print_innodb_monitor
Definition: srv0srv.cc:536
PSI_stage_info srv_stage_buffer_pool_load
Performance schema stage event for monitoring buffer pool load progress.
Definition: srv0srv.cc:777
DDL log.
int64_t innodb_row_lock_time
srv_n_lock_wait_time / 1000
Definition: srv0srv.h:956
unsigned long long srv_max_undo_tablespace_size
Maximum size of undo tablespace.
Definition: srv0srv.cc:159
mysql_pfs_key_t log_flush_notifier_thread_key
ib_counter_t< lint, 1, single_indexer_t > lint_ctr_1_t
Definition: srv0srv.h:71
ib_counter_t< ulint, 1, single_indexer_t > ulint_ctr_1_t
Definition: srv0srv.h:70
ulint innodb_buffer_pool_write_requests
srv_buf_pool_write_requests
Definition: srv0srv.h:937
Buffer pool checksum functions, also linked from /extra/innochecksum.cc.
ulint innodb_purge_trx_id_age
rw_max_trx_id - purged trx_id
Definition: srv0srv.h:970
bool srv_adaptive_flushing
Definition: srv0srv.cc:352
ib_counter_t< lsn_t, 1, single_indexer_t > lsn_ctr_1_t
Definition: srv0srv.h:69
bool srv_stats_auto_recalc
Definition: srv0srv.cc:510
ulint innodb_row_lock_time_max
srv_n_lock_max_wait_time / 1000
Definition: srv0srv.h:961
mysql_pfs_key_t srv_monitor_thread_key
Definition: que0que.h:247
bool srv_disable_sort_file_cache
Definition: row0merge.cc:68
do not flush after writing
Definition: srv0srv.h:688
ulint_ctr_64_t n_rows_inserted
Number of rows inserted.
Definition: srv0srv.h:138
unsigned int uint
Definition: uca-dump.cc:29
ulint innodb_os_log_pending_fsyncs
fil_n_pending_log_flushes
Definition: srv0srv.h:949
ulint innodb_num_open_files
fil_n_file_opened
Definition: srv0srv.h:967
mysql_pfs_key_t srv_lock_timeout_thread_key
ulong srv_adaptive_max_sleep_delay
Maximum sleep delay (in micro-seconds), value of 0 disables it.
Definition: srv0conc.cc:63
bool high_level_read_only
Set if InnoDB operates in read-only mode or innodb-force-recovery is greater than SRV_FORCE_NO_TRX_UN...
Definition: srv0srv.cc:180
ulong srv_flushing_avg_loops
Definition: srv0srv.cc:443
void srv_export_innodb_status(void)
Function to pass InnoDB status variables to MySQL.
Definition: srv0srv.cc:1404
ulint srv_max_n_open_files
Definition: srv0srv.cc:421
ibool srv_check_activity(ulint old_activity_count)
Check if there has been any activity.
Definition: srv0srv.cc:1850
ulint innodb_buffer_pool_pages_data
Data pages.
Definition: srv0srv.h:924
Srv_cpu_usage srv_cpu_usage
Structure with cpu usage information.
Definition: srv0srv.cc:99
ibool srv_priority_boost
Definition: srv0srv.cc:525
void srv_boot(void)
Boots Innobase server.
Definition: srv0srv.cc:1159
ulint innodb_buffer_pool_reads
srv_buf_pool_reads
Definition: srv0srv.h:934
mysql_pfs_key_t srv_error_monitor_thread_key
ulint innodb_buffer_pool_pages_flushed
srv_buf_pool_flushed
Definition: srv0srv.h:936
ulint innodb_dblwr_pages_written
srv_dblwr_pages_written
Definition: srv0srv.h:941
int64_ctr_1_t n_lock_wait_time
Wait time of database locks.
Definition: srv0srv.h:120
PSI_stage_info srv_stage_alter_table_end
Performance schema stage event for monitoring ALTER TABLE progress everything after flush log_make_ch...
Definition: srv0srv.cc:740
Transaction system global type definitions.
InnoDB concurrency manager header file.
ulong srv_n_spin_wait_rounds
Definition: ut0mutex.h:111
void srv_set_io_thread_op_info(ulint i, const char *str)
Sets the info describing an i/o thread current state.
Definition: srv0srv.cc:806
bool srv_upgrade_old_undo_found
ulint innodb_page_size
UNIV_PAGE_SIZE.
Definition: srv0srv.h:950
ulint_ctr_1_t log_write_requests
Number of the log write requests done.
Definition: srv0srv.h:78
fsync, the default
Definition: srv0srv.h:683
ulong srv_log_write_notifier_timeout
Initial timeout used to wait on write_notifier_event.
Definition: srv0srv.cc:313
ulint innodb_truncated_status_writes
srv_truncated_status_writes
Definition: srv0srv.h:968
ibool srv_printf_innodb_monitor(FILE *file, ibool nowait, ulint *trx_start, ulint *trx_end)
Outputs to a file the output of the InnoDB Monitor.
Definition: srv0srv.cc:1196
do not look at undo logs when starting the database: InnoDB will treat even incomplete transactions a...
Definition: srv0srv.h:742
bool srv_is_upgrade_mode
ulint innodb_data_fsyncs
Number of fsyncs so far.
Definition: srv0srv.h:913
lsn_ctr_1_t os_log_written
Amount of data written to the log files in bytes.
Definition: srv0srv.h:84
mysql_pfs_key_t fts_optimize_thread_key
int n_cpu
Definition: srv0srv.h:165
bool srv_print_innodb_lock_monitor
Definition: srv0srv.cc:537
bool m_error_monitor_thread_active
true if error monitor thread is created
Definition: srv0srv.h:146
ulong srv_fast_shutdown
The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown...
Definition: srv0srv.cc:495
double utime_pct
Definition: srv0srv.h:168
ulong srv_purge_rseg_truncate_frequency
Rate at which UNDO records should be purged.
Definition: srv0srv.cc:145
srv_thread_type type
thread type: user, utility etc.
Definition: srv0srv.h:982
bool srv_undo_log_encrypt
Enable or disable Encrypt of UNDO tablespace.
Definition: srv0srv.cc:156
PSI_stage_info srv_stage_alter_table_merge_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_sort().
Definition: srv0srv.cc:767
ulonglong srv_log_file_size
At startup, this is the current redo log file size.
Definition: srv0srv.cc:223
bool srv_dedicated_server
Dedicated server setting.
Definition: srv0srv.cc:368
ulong srv_log_buffer_size
Space for log buffer, expressed in bytes.
Definition: srv0srv.cc:231
ulong srv_n_free_tickets_to_enter
Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got t...
Definition: srv0conc.cc:60
#define OS_FILE_MAX_PATH
Definition: os0file.h:835
uint srv_change_buffer_max_size
Maximum on-disk size of change buffer in terms of percentage of the buffer pool.
Definition: srv0srv.cc:413
mysql_pfs_key_t fts_parallel_merge_thread_key
ulint innodb_buffer_pool_pages_dirty
Dirty data pages.
Definition: srv0srv.h:926
ulong srv_n_write_io_threads
Definition: srv0srv.cc:402
void srv_inc_activity_count(void)
Increment the server activity counter.
Definition: srv0srv.cc:1719
bool srv_print_all_deadlocks
Print all user-level transactions deadlocks to mysqld stderr.
Definition: srv0srv.cc:475
bool srv_buffer_pool_dump_at_shutdown
Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown and/or load it during start...
Definition: srv0srv.cc:728
const ulint srv_buf_pool_def_size
Default pool size in bytes.
Definition: srv0srv.cc:374
ulong srv_n_read_io_threads
Definition: srv0srv.cc:401
ulint innodb_data_pending_writes
Pending writes.
Definition: srv0srv.h:911
bool srv_buffer_pool_load_at_startup
Definition: srv0srv.cc:729
uint srv_log_spin_cpu_abs_lwm
Minimum absolute value of cpu time for which spin-delay is used.
Definition: srv0srv.cc:237
ulint innodb_rows_updated
srv_n_rows_updated
Definition: srv0srv.h:965
threads serving parallelized queries and queries released from lock wait
Definition: srv0srv.h:771
mysql_pfs_key_t fts_parallel_tokenization_thread_key
ulint innodb_buffer_pool_pages_total
Buffer pool size.
Definition: srv0srv.h:923
ulint innodb_buffer_pool_read_requests
buf_pool->stat.n_page_gets
Definition: srv0srv.h:933
Definition: srv0srv.h:141
ulint innodb_os_log_fsyncs
fil_n_log_flushes
Definition: srv0srv.h:947
the master thread, (whose type number must be biggest)
Definition: srv0srv.h:775
ulonglong srv_log_file_size_requested
The value of the startup parameter innodb_log_file_size.
Definition: srv0srv.cc:226
ulint srv_n_file_io_threads
Number of IO threads to use.
Definition: srv0start.cc:128
mysql_pfs_key_t io_handler_thread_key
double srv_max_buf_pool_modified_pct
Definition: srv0srv.cc:435
ulong srv_replication_delay
Definition: srv0srv.cc:520
bool srv_numa_interleave
Definition: srv0srv.cc:191
open log files in O_SYNC mode
Definition: srv0srv.h:684
bool m_master_thread_active
true if master thread is created
Definition: srv0srv.h:161
ulint innodb_data_written
Data bytes written.
Definition: srv0srv.h:916
ulint innodb_rows_inserted
srv_n_rows_inserted
Definition: srv0srv.h:964
PSI_stage_info srv_stage_alter_table_read_pk_internal_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_read_clustered_index().
Definition: srv0srv.cc:772
double stime_abs
Definition: srv0srv.h:167
ulong srv_spin_wait_delay
Definition: ut0mutex.h:110
ib_mutex_t srv_monitor_file_mutex
Definition: srv0srv.cc:555
bool srv_print_ddl_logs
Print all DDL logs to mysqld stderr.
Definition: srv0srv.cc:478
InnoDB condition variable.
Definition: os0event.cc:63
ulong srv_log_flush_notifier_timeout
Initial timeout used to wait on flush_notifier_event.
Definition: srv0srv.cc:322
long long srv_buf_pool_curr_size
Current size in bytes.
Definition: srv0srv.cc:393
ulint srv_get_activity_count(void)
Get current server activity count.
Definition: srv0srv.cc:1846
ulint_ctr_1_t buf_pool_reads
Number of buffer pool reads that led to the reading of a disk page.
Definition: srv0srv.h:114
os_event_t event
event used in suspending the thread when it has nothing to do
Definition: srv0srv.h:998
ulong srv_log_wait_for_flush_spin_hwm
Maximum value of average log flush time for which spin-delay is used.
Definition: srv0srv.cc:245
ulint innodb_ahi_drop_lookups
number of adaptive hash index lookups when freeing file pages
Definition: srv0srv.h:973
ulong srv_log_wait_for_flush_timeout
Timeout used when waiting for redo flush (microseconds).
Definition: srv0srv.cc:285
Status variables to be passed to MySQL.
Definition: srv0srv.h:909
mysql_pfs_key_t page_flush_coordinator_thread_key
ulong srv_purge_batch_size
Definition: srv0srv.cc:449
ulint srv_lock_table_size
Lock table size in bytes.
Definition: srv0srv.cc:397
Instrumentation helpers for stages.
const ulint srv_buf_pool_min_size
Minimum pool size in bytes.
Definition: srv0srv.cc:372
do not run trx rollback after recovery
Definition: srv0srv.h:737
prevent the main thread from running: if a crash would occur in purge, this prevents it ...
Definition: srv0srv.h:734
ibool suspended
TRUE if the thread is waiting for the event of this slot.
Definition: srv0srv.h:986
do not call os_file_flush() when writing data files, but do flush after writing to log files ...
Definition: srv0srv.h:685
ulong srv_log_flush_notifier_spin_delay
Number of spin iterations, for which log flush notifier thread is waiting for advanced flushed_to_dis...
Definition: srv0srv.cc:318
bool m_dict_stats_thread_active
true if stats thread is created
Definition: srv0srv.h:155
ulint innodb_row_lock_waits
srv_n_lock_wait_count
Definition: srv0srv.h:954
bool srv_buf_pool_debug
This is used to enable multiple buffer pool instances with small buffer pool size.
Definition: buf0buf.cc:323
bool srv_purge_view_update_only_debug
Definition: trx0purge.cc:72
ulong srv_log_write_max_size
When log writer follows links in the log recent written buffer, it stops when it has reached at least...
Definition: srv0srv.cc:252
ulint_ctr_1_t log_writes
Number of physical writes to the log performed.
Definition: srv0srv.h:81
bool srv_use_native_aio
Definition: srv0srv.cc:189
ulint innodb_buffer_pool_read_ahead
srv_read_ahead
Definition: srv0srv.h:939
unsigned long long srv_stats_persistent_sample_pages
Definition: srv0srv.cc:509
bool srv_checkpoint_disabled
If true then disable checkpointing.
Definition: srv0srv.cc:339
mysql_pfs_key_t srv_worker_thread_key
The interface to the operating system condition variables.
Class to write and replay ddl logs.
Definition: log0ddl.h:379
ulint srv_buf_pool_old_size
Previously requested size.
Definition: srv0srv.cc:389
bool srv_file_per_table
store to its own file each table created by an user; data dictionary tables are in the system tablesp...
Definition: srv0srv.cc:172
os_event_t srv_buf_resize_event
The buffer pool resize thread waits on this event.
Definition: srv0srv.cc:721
ulong srv_thread_sleep_delay
Sleep delay for threads waiting to enter InnoDB.
Definition: srv0srv.h:544
FILE * srv_monitor_file
Temporary file for innodb monitor output.
Definition: srv0srv.cc:558
const char * srv_main_thread_op_info
Definition: srv0srv.cc:116
ulint innodb_buffer_pool_bytes_data
File bytes used.
Definition: srv0srv.h:925
FILE * srv_misc_tmpfile
Temporary file for miscellanous diagnostic output.
Definition: srv0srv.cc:570
ulint innodb_data_pending_reads
Pending reads.
Definition: srv0srv.h:910
bool srv_read_only_mode
Set if InnoDB must operate in read-only mode.
Definition: srv0srv.cc:168
Define for performance schema registration key.
Definition: sync0sync.h:50
ulong srv_n_purge_threads
Definition: srv0srv.cc:446
ulong srv_log_wait_for_write_spin_delay
Number of spin iterations, when spinning and waiting for log buffer written up to given LSN...
Definition: srv0srv.cc:273
ulint_ctr_1_t n_lock_wait_count
Number of database lock waits.
Definition: srv0srv.h:123
ulint_ctr_1_t dblwr_writes
Count the number of times the doublewrite buffer was flushed.
Definition: srv0srv.h:94
mysql_pfs_key_t log_write_notifier_thread_key
ulint srv_buf_pool_size
Requested size in bytes.
Definition: srv0srv.cc:370
struct export_var_t export_vars
Status variables to be passed to MySQL.
Definition: srv0srv.cc:461
bool srv_cmp_per_index_enabled
Enable INFORMATION_SCHEMA.innodb_cmp_per_index.
Definition: srv0srv.cc:481
double srv_max_dirty_pages_pct_lwm
Definition: srv0srv.cc:436
ulint srv_get_task_queue_length(void)
Get count of tasks in the queue.
Definition: srv0srv.cc:2998
srv_unix_flush_t
Alternatives for the file flush option in Unix.
Definition: srv0srv.h:682
Definition: srv0srv.h:758
PSI_stage_info srv_stage_clone_redo_copy
Performance schema stage event for monitoring clone redo copy progress.
Definition: srv0srv.cc:785
ulong srv_force_recovery_crash
Inject a crash at different steps of the recovery process.
Definition: srv0srv.cc:471
ulint srv_release_threads(enum srv_thread_type type, ulint n)
Releases threads of the type given from suspension in the thread table.
Definition: srv0srv.cc:959
bool srv_log_checksums
Whether to generate and require checksums on the redo log pages.
Definition: srv0srv.cc:335
double stime_pct
Definition: srv0srv.h:169
const char * srv_io_thread_op_info[]
Definition: srv0srv.cc:542
const char * srv_any_background_threads_are_active()
Check whether any background thread is created.
Definition: srv0srv.cc:1729
uint srv_flush_log_at_timeout
Definition: srv0srv.cc:344
ulong srv_log_flusher_spin_delay
Number of spin iterations, for which log flusher thread is waiting for new data to flush...
Definition: srv0srv.cc:302
void srv_purge_wakeup(void)
Wakeup the purge threads.
Definition: srv0srv.cc:3013
bool srv_random_read_ahead
Definition: srv0srv.cc:405
bool srv_is_direct_io()
Definition: srv0srv.h:705
ulong srv_log_recent_written_size
Number of slots in a small buffer, which is used to allow concurrent writes to log buffer...
Definition: srv0srv.cc:263
invoke os_file_set_nocache() on data files.
Definition: srv0srv.h:689
Thread slot in the thread table.
Definition: srv0srv.h:981
let the server run even if it detects a corrupt page
Definition: srv0srv.h:732
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:747
ulong srv_buf_pool_dump_pct
Dump this % of each buffer pool during BP dump.
Definition: srv0srv.cc:395
Log_DDL * log_ddl
Object to handle Log_DDL.
Definition: log0ddl.cc:58
srv_thread_type
Types of threads existing in the system.
Definition: srv0srv.h:769
mysql_pfs_key_t io_read_thread_key
ulint_ctr_1_t buf_pool_wait_free
Store the number of times when we had to wait for a free page in the buffer pool. ...
Definition: srv0srv.h:106