Commit 921d87d4 authored by Jan Lindström's avatar Jan Lindström

Fixed issue on xtradb shutdown merge error. Multi-threaded flush threads

where not shut down properly.
parent 862b0344
...@@ -1973,6 +1973,10 @@ void pgcomp_init(void) ...@@ -1973,6 +1973,10 @@ void pgcomp_init(void)
{ {
os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &pgcomp_mtx); os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &pgcomp_mtx);
} }
void pgcomp_deinit(void)
{
os_fast_mutex_free(&pgcomp_mtx);
}
/*******************************************************************//** /*******************************************************************//**
Multi-threaded version of buf_flush_list Multi-threaded version of buf_flush_list
......
...@@ -1444,6 +1444,7 @@ extern void buf_flush_end(buf_pool_t* buf_pool, enum buf_flush flush_type); ...@@ -1444,6 +1444,7 @@ extern void buf_flush_end(buf_pool_t* buf_pool, enum buf_flush flush_type);
extern void buf_flush_common(enum buf_flush flush_type, ulint page_count); extern void buf_flush_common(enum buf_flush flush_type, ulint page_count);
extern ulint buf_flush_batch(buf_pool_t* buf_pool, enum buf_flush flush_type, ulint min_n, lsn_t lsn_limit); extern ulint buf_flush_batch(buf_pool_t* buf_pool, enum buf_flush flush_type, ulint min_n, lsn_t lsn_limit);
extern void pgcomp_init(void); extern void pgcomp_init(void);
extern void pgcomp_deinit(void);
typedef enum wrk_status { typedef enum wrk_status {
WRK_ITEM_SET=0, // wrk-item is set WRK_ITEM_SET=0, // wrk-item is set
...@@ -3277,6 +3278,9 @@ innobase_shutdown_for_mysql(void) ...@@ -3277,6 +3278,9 @@ innobase_shutdown_for_mysql(void)
fprintf(stderr, "%s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count); fprintf(stderr, "%s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count);
#endif #endif
/* h. Remove the mutex */
pgcomp_deinit();
os_mutex_enter(os_sync_mutex); os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) { if (os_thread_count == 0) {
......
...@@ -1931,6 +1931,21 @@ buf_flush_wait_batch_end( ...@@ -1931,6 +1931,21 @@ buf_flush_wait_batch_end(
} }
/* JAN: TODO: */ /* JAN: TODO: */
void buf_pool_enter_LRU_mutex(
buf_pool_t* buf_pool)
{
ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
mutex_enter(&buf_pool->LRU_list_mutex);
}
void buf_pool_exit_LRU_mutex(
buf_pool_t* buf_pool)
{
ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
mutex_exit(&buf_pool->LRU_list_mutex);
}
/*******************************************************************//** /*******************************************************************//**
This utility flushes dirty blocks from the end of the LRU list and also This utility flushes dirty blocks from the end of the LRU list and also
puts replaceable clean pages from the end of the LRU list to the free puts replaceable clean pages from the end of the LRU list to the free
...@@ -2053,6 +2068,11 @@ void pgcomp_init(void) ...@@ -2053,6 +2068,11 @@ void pgcomp_init(void)
os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &pgcomp_mtx); os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &pgcomp_mtx);
} }
void pgcomp_deinit(void)
{
os_fast_mutex_free(&pgcomp_mtx);
}
/*******************************************************************//** /*******************************************************************//**
Multi-threaded version of buf_flush_list Multi-threaded version of buf_flush_list
*/ */
...@@ -2096,11 +2116,11 @@ pgcomp_buf_flush_list( ...@@ -2096,11 +2116,11 @@ pgcomp_buf_flush_list(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
gettimeofday(&p_start_time, 0x0); gettimeofday(&p_start_time, 0x0);
#endif #endif
os_fast_mutex_lock(&pgcomp_mtx); // os_fast_mutex_lock(&pgcomp_mtx);
pgcomp_flush_work_items(srv_buf_pool_instances, pgcomp_flush_work_items(srv_buf_pool_instances,
cnt_flush, BUF_FLUSH_LIST, cnt_flush, BUF_FLUSH_LIST,
min_n, lsn_limit); min_n, lsn_limit);
os_fast_mutex_unlock(&pgcomp_mtx); // os_fast_mutex_unlock(&pgcomp_mtx);
for (i = 0; i < srv_buf_pool_instances; i++) { for (i = 0; i < srv_buf_pool_instances; i++) {
if (n_processed) { if (n_processed) {
......
...@@ -1520,6 +1520,9 @@ extern void buf_flush_common(buf_flush_t flush_type, ulint page_count); ...@@ -1520,6 +1520,9 @@ extern void buf_flush_common(buf_flush_t flush_type, ulint page_count);
extern ulint buf_flush_batch(buf_pool_t* buf_pool, buf_flush_t flush_type, ulint min_n, lsn_t lsn_limit, bool limited_lru_scan, extern ulint buf_flush_batch(buf_pool_t* buf_pool, buf_flush_t flush_type, ulint min_n, lsn_t lsn_limit, bool limited_lru_scan,
flush_counters_t* n); flush_counters_t* n);
extern void pgcomp_init(void); extern void pgcomp_init(void);
extern void pgcomp_deinit(void);
extern void buf_pool_enter_LRU_mutex(buf_pool_t*);
extern void buf_pool_exit_LRU_mutex(buf_pool_t*);
typedef enum wrk_status { typedef enum wrk_status {
WRK_ITEM_SET=0, // wrk-item is set WRK_ITEM_SET=0, // wrk-item is set
...@@ -1555,7 +1558,6 @@ typedef struct wr_tsk { ...@@ -1555,7 +1558,6 @@ typedef struct wr_tsk {
lsn_t lsn_limit;//lsn limit for the buffer-pool flush operation lsn_t lsn_limit;//lsn limit for the buffer-pool flush operation
} wr_tsk_t; } wr_tsk_t;
typedef struct rd_tsk { typedef struct rd_tsk {
void *page_pool; //list of pages to decompress; void *page_pool; //list of pages to decompress;
} rd_tsk_t; } rd_tsk_t;
...@@ -1665,9 +1667,9 @@ int flush_pool_instance(wrk_t *wi) ...@@ -1665,9 +1667,9 @@ int flush_pool_instance(wrk_t *wi)
/* srv_LRU_scan_depth can be arbitrarily large value. /* srv_LRU_scan_depth can be arbitrarily large value.
* We cap it with current LRU size. * We cap it with current LRU size.
*/ */
buf_pool_mutex_enter(wi->wr.buf_pool); buf_pool_enter_LRU_mutex(wi->wr.buf_pool);
wi->wr.min = UT_LIST_GET_LEN(wi->wr.buf_pool->LRU); wi->wr.min = UT_LIST_GET_LEN(wi->wr.buf_pool->LRU);
buf_pool_mutex_exit(wi->wr.buf_pool); buf_pool_exit_LRU_mutex(wi->wr.buf_pool);
wi->wr.min = ut_min(srv_LRU_scan_depth,wi->wr.min); wi->wr.min = ut_min(srv_LRU_scan_depth,wi->wr.min);
} }
...@@ -3407,8 +3409,20 @@ innobase_shutdown_for_mysql(void) ...@@ -3407,8 +3409,20 @@ innobase_shutdown_for_mysql(void)
logs_empty_and_mark_files_at_shutdown() and should have logs_empty_and_mark_files_at_shutdown() and should have
already quit or is quitting right now. */ already quit or is quitting right now. */
/* g. Exit the multi threaded flush threads */
page_comp_io_thread_exit();
#ifdef UNIV_DEBUG
fprintf(stderr, "%s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count);
#endif
/* h. Remove the mutex */
pgcomp_deinit();
os_mutex_enter(os_sync_mutex); os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) { if (os_thread_count == 0) {
/* All the threads have exited or are just exiting; /* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their NOTE that the threads may not have completed their
......
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