diff options
author | unknown <heikki@hundin.mysql.fi> | 2004-10-13 20:04:52 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2004-10-13 20:04:52 +0300 |
commit | 7b1f818d913f4ff96c2e33a7ffc4f3ad688374a5 (patch) | |
tree | 085896d71c407139f1c00651549adbe7462bde15 /innobase | |
parent | 8983293d3b2449d0ecb2cd070e6dbd21610bbc1b (diff) | |
download | mariadb-git-7b1f818d913f4ff96c2e33a7ffc4f3ad688374a5.tar.gz |
srv0srv.c, log0log.c, srv0srv.h, ha_innodb.cc, ha_innodb.h:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
sql/ha_innodb.h:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
sql/ha_innodb.cc:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
innobase/include/srv0srv.h:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
innobase/log/log0log.c:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
innobase/srv/srv0srv.c:
Implement innobase_very_fast_shutdown and innobase_start_trx_and_assign_read_view(); these were requested by Guilhem
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/include/srv0srv.h | 5 | ||||
-rw-r--r-- | innobase/log/log0log.c | 39 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 23 |
3 files changed, 54 insertions, 13 deletions
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 2050e5b45c0..ecd57bae47c 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -100,7 +100,10 @@ extern ulint srv_max_n_threads; extern lint srv_conc_n_threads; extern ibool srv_fast_shutdown; - +extern ibool srv_very_fast_shutdown; /* if this TRUE, do not flush the + buffer pool to data files at the + shutdown; we effectively 'crash' + InnoDB */ extern ibool srv_innodb_status; extern ibool srv_use_doublewrite_buf; diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index b6357fa2c76..e08adb013b5 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -3048,13 +3048,25 @@ loop: #ifdef UNIV_LOG_ARCHIVE log_archive_all(); #endif /* UNIV_LOG_ARCHIVE */ - log_make_checkpoint_at(ut_dulint_max, TRUE); + + if (!srv_very_fast_shutdown) { + /* In a 'very fast' shutdown we do not flush the buffer pool: + it is essentially a 'crash' of the InnoDB server. */ + + log_make_checkpoint_at(ut_dulint_max, TRUE); + } else { + /* Make sure that the log is all flushed to disk, so that + we can recover all committed transactions in a crash + recovery */ + log_buffer_flush_to_disk(); + } mutex_enter(&(log_sys->mutex)); lsn = log_sys->lsn; - if (ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0 + if ((ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0 + && !srv_very_fast_shutdown) #ifdef UNIV_LOG_ARCHIVE || (srv_log_archive_on && ut_dulint_cmp(lsn, @@ -3098,11 +3110,12 @@ loop: fil_flush_file_spaces(FIL_TABLESPACE); fil_flush_file_spaces(FIL_LOG); - /* The next fil_write_... will pass the buffer pool: therefore - it is essential that the buffer pool has been completely flushed - to disk! */ + /* The call fil_write_flushed_lsn_to_data_files() will pass the buffer + pool: therefore it is essential that the buffer pool has been + completely flushed to disk! (We do not call fil_write... if the + 'very fast' shutdown is enabled.) */ - if (!buf_all_freed()) { + if (!srv_very_fast_shutdown && !buf_all_freed()) { goto loop; } @@ -3125,7 +3138,7 @@ loop: /* Make some checks that the server really is quiet */ ut_a(srv_n_threads_active[SRV_MASTER] == 0); - ut_a(buf_all_freed()); + ut_a(srv_very_fast_shutdown || buf_all_freed()); ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn)); if (ut_dulint_cmp(lsn, srv_start_lsn) < 0) { @@ -3140,7 +3153,15 @@ loop: srv_shutdown_lsn = lsn; - fil_write_flushed_lsn_to_data_files(lsn, arch_log_no); + if (!srv_very_fast_shutdown) { + /* In a 'very fast' shutdown we do not flush the buffer pool: + it is essentially a 'crash' of the InnoDB server. Then we must + not write the lsn stamps to the data files, since at a + startup InnoDB deduces from the stamps if the previous + shutdown was clean. */ + + fil_write_flushed_lsn_to_data_files(lsn, arch_log_no); + } fil_flush_file_spaces(FIL_TABLESPACE); @@ -3148,7 +3169,7 @@ loop: /* Make some checks that the server really is quiet */ ut_a(srv_n_threads_active[SRV_MASTER] == 0); - ut_a(buf_all_freed()); + ut_a(srv_very_fast_shutdown || buf_all_freed()); ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn)); } diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index adffe06ef0a..d913d77fdfc 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -249,6 +249,10 @@ merge to completion before shutdown */ ibool srv_fast_shutdown = FALSE; +ibool srv_very_fast_shutdown = FALSE; /* if this TRUE, do not flush the + buffer pool to data files at the + shutdown; we effectively 'crash' + InnoDB */ /* Generate a innodb_status.<pid> file */ ibool srv_innodb_status = FALSE; @@ -2178,7 +2182,8 @@ loop: /*****************************************************************/ background_loop: /* ---- In this loop we run background operations when the server - is quiet from user activity */ + is quiet from user activity. Also in the case of a shutdown, we + loop here, flushing the buffer pool to the data files. */ /* The server has been quiet for a while: start running background operations */ @@ -2251,7 +2256,16 @@ background_loop: flush_loop: srv_main_thread_op_info = "flushing buffer pool pages"; - n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max); + + if (!srv_very_fast_shutdown) { + n_pages_flushed = + buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max); + } else { + /* In a 'very fast' shutdown we do not flush the buffer pool + to data files: we set n_pages_flushed to 0 artificially. */ + + n_pages_flushed = 0; + } srv_main_thread_op_info = "reserving kernel mutex"; @@ -2304,7 +2318,10 @@ flush_loop: /* If we are doing a fast shutdown (= the default) we do not do purge or insert buffer merge. But we - flush the buffer pool completely to disk. */ + flush the buffer pool completely to disk. + In a 'very fast' shutdown we do not flush the buffer + pool to data files: we have set n_pages_flushed to + 0 artificially. */ goto background_loop; } |