mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
c67510f093
srv0start.c Support raw disk partitions as data files srv0srv.c Support raw disk partitions as data files row0purge.c < 4 GB rows, doublewrite, hang fixes row0row.c < 4 GB rows, doublewrite, hang fixes row0sel.c < 4 GB rows, doublewrite, hang fixes row0uins.c < 4 GB rows, doublewrite, hang fixes row0umod.c < 4 GB rows, doublewrite, hang fixes row0undo.c < 4 GB rows, doublewrite, hang fixes row0upd.c < 4 GB rows, doublewrite, hang fixes srv0srv.c < 4 GB rows, doublewrite, hang fixes srv0start.c < 4 GB rows, doublewrite, hang fixes sync0rw.c < 4 GB rows, doublewrite, hang fixes sync0sync.c < 4 GB rows, doublewrite, hang fixes trx0purge.c < 4 GB rows, doublewrite, hang fixes trx0rec.c < 4 GB rows, doublewrite, hang fixes trx0sys.c < 4 GB rows, doublewrite, hang fixes btr0btr.c < 4 GB rows, doublewrite, hang fixes btr0cur.c < 4 GB rows, doublewrite, hang fixes buf0buf.c < 4 GB rows, doublewrite, hang fixes buf0flu.c < 4 GB rows, doublewrite, hang fixes buf0rea.c < 4 GB rows, doublewrite, hang fixes data0data.c < 4 GB rows, doublewrite, hang fixes fil0fil.c < 4 GB rows, doublewrite, hang fixes fsp0fsp.c < 4 GB rows, doublewrite, hang fixes ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes lock0lock.c < 4 GB rows, doublewrite, hang fixes log0log.c < 4 GB rows, doublewrite, hang fixes log0recv.c < 4 GB rows, doublewrite, hang fixes os0file.c < 4 GB rows, doublewrite, hang fixes page0cur.c < 4 GB rows, doublewrite, hang fixes pars0pars.c < 4 GB rows, doublewrite, hang fixes rem0cmp.c < 4 GB rows, doublewrite, hang fixes rem0rec.c < 4 GB rows, doublewrite, hang fixes row0ins.c < 4 GB rows, doublewrite, hang fixes row0mysql.c < 4 GB rows, doublewrite, hang fixes univ.i < 4 GB rows, doublewrite, hang fixes data0data.ic < 4 GB rows, doublewrite, hang fixes mach0data.ic < 4 GB rows, doublewrite, hang fixes rem0rec.ic < 4 GB rows, doublewrite, hang fixes row0upd.ic < 4 GB rows, doublewrite, hang fixes trx0rec.ic < 4 GB rows, doublewrite, hang fixes rem0cmp.h < 4 GB rows, doublewrite, hang fixes rem0rec.h < 4 GB rows, doublewrite, hang fixes row0ins.h < 4 GB rows, doublewrite, hang fixes row0mysql.h < 4 GB rows, doublewrite, hang fixes row0row.h < 4 GB rows, doublewrite, hang fixes row0upd.h < 4 GB rows, doublewrite, hang fixes srv0srv.h < 4 GB rows, doublewrite, hang fixes sync0sync.h < 4 GB rows, doublewrite, hang fixes trx0rec.h < 4 GB rows, doublewrite, hang fixes trx0sys.h < 4 GB rows, doublewrite, hang fixes trx0types.h < 4 GB rows, doublewrite, hang fixes trx0undo.h < 4 GB rows, doublewrite, hang fixes ut0dbg.h < 4 GB rows, doublewrite, hang fixes ut0ut.h < 4 GB rows, doublewrite, hang fixes btr0btr.h < 4 GB rows, doublewrite, hang fixes btr0cur.h < 4 GB rows, doublewrite, hang fixes buf0buf.h < 4 GB rows, doublewrite, hang fixes buf0flu.h < 4 GB rows, doublewrite, hang fixes data0data.h < 4 GB rows, doublewrite, hang fixes dict0mem.h < 4 GB rows, doublewrite, hang fixes fil0fil.h < 4 GB rows, doublewrite, hang fixes fsp0fsp.h < 4 GB rows, doublewrite, hang fixes os0file.h < 4 GB rows, doublewrite, hang fixes innobase/include/btr0btr.h: < 4 GB rows, doublewrite, hang fixes innobase/include/btr0cur.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0buf.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0flu.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.h: < 4 GB rows, doublewrite, hang fixes innobase/include/dict0mem.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fil0fil.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fsp0fsp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/os0file.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0cmp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0ins.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0mysql.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0row.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.h: < 4 GB rows, doublewrite, hang fixes innobase/include/sync0sync.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0sys.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0types.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0undo.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0dbg.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0ut.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/mach0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/univ.i: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0btr.c: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0buf.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0flu.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0rea.c: < 4 GB rows, doublewrite, hang fixes innobase/data/data0data.c: < 4 GB rows, doublewrite, hang fixes innobase/fil/fil0fil.c: < 4 GB rows, doublewrite, hang fixes innobase/fsp/fsp0fsp.c: < 4 GB rows, doublewrite, hang fixes innobase/ibuf/ibuf0ibuf.c: < 4 GB rows, doublewrite, hang fixes innobase/lock/lock0lock.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0log.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0recv.c: < 4 GB rows, doublewrite, hang fixes innobase/os/os0file.c: < 4 GB rows, doublewrite, hang fixes innobase/page/page0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/pars/pars0pars.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0cmp.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0ins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0mysql.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0row.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0sel.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0uins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0umod.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0undo.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0upd.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0rw.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0sync.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0sys.c: < 4 GB rows, doublewrite, hang fixes innobase/srv/srv0srv.c: Support raw disk partitions as data files innobase/srv/srv0start.c: Support raw disk partitions as data files innobase/include/srv0srv.h: Support raw disk partitions as data files
266 lines
7.8 KiB
C
266 lines
7.8 KiB
C
/******************************************************
|
|
The server main program
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 10/10/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
|
|
#ifndef srv0srv_h
|
|
#define srv0srv_h
|
|
|
|
#include "univ.i"
|
|
#include "sync0sync.h"
|
|
#include "os0sync.h"
|
|
#include "com0com.h"
|
|
#include "que0types.h"
|
|
|
|
/* Server parameters which are read from the initfile */
|
|
|
|
extern char* srv_data_home;
|
|
extern char* srv_logs_home;
|
|
extern char* srv_arch_dir;
|
|
|
|
extern ulint srv_n_data_files;
|
|
extern char** srv_data_file_names;
|
|
extern ulint* srv_data_file_sizes;
|
|
extern ulint* srv_data_file_is_raw_partition;
|
|
|
|
#define SRV_NEW_RAW 1
|
|
#define SRV_OLD_RAW 2
|
|
|
|
extern char** srv_log_group_home_dirs;
|
|
|
|
extern ulint srv_n_log_groups;
|
|
extern ulint srv_n_log_files;
|
|
extern ulint srv_log_file_size;
|
|
extern ibool srv_log_archive_on;
|
|
extern ulint srv_log_buffer_size;
|
|
extern ibool srv_flush_log_at_trx_commit;
|
|
|
|
extern ibool srv_use_native_aio;
|
|
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_n_file_io_threads;
|
|
|
|
extern ibool srv_archive_recovery;
|
|
extern dulint srv_archive_recovery_limit_lsn;
|
|
|
|
extern ulint srv_lock_wait_timeout;
|
|
|
|
extern char* srv_unix_file_flush_method_str;
|
|
extern ulint srv_unix_file_flush_method;
|
|
|
|
extern ibool srv_use_doublewrite_buf;
|
|
|
|
extern ibool srv_set_thread_priorities;
|
|
extern int srv_query_thread_priority;
|
|
|
|
/*-------------------------------------------*/
|
|
|
|
extern ibool srv_print_innodb_monitor;
|
|
extern ulint srv_n_spin_wait_rounds;
|
|
extern ulint srv_spin_wait_delay;
|
|
extern ibool srv_priority_boost;
|
|
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_sim_disk_wait_pct;
|
|
extern ulint srv_sim_disk_wait_len;
|
|
extern ibool srv_sim_disk_wait_by_yield;
|
|
extern ibool srv_sim_disk_wait_by_wait;
|
|
|
|
extern ibool srv_measure_contention;
|
|
extern ibool srv_measure_by_spin;
|
|
|
|
extern ibool srv_print_thread_releases;
|
|
extern ibool srv_print_lock_waits;
|
|
extern ibool srv_print_buf_io;
|
|
extern ibool srv_print_log_io;
|
|
extern ibool srv_print_parsed_sql;
|
|
extern ibool srv_print_latch_waits;
|
|
|
|
extern ibool srv_test_nocache;
|
|
extern ibool srv_test_cache_evict;
|
|
|
|
extern ibool srv_test_extra_mutexes;
|
|
extern ibool srv_test_sync;
|
|
extern ulint srv_test_n_threads;
|
|
extern ulint srv_test_n_loops;
|
|
extern ulint srv_test_n_free_rnds;
|
|
extern ulint srv_test_n_reserved_rnds;
|
|
extern ulint srv_test_n_mutexes;
|
|
extern ulint srv_test_array_size;
|
|
|
|
extern ulint srv_activity_count;
|
|
|
|
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
|
|
query threads, and lock table: we allocate
|
|
it from dynamic memory to get it to the
|
|
same DRAM page as other hotspot semaphores */
|
|
#define kernel_mutex (*kernel_mutex_temp)
|
|
|
|
typedef struct srv_sys_struct srv_sys_t;
|
|
|
|
/* The server system */
|
|
extern srv_sys_t* srv_sys;
|
|
|
|
/* Alternatives for fiel flush option in Unix; see the InnoDB manual about
|
|
what these mean */
|
|
#define SRV_UNIX_FDATASYNC 1
|
|
#define SRV_UNIX_O_DSYNC 2
|
|
#define SRV_UNIX_LITTLESYNC 3
|
|
#define SRV_UNIX_NOSYNC 4
|
|
|
|
/*************************************************************************
|
|
Boots Innobase server. */
|
|
|
|
ulint
|
|
srv_boot(void);
|
|
/*==========*/
|
|
/* out: DB_SUCCESS or error code */
|
|
/*************************************************************************
|
|
Gets the number of threads in the system. */
|
|
|
|
ulint
|
|
srv_get_n_threads(void);
|
|
/*===================*/
|
|
/*************************************************************************
|
|
Returns the calling thread type. */
|
|
|
|
ulint
|
|
srv_get_thread_type(void);
|
|
/*=====================*/
|
|
/* out: SRV_COM, ... */
|
|
/*************************************************************************
|
|
Releases threads of the type given from suspension in the thread table.
|
|
NOTE! The server mutex has to be reserved by the caller! */
|
|
|
|
ulint
|
|
srv_release_threads(
|
|
/*================*/
|
|
/* out: number of threads released: this may be
|
|
< n if not enough threads were suspended at the
|
|
moment */
|
|
ulint type, /* in: thread type */
|
|
ulint n); /* in: number of threads to release */
|
|
/*************************************************************************
|
|
The master thread controlling the server. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_master_thread(
|
|
/*==============*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/*************************************************************************
|
|
Reads a keyword and a value from a file. */
|
|
|
|
ulint
|
|
srv_read_init_val(
|
|
/*==============*/
|
|
/* out: DB_SUCCESS or error code */
|
|
FILE* initfile, /* in: file pointer */
|
|
char* keyword, /* in: keyword before value(s), or NULL if
|
|
no keyword read */
|
|
char* str_buf, /* in/out: buffer for a string value to read,
|
|
buffer size must be 10000 bytes, if NULL
|
|
then not read */
|
|
ulint* num_val, /* out: numerical value to read, if NULL
|
|
then not read */
|
|
ibool print_not_err); /* in: if TRUE, then we will not print
|
|
error messages to console */
|
|
/***********************************************************************
|
|
Tells the Innobase server that there has been activity in the database
|
|
and wakes up the master thread if it is suspended (not sleeping). Used
|
|
in the MySQL interface. Note that there is a small chance that the master
|
|
thread stays suspended (we do not protect our operation with the kernel
|
|
mutex, for performace reasons). */
|
|
|
|
void
|
|
srv_active_wake_master_thread(void);
|
|
/*===============================*/
|
|
/*******************************************************************
|
|
Puts a MySQL OS thread to wait for a lock to be released. */
|
|
|
|
ibool
|
|
srv_suspend_mysql_thread(
|
|
/*=====================*/
|
|
/* out: TRUE if the lock wait timeout was
|
|
exceeded */
|
|
que_thr_t* thr); /* in: query thread associated with
|
|
the MySQL OS thread */
|
|
/************************************************************************
|
|
Releases a MySQL OS thread waiting for a lock to be released, if the
|
|
thread is already suspended. */
|
|
|
|
void
|
|
srv_release_mysql_thread_if_suspended(
|
|
/*==================================*/
|
|
que_thr_t* thr); /* in: query thread associated with the
|
|
MySQL OS thread */
|
|
/*************************************************************************
|
|
A thread which wakes up threads whose lock wait may have lasted too long. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_lock_timeout_monitor_thread(
|
|
/*============================*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
|
|
|
|
/* Types for the threads existing in the system. Threads of types 4 - 9
|
|
are called utility threads. Note that utility threads are mainly disk
|
|
bound, except that version threads 6 - 7 may also be CPU bound, if
|
|
cleaning versions from the buffer pool. */
|
|
|
|
#define SRV_COM 1 /* threads serving communication and queries */
|
|
#define SRV_CONSOLE 2 /* thread serving console */
|
|
#define SRV_WORKER 3 /* threads serving parallelized queries and
|
|
queries released from lock wait */
|
|
#define SRV_BUFFER 4 /* thread flushing dirty buffer blocks,
|
|
not currently in use */
|
|
#define SRV_RECOVERY 5 /* threads finishing a recovery,
|
|
not currently in use */
|
|
#define SRV_INSERT 6 /* thread flushing the insert buffer to disk,
|
|
not currently in use */
|
|
#define SRV_MASTER 7 /* the master thread, (whose type number must
|
|
be biggest) */
|
|
|
|
/* Thread slot in the thread table */
|
|
typedef struct srv_slot_struct srv_slot_t;
|
|
|
|
/* Thread table is an array of slots */
|
|
typedef srv_slot_t srv_table_t;
|
|
|
|
/* The server system struct */
|
|
struct srv_sys_struct{
|
|
os_event_t operational; /* created threads must wait for the
|
|
server to become operational by
|
|
waiting for this event */
|
|
com_endpoint_t* endpoint; /* the communication endpoint of the
|
|
server */
|
|
|
|
srv_table_t* threads; /* server thread table */
|
|
UT_LIST_BASE_NODE_T(que_thr_t)
|
|
tasks; /* task queue */
|
|
};
|
|
|
|
extern ulint srv_n_threads_active[];
|
|
|
|
#endif
|