summaryrefslogtreecommitdiff
path: root/storage/innobase/log/log0log.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/log/log0log.c')
-rw-r--r--storage/innobase/log/log0log.c90
1 files changed, 44 insertions, 46 deletions
diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
index d5b696074b3..386f9630baa 100644
--- a/storage/innobase/log/log0log.c
+++ b/storage/innobase/log/log0log.c
@@ -1,23 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -99,6 +82,18 @@ UNIV_INTERN ulint log_fsp_current_free_limit = 0;
/* Global log system variable */
UNIV_INTERN log_t* log_sys = NULL;
+#ifdef UNIV_PFS_RWLOCK
+UNIV_INTERN mysql_pfs_key_t checkpoint_lock_key;
+# ifdef UNIV_LOG_ARCHIVE
+UNIV_INTERN mysql_pfs_key_t archive_lock_key;
+# endif
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t log_sys_mutex_key;
+UNIV_INTERN mysql_pfs_key_t log_flush_order_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_DEBUG
UNIV_INTERN ibool log_do_write = TRUE;
#endif /* UNIV_DEBUG */
@@ -773,7 +768,11 @@ log_init(void)
{
log_sys = mem_alloc(sizeof(log_t));
- mutex_create(&log_sys->mutex, SYNC_LOG);
+ mutex_create(log_sys_mutex_key, &log_sys->mutex, SYNC_LOG);
+
+ mutex_create(log_flush_order_mutex_key,
+ &log_sys->log_flush_order_mutex,
+ SYNC_LOG_FLUSH_ORDER);
mutex_enter(&(log_sys->mutex));
@@ -829,7 +828,8 @@ log_init(void)
log_sys->last_checkpoint_lsn = log_sys->lsn;
log_sys->n_pending_checkpoint_writes = 0;
- rw_lock_create(&log_sys->checkpoint_lock, SYNC_NO_ORDER_CHECK);
+ rw_lock_create(checkpoint_lock_key, &log_sys->checkpoint_lock,
+ SYNC_NO_ORDER_CHECK);
log_sys->checkpoint_buf_ptr = mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE);
log_sys->checkpoint_buf = ut_align(log_sys->checkpoint_buf_ptr,
@@ -845,7 +845,8 @@ log_init(void)
log_sys->n_pending_archive_ios = 0;
- rw_lock_create(&log_sys->archive_lock, SYNC_NO_ORDER_CHECK);
+ rw_lock_create(archive_lock_key, &log_sys->archive_lock,
+ SYNC_NO_ORDER_CHECK);
log_sys->archive_buf = NULL;
@@ -1654,10 +1655,10 @@ log_preflush_pool_modified_pages(
recv_apply_hashed_log_recs(TRUE);
}
- n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX, new_oldest);
+ n_pages = buf_flush_list(ULINT_MAX, new_oldest);
if (sync) {
- buf_flush_wait_batch_end(BUF_FLUSH_LIST);
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
}
if (n_pages == ULINT_UNDEFINED) {
@@ -2013,7 +2014,7 @@ log_checkpoint(
return(TRUE);
}
- ut_ad(log_sys->written_to_all_lsn >= oldest_lsn);
+ ut_ad(log_sys->flushed_to_disk_lsn >= oldest_lsn);
if (log_sys->n_pending_checkpoint_writes > 0) {
/* A checkpoint write is running */
@@ -2371,13 +2372,15 @@ loop:
log_archived_file_name_gen(name, group->id,
group->archived_file_no + n_files);
- file_handle = os_file_create(name, open_mode, OS_FILE_AIO,
+ file_handle = os_file_create(innodb_file_log_key,
+ name, open_mode,
+ OS_FILE_AIO,
OS_DATA_FILE, &ret);
if (!ret && (open_mode == OS_FILE_CREATE)) {
file_handle = os_file_create(
- name, OS_FILE_OPEN, OS_FILE_AIO,
- OS_DATA_FILE, &ret);
+ innodb_file_log_key, name, OS_FILE_OPEN,
+ OS_FILE_AIO, OS_DATA_FILE, &ret);
}
if (!ret) {
@@ -3095,7 +3098,7 @@ loop:
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
- || srv_lock_timeout_and_monitor_active)) {
+ || srv_lock_timeout_active || srv_monitor_active)) {
mutex_exit(&kernel_mutex);
@@ -3128,17 +3131,14 @@ loop:
return; /* We SKIP ALL THE REST !! */
}
- /* Check that the master thread is suspended */
-
- if (srv_n_threads_active[SRV_MASTER] != 0) {
+ mutex_exit(&kernel_mutex);
- mutex_exit(&kernel_mutex);
+ /* Check that the background threads are suspended */
+ if (srv_is_any_background_thread_active()) {
goto loop;
}
- mutex_exit(&kernel_mutex);
-
mutex_enter(&(log_sys->mutex));
if (log_sys->n_pending_checkpoint_writes
@@ -3196,18 +3196,14 @@ loop:
mutex_exit(&(log_sys->mutex));
- mutex_enter(&kernel_mutex);
- /* Check that the master thread has stayed suspended */
- if (srv_n_threads_active[SRV_MASTER] != 0) {
+ /* Check that the background threads stay suspended */
+ if (srv_is_any_background_thread_active()) {
fprintf(stderr,
- "InnoDB: Warning: the master thread woke up"
+ "InnoDB: Warning: some background thread woke up"
" during shutdown\n");
- mutex_exit(&kernel_mutex);
-
goto loop;
}
- mutex_exit(&kernel_mutex);
fil_flush_file_spaces(FIL_TABLESPACE);
fil_flush_file_spaces(FIL_LOG);
@@ -3225,7 +3221,8 @@ loop:
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
- ut_a(srv_n_threads_active[SRV_MASTER] == 0);
+ ut_a(!srv_is_any_background_thread_active());
+
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
@@ -3246,7 +3243,8 @@ loop:
fil_close_all_files();
/* Make some checks that the server really is quiet */
- ut_a(srv_n_threads_active[SRV_MASTER] == 0);
+ ut_a(!srv_is_any_background_thread_active());
+
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
}
@@ -3287,9 +3285,9 @@ log_check_log_recs(
ut_memcpy(scan_buf, start, end - start);
- recv_scan_log_recs((buf_pool->curr_size
- - recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
- FALSE, scan_buf, end - start,
+ recv_scan_log_recs((buf_pool_get_n_pages()
+ - (recv_n_pool_free_frames * srv_buf_pool_instances))
+ * UNIV_PAGE_SIZE, FALSE, scan_buf, end - start,
ut_uint64_align_down(buf_start_lsn,
OS_FILE_LOG_BLOCK_SIZE),
&contiguous_lsn, &scanned_lsn);