1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

InnoDB cleanup:

Disable log archiving code unless #ifdef UNIV_LOG_ARCHIVE
Remove (char*) casts of string constants; add const qualifiers
Remove some Hot Backup code unless #ifdef UNIV_HOTBACKUP


innobase/btr/btr0cur.c:
  Cast away constness from dfield_get_data() result
innobase/buf/buf0buf.c:
  Enclose a debug assertion in #ifdef UNIV_SYNC_DEBUG
innobase/buf/buf0rea.c:
  Corrected compile error #ifdef UNIV_DEBUG
innobase/dict/dict0boot.c:
  Remove (char*) casts of string constants
innobase/dict/dict0crea.c:
  Remove (char*) casts of string constants
innobase/dict/dict0dict.c:
  Enclosed a debug assertion in #ifdef UNIV_SYNC_DEBUG
  Replaced some debug assertions with preprocessor tests
  Add const qualifiers to string constants
innobase/dict/dict0load.c:
  Remove (char*) casts of string constants
innobase/fil/fil0fil.c:
  Remove (char*) casts of string constants
  Enclose debug assertions in #ifdef UNIV_SYNC_DEBUG
innobase/ha/ha0ha.c:
  Enclose debug assertion in #ifdef UNIV_SYNC_DEBUG
innobase/ibuf/ibuf0ibuf.c:
  Remove (char*) casts of string constants
innobase/include/buf0buf.ic:
  Add const qualifier to string parameter
innobase/include/fil0fil.h:
  Disable log archiving code unless #ifdef UNIV_LOG_ARCHIVE
innobase/include/log0recv.h:
  Disable log archiving code unless #ifdef UNIV_LOG_ARCHIVE
  Enclose ibbackup specific code in #ifdef UNIV_HOTBACKUP
innobase/include/mem0dbg.ic:
  Add const qualifiers to string parameters
innobase/include/srv0srv.h:
  Add const qualifiers to string constants
  Enclose srv_arch_dir and srv_log_archive_on #ifdef UNIV_LOG_ARCHIVE
innobase/include/sync0rw.ic:
  Add const qualifier to string parameter
innobase/include/sync0sync.ic:
  Add const qualifier to string parameter
innobase/log/log0log.c:
  Enclose log archiving code in #ifdef UNIV_LOG_ARCHIVE
  Do not cast string constants to (char*)
innobase/log/log0recv.c:
  Enclose ibbackup specific code in #ifdef UNIV_HOTBACKUP
  Enclose disabled log code in #ifdef UNIV_LOG_REPLICATE or UNIV_LOG_ARCHIVE
innobase/mem/mem0dbg.c:
  Add const qualifiers to string parameters
innobase/page/page0page.c:
  Remove (char*) casts of string constants
innobase/pars/pars0pars.c:
  Add const qualifier to string variable
innobase/row/row0ins.c:
  Remove (char*) casts of string constants
  Add const qualifiers to string parameters
  row_ins_foreign_check_on_constraint(): Allocate table_name dynamically
innobase/row/row0mysql.c:
  Remove (char*) casts of string constants
innobase/row/row0sel.c:
  Remove (char*) casts of string constants
innobase/srv/srv0srv.c:
  Remove (char*) casts of string constants
  Disable log archiving variables unless #ifdef UNIV_LOG_ARCHIVE
innobase/srv/srv0start.c:
  Disable log archiving code unless #ifdef UNIV_LOG_ARCHIVE
  Remove (char*) casts of string constants
innobase/sync/sync0rw.c:
  Remove (char*) casts of string constants
  Add const qualifier to string parameter
innobase/sync/sync0sync.c:
  Remove (char*) cast of string constant
  Add const qualifier to string parameter
innobase/trx/trx0roll.c:
  Remove (char*) cast of string constants
innobase/trx/trx0sys.c:
  Remove (char*) cast of string constants
innobase/trx/trx0trx.c:
  Remove (char*) cast of string constant
sql/ha_innodb.cc:
  Enclose log archiving code in #ifdef UNIV_LOG_ARCHIVE
This commit is contained in:
unknown
2004-05-27 15:27:43 +03:00
parent d366a2e4c9
commit a1bcf38257
33 changed files with 514 additions and 430 deletions

View File

@ -57,7 +57,7 @@ ulint srv_activity_count = 0;
ibool srv_lock_timeout_and_monitor_active = FALSE;
ibool srv_error_monitor_active = FALSE;
char* srv_main_thread_op_info = (char*) "";
const char* srv_main_thread_op_info = "";
/* Server parameters which are read from the initfile */
@ -65,7 +65,9 @@ char* srv_main_thread_op_info = (char*) "";
names, where the file name itself may also contain a path */
char* srv_data_home = NULL;
#ifdef UNIV_LOG_ARCHIVE
char* srv_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
ibool srv_file_per_table = FALSE; /* store to its own file each table
created by an user; data dictionary
@ -94,7 +96,6 @@ char** srv_log_group_home_dirs = NULL;
ulint srv_n_log_groups = ULINT_MAX;
ulint srv_n_log_files = ULINT_MAX;
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
ibool srv_log_archive_on = FALSE;
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
ulint srv_flush_log_at_trx_commit = 1;
@ -149,8 +150,11 @@ ulint srv_lock_table_size = ULINT_MAX;
ulint srv_n_file_io_threads = ULINT_MAX;
#ifdef UNIV_LOG_ARCHIVE
ibool srv_log_archive_on = FALSE;
ibool srv_archive_recovery = 0;
dulint srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
@ -921,11 +925,11 @@ retry:
os_fast_mutex_unlock(&srv_conc_mutex);
trx->op_info = (char*)"sleeping before joining InnoDB queue";
trx->op_info = "sleeping before joining InnoDB queue";
os_thread_sleep(50000);
trx->op_info = (char*)"";
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex);
@ -978,11 +982,11 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
trx->op_info = (char*)"waiting in InnoDB queue";
trx->op_info = "waiting in InnoDB queue";
os_event_wait(slot->event);
trx->op_info = (char*)"";
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex);
@ -1946,7 +1950,7 @@ loop:
/* ---- When there is database activity by users, we cycle in this
loop */
srv_main_thread_op_info = (char*) "reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
@ -1970,7 +1974,7 @@ loop:
for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
srv_main_thread_op_info = (char*)"sleeping";
srv_main_thread_op_info = "sleeping";
if (!skip_sleep) {
@ -1983,12 +1987,11 @@ loop:
can drop tables lazily after there no longer are SELECT
queries to them. */
srv_main_thread_op_info =
(char*)"doing background drop tables";
srv_main_thread_op_info = "doing background drop tables";
row_drop_tables_for_mysql_in_background();
srv_main_thread_op_info = (char*)"";
srv_main_thread_op_info = "";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
@ -1999,10 +2002,10 @@ loop:
is issued or the we have specified in my.cnf no flush
at transaction commit */
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
log_free_check();
/* If there were less than 5 i/os during the
@ -2015,11 +2018,10 @@ loop:
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info =
(char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
}
@ -2067,20 +2069,20 @@ loop:
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
srv_main_thread_op_info = (char*) "flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
}
/* We run a batch of insert buffer merge every 10 seconds,
even if the server were active */
srv_main_thread_op_info = (char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
/* We run a full purge every 10 seconds, even if the server
@ -2097,20 +2099,20 @@ loop:
goto background_loop;
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
n_pages_purged = trx_purge();
current_time = time(NULL);
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
last_flush_time = current_time;
}
}
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
/* Flush a few oldest pages to make a new checkpoint younger */
@ -2131,13 +2133,13 @@ loop:
ut_dulint_max);
}
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
/* Make a new checkpoint about once in 10 seconds */
log_checkpoint(TRUE, FALSE);
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
@ -2161,7 +2163,7 @@ background_loop:
/* The server has been quiet for a while: start running background
operations */
srv_main_thread_op_info = (char*)"doing background drop tables";
srv_main_thread_op_info = "doing background drop tables";
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
@ -2174,7 +2176,7 @@ background_loop:
os_thread_sleep(100000);
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
/* Run a full purge */
@ -2188,20 +2190,20 @@ background_loop:
break;
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
n_pages_purged = trx_purge();
current_time = time(NULL);
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
last_flush_time = current_time;
}
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2210,7 +2212,7 @@ background_loop:
}
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
n_bytes_merged = 0;
@ -2218,7 +2220,7 @@ background_loop:
n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2228,10 +2230,10 @@ background_loop:
mutex_exit(&kernel_mutex);
flush_loop:
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2240,15 +2242,14 @@ flush_loop:
}
mutex_exit(&kernel_mutex);
srv_main_thread_op_info =
(char*) "waiting for buffer pool flush to end";
srv_main_thread_op_info = "waiting for buffer pool flush to end";
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
log_checkpoint(TRUE, FALSE);
@ -2260,7 +2261,7 @@ flush_loop:
goto flush_loop;
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2269,8 +2270,7 @@ flush_loop:
}
mutex_exit(&kernel_mutex);
/*
srv_main_thread_op_info =
(char*)"archiving log (if log archive is on)";
srv_main_thread_op_info = "archiving log (if log archive is on)";
log_archive_do(FALSE, &n_bytes_archived);
*/
@ -2301,7 +2301,7 @@ flush_loop:
master thread to wait for more server activity */
suspend_thread:
srv_main_thread_op_info = (char*)"suspending";
srv_main_thread_op_info = "suspending";
mutex_enter(&kernel_mutex);
@ -2315,7 +2315,7 @@ suspend_thread:
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*)"waiting for server activity";
srv_main_thread_op_info = "waiting for server activity";
os_event_wait(event);