Commit 859714e7 authored by Marko Mäkelä's avatar Marko Mäkelä

Simplify up InnoDB redo log system startup and shutdown

recv_sys_init(): Remove the parameter.

recv_sys_create(): Merge to recv_sys_init().

recv_sys_mem_free(): Merge to recv_sys_close().

log_mem_free(): Merge to log_shutdown().
parent 8143ef1b
......@@ -407,16 +407,9 @@ Closes all log groups. */
void
log_group_close_all(void);
/*=====================*/
/********************************************************//**
Shutdown the log system but do not release all the memory. */
void
log_shutdown(void);
/*==============*/
/********************************************************//**
Free the log system data structures. */
/** Shut down the redo log subsystem. */
void
log_mem_free(void);
/*==============*/
log_shutdown();
/** Whether to generate and require checksums on the redo log pages */
extern my_bool innodb_log_checksums;
......
......@@ -81,27 +81,12 @@ recv_reset_logs(
OS_FILE_LOG_BLOCK_SIZE, after
which we add
LOG_BLOCK_HDR_SIZE */
/********************************************************//**
Creates the recovery system. */
void
recv_sys_create(void);
/*=================*/
/**********************************************************//**
Release recovery system mutexes. */
void
recv_sys_close(void);
/*================*/
/********************************************************//**
Frees the recovery system memory. */
/** Clean up after recv_sys_init() */
void
recv_sys_mem_free(void);
/*===================*/
/********************************************************//**
Inits the recovery system for a recovery operation. */
recv_sys_close();
/** Initialize the redo log recovery subsystem. */
void
recv_sys_init(
/*==========*/
ulint available_memory); /*!< in: available memory in bytes */
recv_sys_init();
/********************************************************//**
Frees the recovery system. */
void
......
......@@ -2261,11 +2261,9 @@ log_group_close_all(void)
log_group_close(&log_sys->log);
}
/********************************************************//**
Shutdown the log system but do not release all the memory. */
/** Shut down the redo log subsystem. */
void
log_shutdown(void)
/*==============*/
log_shutdown()
{
log_group_close_all();
......@@ -2289,20 +2287,8 @@ log_shutdown(void)
}
recv_sys_close();
}
/********************************************************//**
Free the log system data structures. */
void
log_mem_free(void)
/*==============*/
{
if (log_sys != NULL) {
recv_sys_mem_free();
ut_free(log_sys);
log_sys = NULL;
}
ut_free(log_sys);
log_sys = NULL;
}
/******************************************************//**
......
......@@ -415,31 +415,9 @@ fil_name_parse(
return(end_ptr);
}
/********************************************************//**
Creates the recovery system. */
void
recv_sys_create(void)
/*=================*/
{
if (recv_sys != NULL) {
return;
}
recv_sys = static_cast<recv_sys_t*>(ut_zalloc_nokey(sizeof(*recv_sys)));
mutex_create(LATCH_ID_RECV_SYS, &recv_sys->mutex);
mutex_create(LATCH_ID_RECV_WRITER, &recv_sys->writer_mutex);
recv_sys->heap = NULL;
recv_sys->addr_hash = NULL;
}
/********************************************************//**
Release recovery system mutexes. */
/** Clean up after recv_sys_init() */
void
recv_sys_close(void)
/*================*/
recv_sys_close()
{
if (recv_sys != NULL) {
recv_sys->dblwr.pages.clear();
......@@ -578,56 +556,41 @@ DECLARE_THREAD(recv_writer_thread)(
OS_THREAD_DUMMY_RETURN;
}
/************************************************************
Inits the recovery system for a recovery operation. */
/** Initialize the redo log recovery subsystem. */
void
recv_sys_init(
/*==========*/
ulint available_memory) /*!< in: available memory in bytes */
recv_sys_init()
{
if (recv_sys->heap != NULL) {
ut_ad(recv_sys == NULL);
return;
}
recv_sys = static_cast<recv_sys_t*>(ut_zalloc_nokey(sizeof(*recv_sys)));
mutex_enter(&(recv_sys->mutex));
mutex_create(LATCH_ID_RECV_SYS, &recv_sys->mutex);
mutex_create(LATCH_ID_RECV_WRITER, &recv_sys->writer_mutex);
recv_sys->heap = mem_heap_create_typed(256,
MEM_HEAP_FOR_RECV_SYS);
recv_sys->heap = mem_heap_create_typed(256, MEM_HEAP_FOR_RECV_SYS);
if (!srv_read_only_mode) {
recv_sys->flush_start = os_event_create(0);
recv_sys->flush_end = os_event_create(0);
}
ulint size = buf_pool_get_curr_size();
/* Set appropriate value of recv_n_pool_free_frames. */
if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) {
if (size >= 10 << 20) {
/* Buffer pool of size greater than 10 MB. */
recv_n_pool_free_frames = 512;
}
recv_sys->buf = static_cast<byte*>(
ut_malloc_nokey(RECV_PARSING_BUF_SIZE));
recv_sys->len = 0;
recv_sys->recovered_offset = 0;
recv_sys->addr_hash = hash_create(available_memory / 512);
recv_sys->n_addrs = 0;
recv_sys->apply_log_recs = FALSE;
recv_sys->apply_batch_on = FALSE;
recv_sys->found_corrupt_log = false;
recv_sys->found_corrupt_fs = false;
recv_sys->mlog_checkpoint_lsn = 0;
recv_sys->addr_hash = hash_create(size / 512);
recv_sys->progress_time = ut_time();
recv_max_page_lsn = 0;
/* Call the constructor for recv_sys_t::dblwr member */
new (&recv_sys->dblwr) recv_dblwr_t();
mutex_exit(&(recv_sys->mutex));
}
/** Empty a fully processed hash table. */
......
......@@ -1831,8 +1831,7 @@ innobase_start_or_create_for_mysql()
fsp_init();
log_sys_init();
recv_sys_create();
recv_sys_init(buf_pool_get_curr_size());
recv_sys_init();
lock_sys_create(srv_lock_table_size);
/* Create i/o-handler threads: */
......@@ -2907,7 +2906,8 @@ innodb_shutdown()
/* 4. Free all allocated memory */
pars_lexer_close();
log_mem_free();
recv_sys_close();
ut_ad(buf_pool_ptr || !srv_was_started);
if (buf_pool_ptr) {
buf_pool_free(srv_buf_pool_instances);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment