mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Applying InnoDB Plugin 1.0.6 snapshot,part 1. Fixes BUG#45992 and BUG#46656
Detailed revision comments: r6130 | marko | 2009-11-02 11:42:56 +0200 (Mon, 02 Nov 2009) | 9 lines branches/zip: Free all resources at shutdown. Set pointers to NULL, so that Valgrind will not complain about freed data structures that are reachable via pointers. This addresses Bug #45992 and Bug #46656. This patch is mostly based on changes copied from branches/embedded-1.0, mainly c5432, c3439, c3134, c2994, c2978, but also some other code was copied. Some added cleanup code is specific to MySQL/InnoDB. rb://199 approved by Sunny Bains
This commit is contained in:
@@ -41,6 +41,12 @@ void
|
||||
btr_search_sys_create(
|
||||
/*==================*/
|
||||
ulint hash_size); /*!< in: hash index hash table size */
|
||||
/*****************************************************************//**
|
||||
Frees the adaptive search system at a database shutdown. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
btr_search_sys_free(void);
|
||||
/*=====================*/
|
||||
|
||||
/********************************************************************//**
|
||||
Disable the adaptive hash search system and empty the index. */
|
||||
|
@@ -1151,6 +1151,13 @@ void
|
||||
dict_ind_init(void);
|
||||
/*===============*/
|
||||
|
||||
/**********************************************************************//**
|
||||
Closes the data dictionary module. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
dict_close(void);
|
||||
/*============*/
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "dict0dict.ic"
|
||||
#endif
|
||||
|
@@ -224,15 +224,6 @@ fil_space_create(
|
||||
0 for uncompressed tablespaces */
|
||||
ulint purpose);/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
|
||||
/*******************************************************************//**
|
||||
Frees a space object from a the tablespace memory cache. Closes the files in
|
||||
the chain but does not delete them.
|
||||
@return TRUE if success */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
fil_space_free(
|
||||
/*===========*/
|
||||
ulint id); /*!< in: space id */
|
||||
/*******************************************************************//**
|
||||
Returns the size of the space in pages. The tablespace must be cached in the
|
||||
memory cache.
|
||||
@return space size, 0 if space not found */
|
||||
@@ -278,6 +269,12 @@ fil_init(
|
||||
ulint hash_size, /*!< in: hash table size */
|
||||
ulint max_n_open); /*!< in: max number of open files */
|
||||
/*******************************************************************//**
|
||||
Initializes the tablespace memory cache. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
fil_close(void);
|
||||
/*===========*/
|
||||
/*******************************************************************//**
|
||||
Opens all log files and system tablespace data files. They stay open until the
|
||||
database server shutdown. This should be called at a server startup after the
|
||||
space objects for the log and the system tablespace have been created. The
|
||||
|
@@ -356,6 +356,12 @@ void
|
||||
ibuf_print(
|
||||
/*=======*/
|
||||
FILE* file); /*!< in: file where to print */
|
||||
/******************************************************************//**
|
||||
Closes insert buffer and frees the data structures. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
ibuf_close(void);
|
||||
/*============*/
|
||||
|
||||
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
|
||||
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
|
||||
|
@@ -59,6 +59,12 @@ lock_sys_create(
|
||||
/*============*/
|
||||
ulint n_cells); /*!< in: number of slots in lock hash table */
|
||||
/*********************************************************************//**
|
||||
Closes the lock system at database shutdown. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
lock_sys_close(void);
|
||||
/*================*/
|
||||
/*********************************************************************//**
|
||||
Checks if some transaction has an implicit x-lock on a record in a clustered
|
||||
index.
|
||||
@return transaction which has the x-lock, or NULL */
|
||||
|
@@ -572,6 +572,18 @@ UNIV_INTERN
|
||||
void
|
||||
log_refresh_stats(void);
|
||||
/*===================*/
|
||||
/**********************************************************
|
||||
Shutdown the log system but do not release all the memory. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
log_shutdown(void);
|
||||
/*==============*/
|
||||
/**********************************************************
|
||||
Free the log system data structures. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
log_mem_free(void);
|
||||
/*==============*/
|
||||
|
||||
extern log_t* log_sys;
|
||||
|
||||
@@ -584,7 +596,7 @@ extern log_t* log_sys;
|
||||
#define LOG_RECOVER 98887331
|
||||
|
||||
/* The counting of lsn's starts from this value: this must be non-zero */
|
||||
#define LOG_START_LSN ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
|
||||
#define LOG_START_LSN ((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
|
||||
|
||||
#define LOG_BUFFER_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE)
|
||||
#define LOG_ARCHIVE_BUF_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE / 4)
|
||||
@@ -721,9 +733,12 @@ struct log_group_struct{
|
||||
ulint lsn_offset; /*!< the offset of the above lsn */
|
||||
ulint n_pending_writes;/*!< number of currently pending flush
|
||||
writes for this log group */
|
||||
byte** file_header_bufs_ptr;/*!< unaligned buffers */
|
||||
byte** file_header_bufs;/*!< buffers for each file
|
||||
header in the group */
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
/*-----------------------------*/
|
||||
byte** archive_file_header_bufs_ptr;/*!< unaligned buffers */
|
||||
byte** archive_file_header_bufs;/*!< buffers for each file
|
||||
header in the group */
|
||||
ulint archive_space_id;/*!< file space which
|
||||
@@ -742,10 +757,12 @@ struct log_group_struct{
|
||||
completion function then sets the new
|
||||
value to ..._file_no */
|
||||
ulint next_archived_offset; /*!< like the preceding field */
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
/*-----------------------------*/
|
||||
ib_uint64_t scanned_lsn; /*!< used only in recovery: recovery scan
|
||||
succeeded up to this lsn in this log
|
||||
group */
|
||||
byte* checkpoint_buf_ptr;/*!< unaligned checkpoint header */
|
||||
byte* checkpoint_buf; /*!< checkpoint header is written from
|
||||
this buffer to the group */
|
||||
UT_LIST_NODE_T(log_group_t)
|
||||
@@ -763,6 +780,7 @@ struct log_struct{
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
mutex_t mutex; /*!< mutex protecting the log */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
byte* buf_ptr; /* unaligned log buffer */
|
||||
byte* buf; /*!< log buffer */
|
||||
ulint buf_size; /*!< log buffer size in bytes */
|
||||
ulint max_buf_free; /*!< recommended maximum value of
|
||||
@@ -899,6 +917,7 @@ struct log_struct{
|
||||
should wait for this without owning
|
||||
the log mutex */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
byte* checkpoint_buf_ptr;/* unaligned checkpoint header */
|
||||
byte* checkpoint_buf; /*!< checkpoint header is read to this
|
||||
buffer */
|
||||
/* @} */
|
||||
|
@@ -239,6 +239,18 @@ UNIV_INTERN
|
||||
void
|
||||
recv_sys_create(void);
|
||||
/*=================*/
|
||||
/**********************************************************//**
|
||||
Release recovery system mutexes. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
recv_sys_close(void);
|
||||
/*================*/
|
||||
/********************************************************//**
|
||||
Frees the recovery system memory. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
recv_sys_mem_free(void);
|
||||
/*===================*/
|
||||
/********************************************************//**
|
||||
Inits the recovery system for a recovery operation. */
|
||||
UNIV_INTERN
|
||||
@@ -246,6 +258,12 @@ void
|
||||
recv_sys_init(
|
||||
/*==========*/
|
||||
ulint available_memory); /*!< in: available memory in bytes */
|
||||
/********************************************************//**
|
||||
Reset the state of the recovery system variables. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
recv_sys_var_init(void);
|
||||
/*===================*/
|
||||
/*******************************************************************//**
|
||||
Empties the hash table of stored log records, applying them to appropriate
|
||||
pages. */
|
||||
|
@@ -82,6 +82,13 @@ void
|
||||
mem_init(
|
||||
/*=====*/
|
||||
ulint size); /*!< in: common pool size in bytes */
|
||||
/******************************************************************//**
|
||||
Closes the memory system. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
mem_close(void);
|
||||
/*===========*/
|
||||
|
||||
/**************************************************************//**
|
||||
Use this macro instead of the corresponding function! Macro for memory
|
||||
heap creation. */
|
||||
|
@@ -62,6 +62,13 @@ mem_pool_create(
|
||||
/*============*/
|
||||
ulint size); /*!< in: pool size in bytes */
|
||||
/********************************************************************//**
|
||||
Frees a memory pool. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
mem_pool_free(
|
||||
/*==========*/
|
||||
mem_pool_t* pool); /*!< in, own: memory pool */
|
||||
/********************************************************************//**
|
||||
Allocates memory from a pool. NOTE: This low-level function should only be
|
||||
used in mem0mem.*!
|
||||
@return own: allocated memory buffer */
|
||||
|
@@ -620,6 +620,13 @@ os_aio_init(
|
||||
ulint n_write_segs, /*<! in: number of writer threads */
|
||||
ulint n_slots_sync); /*<! in: number of slots in the sync aio
|
||||
array */
|
||||
/***********************************************************************
|
||||
Frees the asynchronous io system. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_free(void);
|
||||
/*=============*/
|
||||
|
||||
/*******************************************************************//**
|
||||
Requests an asynchronous i/o operation.
|
||||
@return TRUE if request was queued successfully, FALSE if fail */
|
||||
|
@@ -583,6 +583,12 @@ pars_info_get_bound_id(
|
||||
pars_info_t* info, /*!< in: info struct */
|
||||
const char* name); /*!< in: bound id name to find */
|
||||
|
||||
/******************************************************************//**
|
||||
Release any resources used by the lexer. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
pars_lexer_close(void);
|
||||
/*==================*/
|
||||
|
||||
/** Extra information supplied for pars_sql(). */
|
||||
struct pars_info_struct {
|
||||
|
@@ -411,7 +411,7 @@ void
|
||||
srv_init(void);
|
||||
/*==========*/
|
||||
/*********************************************************************//**
|
||||
Frees the OS fast mutex created in srv_boot(). */
|
||||
Frees the data structures created in srv_init(). */
|
||||
UNIV_INTERN
|
||||
void
|
||||
srv_free(void);
|
||||
|
@@ -39,6 +39,12 @@ UNIV_INTERN
|
||||
void
|
||||
thr_local_init(void);
|
||||
/*================*/
|
||||
/****************************************************************//**
|
||||
Close the thread local storage module. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
thr_local_close(void);
|
||||
/*=================*/
|
||||
/*******************************************************************//**
|
||||
Creates a local storage struct for the calling new thread. */
|
||||
UNIV_INTERN
|
||||
|
@@ -141,6 +141,13 @@ void
|
||||
trx_i_s_cache_init(
|
||||
/*===============*/
|
||||
trx_i_s_cache_t* cache); /*!< out: cache to init */
|
||||
/*******************************************************************//**
|
||||
Free the INFORMATION SCHEMA trx related cache. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
trx_i_s_cache_free(
|
||||
/*===============*/
|
||||
trx_i_s_cache_t* cache); /*!< in/out: cache to free */
|
||||
|
||||
/*******************************************************************//**
|
||||
Issue a shared/read lock on the tables cache. */
|
||||
|
@@ -71,6 +71,12 @@ void
|
||||
trx_purge_sys_create(void);
|
||||
/*======================*/
|
||||
/********************************************************************//**
|
||||
Frees the global purge system control structure. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
trx_purge_sys_close(void);
|
||||
/*======================*/
|
||||
/************************************************************************
|
||||
Adds the update undo log as the first log in the history list. Removes the
|
||||
update undo log segment from the rseg slot if it is too big for reuse. */
|
||||
UNIV_INTERN
|
||||
|
@@ -125,6 +125,13 @@ trx_rseg_create(
|
||||
ulint max_size, /*!< in: max size in pages */
|
||||
ulint* id, /*!< out: rseg id */
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
/***************************************************************************
|
||||
Free's an instance of the rollback segment in memory. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
trx_rseg_mem_free(
|
||||
/*==============*/
|
||||
trx_rseg_t* rseg); /* in, own: instance to free */
|
||||
|
||||
|
||||
/* Number of undo log slots in a rollback segment file copy */
|
||||
|
@@ -334,6 +334,12 @@ void
|
||||
trx_sys_file_format_tag_init(void);
|
||||
/*==============================*/
|
||||
/*****************************************************************//**
|
||||
Shutdown/Close the transaction system. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
trx_sys_close(void);
|
||||
/*===============*/
|
||||
/*****************************************************************//**
|
||||
Get the name representation of the file format from its id.
|
||||
@return pointer to the name */
|
||||
UNIV_INTERN
|
||||
|
@@ -333,6 +333,13 @@ trx_undo_parse_discard_latest(
|
||||
byte* end_ptr,/*!< in: buffer end */
|
||||
page_t* page, /*!< in: page or NULL */
|
||||
mtr_t* mtr); /*!< in: mtr or NULL */
|
||||
/************************************************************************
|
||||
Frees an undo log memory copy. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
trx_undo_mem_free(
|
||||
/*==============*/
|
||||
trx_undo_t* undo); /* in: the undo object to be freed */
|
||||
|
||||
/* Types of an undo log segment */
|
||||
#define TRX_UNDO_INSERT 1 /* contains undo entries for inserts */
|
||||
|
@@ -44,14 +44,12 @@ sess_t*
|
||||
sess_open(void);
|
||||
/*============*/
|
||||
/*********************************************************************//**
|
||||
Closes a session, freeing the memory occupied by it, if it is in a state
|
||||
where it should be closed.
|
||||
@return TRUE if closed */
|
||||
Closes a session, freeing the memory occupied by it. */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
sess_try_close(
|
||||
/*===========*/
|
||||
sess_t* sess); /*!< in, own: session object */
|
||||
void
|
||||
sess_close(
|
||||
/*=======*/
|
||||
sess_t* sess); /* in, own: session object */
|
||||
|
||||
/* The session handle. All fields are protected by the kernel mutex */
|
||||
struct sess_struct{
|
||||
|
Reference in New Issue
Block a user