summaryrefslogtreecommitdiff
path: root/innobase/srv/srv0srv.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/srv/srv0srv.c')
-rw-r--r--innobase/srv/srv0srv.c675
1 files changed, 0 insertions, 675 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 4ff9a9ce1f7..88809ecbd09 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -883,122 +883,6 @@ srv_release_max_if_no_queries(void)
mutex_exit(&kernel_mutex);
}
-#ifdef notdefined
-/***********************************************************************
-Releases one utility thread if no queries are active and
-the high-water mark 2 for the utility is exceeded. */
-static
-void
-srv_release_one_if_no_queries(void)
-/*===============================*/
-{
- ulint m;
- ulint type;
-
- mutex_enter(&kernel_mutex);
-
- if (srv_n_threads_active[SRV_COM] > 0) {
- mutex_exit(&kernel_mutex);
-
- return;
- }
-
- type = SRV_RECOVERY;
-
- m = 1;
-
- if ((srv_meter[type] > srv_meter_high_water2[type])
- && (srv_n_threads_active[type] < m)) {
-
- srv_release_threads(type, m - srv_n_threads_active[type]);
-
- printf("Releasing one background\n");
- }
-
- mutex_exit(&kernel_mutex);
-}
-
-/***********************************************************************
-Decrements the utility meter by the value given and suspends the calling
-thread, which must be an utility thread of the type given, if necessary. */
-static
-void
-srv_decrement_meter(
-/*================*/
- ulint type, /* in: utility type */
- ulint n) /* in: value to subtract from meter */
-{
- ulint opt;
- os_event_t event;
-
- mutex_enter(&kernel_mutex);
-
- if (srv_meter[type] < n) {
- srv_meter[type] = 0;
- } else {
- srv_meter[type] -= n;
- }
-
- opt = srv_max_n_utilities(type);
-
- if (opt < srv_n_threads_active[type]) {
-
- event = srv_suspend_thread();
- mutex_exit(&kernel_mutex);
-
- os_event_wait(event);
- } else {
- mutex_exit(&kernel_mutex);
- }
-}
-#endif
-
-/*************************************************************************
-Implements the server console. */
-
-ulint
-srv_console(
-/*========*/
- /* out: return code, not used */
- void* arg) /* in: argument, not used */
-{
- char command[256];
-
- UT_NOT_USED(arg);
-
- mutex_enter(&kernel_mutex);
- srv_table_reserve_slot(SRV_CONSOLE);
- mutex_exit(&kernel_mutex);
-
- os_event_wait(srv_sys->operational);
-
- for (;;) {
- scanf("%s", command);
-
- srv_inc_thread_count(SRV_CONSOLE);
-
- if (command[0] == 'c') {
- printf("Making checkpoint\n");
-
- log_make_checkpoint_at(ut_dulint_max, TRUE);
-
- printf("Checkpoint completed\n");
-
- } else if (command[0] == 'd') {
- srv_sim_disk_wait_pct = atoi(command + 1);
-
- printf(
- "Starting disk access simulation with pct %lu\n",
- (ulong) srv_sim_disk_wait_pct);
- } else {
- printf("\nNot supported!\n");
- }
-
- srv_dec_thread_count(SRV_CONSOLE);
- }
-
- return(0); /* Not reached */
-}
/*************************************************************************
Creates the first communication endpoint for the server. This
@@ -1028,69 +912,6 @@ srv_communication_init(
ut_a(ret == 0);
}
-#ifdef notdefined
-
-/*************************************************************************
-Implements the recovery utility. */
-static
-ulint
-srv_recovery_thread(
-/*================*/
- /* out: return code, not used */
- void* arg) /* in: not used */
-{
- ulint slot_no;
- os_event_t event;
-
- UT_NOT_USED(arg);
-
- slot_no = srv_table_reserve_slot(SRV_RECOVERY);
-
- os_event_wait(srv_sys->operational);
-
- for (;;) {
- /* Finish a possible recovery */
-
- srv_inc_thread_count(SRV_RECOVERY);
-
-/* recv_recovery_from_checkpoint_finish(); */
-
- srv_dec_thread_count(SRV_RECOVERY);
-
- mutex_enter(&kernel_mutex);
- event = srv_suspend_thread();
- mutex_exit(&kernel_mutex);
-
- /* Wait for somebody to release this thread; (currently, this
- should never be released) */
-
- os_event_wait(event);
- }
-
- return(0);
-}
-
-/*************************************************************************
-Implements the purge utility. */
-
-ulint
-srv_purge_thread(
-/*=============*/
- /* out: return code, not used */
- void* arg) /* in: not used */
-{
- UT_NOT_USED(arg);
-
- os_event_wait(srv_sys->operational);
-
- for (;;) {
- trx_purge();
- }
-
- return(0);
-}
-#endif /* notdefined */
-
/*************************************************************************
Creates the utility threads. */
@@ -1120,58 +941,6 @@ srv_create_utility_threads(void)
ut_a(thread); */
}
-#ifdef notdefined
-/*************************************************************************
-Implements the communication threads. */
-static
-ulint
-srv_com_thread(
-/*===========*/
- /* out: return code; not used */
- void* arg) /* in: not used */
-{
- byte* msg_buf;
- byte* addr_buf;
- ulint msg_len;
- ulint addr_len;
- ulint ret;
-
- UT_NOT_USED(arg);
-
- srv_table_reserve_slot(SRV_COM);
-
- os_event_wait(srv_sys->operational);
-
- msg_buf = mem_alloc(com_endpoint_get_max_size(srv_sys->endpoint));
- addr_buf = mem_alloc(COM_MAX_ADDR_LEN);
-
- for (;;) {
- ret = com_recvfrom(srv_sys->endpoint, msg_buf,
- com_endpoint_get_max_size(srv_sys->endpoint),
- &msg_len, (char*)addr_buf, COM_MAX_ADDR_LEN,
- &addr_len);
- ut_a(ret == 0);
-
- srv_inc_thread_count(SRV_COM);
-
- sess_process_cli_msg(msg_buf, msg_len, addr_buf, addr_len);
-
-/* srv_increment_meter(SRV_RECOVERY, 1); */
-
- srv_dec_thread_count(SRV_COM);
-
- /* Release one utility thread for each utility if
- high water mark 2 is exceeded and there are no
- active queries. This is done to utilize possible
- quiet time in the server. */
-
- srv_release_one_if_no_queries();
- }
-
- return(0);
-}
-#endif
-
/*************************************************************************
Creates the communication threads. */
@@ -1191,53 +960,6 @@ srv_create_com_threads(void)
}
}
-#ifdef notdefined
-/*************************************************************************
-Implements the worker threads. */
-static
-ulint
-srv_worker_thread(
-/*==============*/
- /* out: return code, not used */
- void* arg) /* in: not used */
-{
- os_event_t event;
-
- UT_NOT_USED(arg);
-
- srv_table_reserve_slot(SRV_WORKER);
-
- os_event_wait(srv_sys->operational);
-
- for (;;) {
- mutex_enter(&kernel_mutex);
- event = srv_suspend_thread();
- mutex_exit(&kernel_mutex);
-
- /* Wait for somebody to release this thread */
- os_event_wait(event);
-
- srv_inc_thread_count(SRV_WORKER);
-
- /* Check in the server task queue if there is work for this
- thread, and do the work */
-
- srv_que_task_queue_check();
-
- srv_dec_thread_count(SRV_WORKER);
-
- /* Release one utility thread for each utility if
- high water mark 2 is exceeded and there are no
- active queries. This is done to utilize possible
- quiet time in the server. */
-
- srv_release_one_if_no_queries();
- }
-
- return(0);
-}
-#endif
-
/*************************************************************************
Creates the worker threads. */
@@ -1258,403 +980,6 @@ srv_create_worker_threads(void)
}
}
-#ifdef notdefined
-/*************************************************************************
-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 */
-{
- ulint ret;
- char scan_buf[10000];
-
- if (keyword == NULL) {
-
- goto skip_keyword;
- }
-
- ret = fscanf(initfile, "%9999s", scan_buf);
-
- if (ret == 0 || ret == EOF || 0 != ut_strcmp(scan_buf, keyword)) {
- if (print_not_err) {
-
- return(DB_ERROR);
- }
-
- printf("Error in InnoDB booting: keyword %s not found\n",
- keyword);
- printf("from the initfile!\n");
-
- return(DB_ERROR);
- }
-skip_keyword:
- if (num_val == NULL && str_buf == NULL) {
-
- return(DB_SUCCESS);
- }
-
- ret = fscanf(initfile, "%9999s", scan_buf);
-
- if (ret == EOF || ret == 0) {
- if (print_not_err) {
-
- return(DB_ERROR);
- }
-
- printf(
- "Error in InnoDB booting: could not read first value after %s\n",
- keyword);
- printf("from the initfile!\n");
-
- return(DB_ERROR);
- }
-
- if (str_buf) {
- ut_memcpy(str_buf, scan_buf, 10000);
-
- printf("init keyword %s value %s read\n", keyword, str_buf);
-
- if (!num_val) {
- return(DB_SUCCESS);
- }
-
- ret = fscanf(initfile, "%9999s", scan_buf);
-
- if (ret == EOF || ret == 0) {
-
- if (print_not_err) {
-
- return(DB_ERROR);
- }
-
- printf(
- "Error in InnoDB booting: could not read second value after %s\n",
- keyword);
- printf("from the initfile!\n");
-
- return(DB_ERROR);
- }
- }
-
- if (ut_strlen(scan_buf) > 9) {
-
- if (print_not_err) {
-
- return(DB_ERROR);
- }
-
- printf(
- "Error in InnoDB booting: numerical value too big after %s\n",
- keyword);
- printf("in the initfile!\n");
-
- return(DB_ERROR);
- }
-
- *num_val = (ulint)atoi(scan_buf);
-
- if (*num_val >= 1000000000) {
-
- if (print_not_err) {
-
- return(DB_ERROR);
- }
-
- printf(
- "Error in InnoDB booting: numerical value too big after %s\n",
- keyword);
- printf("in the initfile!\n");
-
- return(DB_ERROR);
- }
-
- printf("init keyword %s value %lu read\n", keyword, *num_val);
-
- return(DB_SUCCESS);
-}
-
-/*************************************************************************
-Reads keywords and values from an initfile. */
-
-ulint
-srv_read_initfile(
-/*==============*/
- /* out: DB_SUCCESS or error code */
- FILE* initfile) /* in: file pointer */
-{
- char str_buf[10000];
- ulint n;
- ulint i;
- ulint ulint_val;
- ulint val1;
- ulint val2;
- ulint err;
-
- err = srv_read_init_val(initfile, "INNOBASE_DATA_HOME_DIR",
- str_buf, NULL, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_data_home = ut_malloc(ut_strlen(str_buf) + 1);
- ut_memcpy(srv_data_home, str_buf, ut_strlen(str_buf) + 1);
-
- err = srv_read_init_val(initfile,"TABLESPACE_NUMBER_OF_DATA_FILES",
- NULL, &n, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_n_data_files = n;
-
- srv_data_file_names = ut_malloc(n * sizeof(char*));
- srv_data_file_sizes = ut_malloc(n * sizeof(ulint));
-
- for (i = 0; i < n; i++) {
- err = srv_read_init_val(initfile,
- "DATA_FILE_PATH_AND_SIZE_MB",
- str_buf, &ulint_val, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_data_file_names[i] = ut_malloc(ut_strlen(str_buf) + 1);
- ut_memcpy(srv_data_file_names[i], str_buf,
- ut_strlen(str_buf) + 1);
- srv_data_file_sizes[i] = ulint_val
- * ((1024 * 1024) / UNIV_PAGE_SIZE);
- }
-
- err = srv_read_init_val(initfile,
- "NUMBER_OF_MIRRORED_LOG_GROUPS", NULL,
- &srv_n_log_groups, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- err = srv_read_init_val(initfile,
- "NUMBER_OF_LOG_FILES_IN_GROUP", NULL,
- &srv_n_log_files, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- err = srv_read_init_val(initfile, "LOG_FILE_SIZE_KB", NULL,
- &srv_log_file_size, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_log_file_size = srv_log_file_size / (UNIV_PAGE_SIZE / 1024);
-
- srv_log_group_home_dirs = ut_malloc(srv_n_log_files * sizeof(char*));
-
- for (i = 0; i < srv_n_log_groups; i++) {
-
- err = srv_read_init_val(initfile,
- "INNOBASE_LOG_GROUP_HOME_DIR",
- str_buf, NULL, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_log_group_home_dirs[i] = ut_malloc(ut_strlen(str_buf) + 1);
- ut_memcpy(srv_log_group_home_dirs[i], str_buf,
- ut_strlen(str_buf) + 1);
- }
-
- err = srv_read_init_val(initfile, "INNOBASE_LOG_ARCH_DIR",
- str_buf, NULL, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_arch_dir = ut_malloc(ut_strlen(str_buf) + 1);
- ut_memcpy(srv_arch_dir, str_buf, ut_strlen(str_buf) + 1);
-
- err = srv_read_init_val(initfile, "LOG_ARCHIVE_ON(1/0)", NULL,
- &srv_log_archive_on, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- err = srv_read_init_val(initfile, "LOG_BUFFER_SIZE_KB", NULL,
- &srv_log_buffer_size, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_log_buffer_size = srv_log_buffer_size / (UNIV_PAGE_SIZE / 1024);
-
- err = srv_read_init_val(initfile, "FLUSH_LOG_AT_TRX_COMMIT(1/0)", NULL,
- &srv_flush_log_at_trx_commit, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- err = srv_read_init_val(initfile, "BUFFER_POOL_SIZE_MB", NULL,
- &srv_pool_size, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_pool_size = srv_pool_size * ((1024 * 1024) / UNIV_PAGE_SIZE);
-
- err = srv_read_init_val(initfile, "ADDITIONAL_MEM_POOL_SIZE_MB", NULL,
- &srv_mem_pool_size, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- srv_mem_pool_size = srv_mem_pool_size * 1024 * 1024;
-
- srv_lock_table_size = 20 * srv_pool_size;
-
- err = srv_read_init_val(initfile, "NUMBER_OF_FILE_IO_THREADS", NULL,
- &srv_n_file_io_threads, FALSE);
- if (err != DB_SUCCESS) return(err);
-
- err = srv_read_init_val(initfile, "SRV_RECOVER_FROM_BACKUP",
- NULL, NULL, TRUE);
- if (err == DB_SUCCESS) {
- srv_archive_recovery = TRUE;
- srv_archive_recovery_limit_lsn = ut_dulint_max;
-
- err = srv_read_init_val(initfile, NULL, NULL, &val1, TRUE);
- err = srv_read_init_val(initfile, NULL, NULL, &val2, TRUE);
-
- if (err == DB_SUCCESS) {
- srv_archive_recovery_limit_lsn =
- ut_dulint_create(val1, val2);
- }
- }
-
- /* err = srv_read_init_val(initfile,
- "SYNC_NUMBER_OF_SPIN_WAIT_ROUNDS", NULL,
- &srv_n_spin_wait_rounds);
-
- err = srv_read_init_val(initfile, "SYNC_SPIN_WAIT_DELAY", NULL,
- &srv_spin_wait_delay); */
- return(DB_SUCCESS);
-}
-
-/*************************************************************************
-Reads keywords and a values from an initfile. In case of an error, exits
-from the process. */
-
-void
-srv_read_initfile(
-/*==============*/
- FILE* initfile) /* in: file pointer */
-{
- char str_buf[10000];
- ulint ulint_val;
-
- srv_read_init_val(initfile, FALSE, "SRV_ENDPOINT_NAME", str_buf,
- &ulint_val);
- ut_a(ut_strlen(str_buf) < COM_MAX_ADDR_LEN);
-
- ut_memcpy(srv_endpoint_name, str_buf, COM_MAX_ADDR_LEN);
-
- srv_read_init_val(initfile, TRUE, "SRV_N_COM_THREADS", str_buf,
- &srv_n_com_threads);
-
- srv_read_init_val(initfile, TRUE, "SRV_N_WORKER_THREADS", str_buf,
- &srv_n_worker_threads);
-
- srv_read_init_val(initfile, TRUE, "SYNC_N_SPIN_WAIT_ROUNDS", str_buf,
- &srv_n_spin_wait_rounds);
-
- srv_read_init_val(initfile, TRUE, "SYNC_SPIN_WAIT_DELAY", str_buf,
- &srv_spin_wait_delay);
-
- srv_read_init_val(initfile, TRUE, "THREAD_PRIORITY_BOOST", str_buf,
- &srv_priority_boost);
-
- srv_read_init_val(initfile, TRUE, "N_SPACES", str_buf, &srv_n_spaces);
- srv_read_init_val(initfile, TRUE, "N_FILES", str_buf, &srv_n_files);
- srv_read_init_val(initfile, TRUE, "FILE_SIZE", str_buf,
- &srv_file_size);
-
- srv_read_init_val(initfile, TRUE, "N_LOG_GROUPS", str_buf,
- &srv_n_log_groups);
- srv_read_init_val(initfile, TRUE, "N_LOG_FILES", str_buf,
- &srv_n_log_files);
- srv_read_init_val(initfile, TRUE, "LOG_FILE_SIZE", str_buf,
- &srv_log_file_size);
- srv_read_init_val(initfile, TRUE, "LOG_ARCHIVE_ON", str_buf,
- &srv_log_archive_on);
- srv_read_init_val(initfile, TRUE, "LOG_BUFFER_SIZE", str_buf,
- &srv_log_buffer_size);
- srv_read_init_val(initfile, TRUE, "FLUSH_LOG_AT_TRX_COMMIT", str_buf,
- &srv_flush_log_at_trx_commit);
-
-
- srv_read_init_val(initfile, TRUE, "POOL_SIZE", str_buf,
- &srv_pool_size);
- srv_read_init_val(initfile, TRUE, "MEM_POOL_SIZE", str_buf,
- &srv_mem_pool_size);
- srv_read_init_val(initfile, TRUE, "LOCK_TABLE_SIZE", str_buf,
- &srv_lock_table_size);
-
- srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_PCT", str_buf,
- &srv_sim_disk_wait_pct);
-
- srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_LEN", str_buf,
- &srv_sim_disk_wait_len);
-
- srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_BY_YIELD", str_buf,
- &srv_sim_disk_wait_by_yield);
-
- srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_BY_WAIT", str_buf,
- &srv_sim_disk_wait_by_wait);
-
- srv_read_init_val(initfile, TRUE, "MEASURE_CONTENTION", str_buf,
- &srv_measure_contention);
-
- srv_read_init_val(initfile, TRUE, "MEASURE_BY_SPIN", str_buf,
- &srv_measure_by_spin);
-
-
- srv_read_init_val(initfile, TRUE, "PRINT_THREAD_RELEASES", str_buf,
- &srv_print_thread_releases);
-
- srv_read_init_val(initfile, TRUE, "PRINT_LOCK_WAITS", str_buf,
- &srv_print_lock_waits);
- if (srv_print_lock_waits) {
- lock_print_waits = TRUE;
- }
-
- srv_read_init_val(initfile, TRUE, "PRINT_BUF_IO", str_buf,
- &srv_print_buf_io);
- if (srv_print_buf_io) {
- buf_debug_prints = TRUE;
- }
-
- srv_read_init_val(initfile, TRUE, "PRINT_LOG_IO", str_buf,
- &srv_print_log_io);
- if (srv_print_log_io) {
- log_debug_writes = TRUE;
- }
-
- srv_read_init_val(initfile, TRUE, "PRINT_PARSED_SQL", str_buf,
- &srv_print_parsed_sql);
- if (srv_print_parsed_sql) {
- pars_print_lexed = TRUE;
- }
-
- srv_read_init_val(initfile, TRUE, "PRINT_LATCH_WAITS", str_buf,
- &srv_print_latch_waits);
-
- srv_read_init_val(initfile, TRUE, "TEST_EXTRA_MUTEXES", str_buf,
- &srv_test_extra_mutexes);
- srv_read_init_val(initfile, TRUE, "TEST_NOCACHE", str_buf,
- &srv_test_nocache);
- srv_read_init_val(initfile, TRUE, "TEST_CACHE_EVICT", str_buf,
- &srv_test_cache_evict);
-
- srv_read_init_val(initfile, TRUE, "TEST_SYNC", str_buf,
- &srv_test_sync);
- srv_read_init_val(initfile, TRUE, "TEST_N_THREADS", str_buf,
- &srv_test_n_threads);
- srv_read_init_val(initfile, TRUE, "TEST_N_LOOPS", str_buf,
- &srv_test_n_loops);
- srv_read_init_val(initfile, TRUE, "TEST_N_FREE_RNDS", str_buf,
- &srv_test_n_free_rnds);
- srv_read_init_val(initfile, TRUE, "TEST_N_RESERVED_RNDS", str_buf,
- &srv_test_n_reserved_rnds);
- srv_read_init_val(initfile, TRUE, "TEST_N_MUTEXES", str_buf,
- &srv_test_n_mutexes);
- srv_read_init_val(initfile, TRUE, "TEST_ARRAY_SIZE", str_buf,
- &srv_test_array_size);
-}
-#endif
/*************************************************************************
Initializes the server. */