diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-05-04 11:51:35 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-05-04 13:48:55 +0300 |
commit | 025eed061bec2e4b6f2fb0846e9ada97c0cd77de (patch) | |
tree | f755820f9d92df85afc06854caba49602fcc9500 | |
parent | 0ff90b3b941666cfb1812abc98a4344af594c901 (diff) | |
download | mariadb-git-025eed061bec2e4b6f2fb0846e9ada97c0cd77de.tar.gz |
Cleanup: Remove unnecessary InnoDB log writes
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 46 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 11 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 6 |
3 files changed, 17 insertions, 46 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6316cc71cc1..ec47a7028b8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12729,7 +12729,6 @@ ha_innobase::create( bool file_per_table, trx_t* trx) { - int error; char norm_name[FN_REFLEN]; /* {database}/{tablename} */ char remote_path[FN_REFLEN]; /* Absolute path of table */ @@ -12746,13 +12745,18 @@ ha_innobase::create( remote_path, file_per_table, trx); - if ((error = info.initialize()) - || (error = info.prepare_create_table(name, !trx))) { - if (trx) { - trx_rollback_for_mysql(trx); - row_mysql_unlock_data_dictionary(trx); + { + int error = info.initialize(); + if (!error) { + error = info.prepare_create_table(name, !trx); + } + if (error) { + if (trx) { + trx_rollback_for_mysql(trx); + row_mysql_unlock_data_dictionary(trx); + } + DBUG_RETURN(error); } - DBUG_RETURN(error); } const bool own_trx = !trx; @@ -12767,7 +12771,7 @@ ha_innobase::create( DBUG_ASSERT(trx_state_eq(trx, TRX_STATE_NOT_STARTED)); } - if ((error = info.create_table(own_trx))) { + if (int error = info.create_table(own_trx)) { /* Drop the being-created table before rollback, so that rollback can possibly rename back a table that could have been renamed before the failed creation. */ @@ -12792,16 +12796,9 @@ ha_innobase::create( trx->free(); } - /* Flush the log to reduce probability that the .frm files and - the InnoDB data dictionary get out-of-sync if the user runs - with innodb_flush_log_at_trx_commit = 0 */ - log_buffer_flush_to_disk(); - ut_ad(!srv_read_only_mode); - error = info.create_table_update_dict(); - - DBUG_RETURN(error); + DBUG_RETURN(info.create_table_update_dict()); } /** Create a new table to an InnoDB database. @@ -13132,11 +13129,6 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom) } ut_ad(!srv_read_only_mode); - /* Flush the log to reduce probability that the .frm files and - the InnoDB data dictionary get out-of-sync if the user runs - with innodb_flush_log_at_trx_commit = 0 */ - - log_buffer_flush_to_disk(); innobase_commit_low(trx); @@ -13232,12 +13224,6 @@ innobase_drop_database( my_free(namebuf); - /* Flush the log to reduce probability that the .frm files and - the InnoDB data dictionary get out-of-sync if the user runs - with innodb_flush_log_at_trx_commit = 0 */ - - log_buffer_flush_to_disk(); - innobase_commit_low(trx); trx->free(); @@ -13330,12 +13316,6 @@ inline dberr_t innobase_rename_table(trx_t *trx, const char *from, row_mysql_unlock_data_dictionary(trx); } - /* Flush the log to reduce probability that the .frm - files and the InnoDB data dictionary get out-of-sync - if the user runs with innodb_flush_log_at_trx_commit = 0 */ - - log_buffer_flush_to_disk(); - DBUG_RETURN(error); } diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 2dd41890502..125abe334fc 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1133,10 +1133,8 @@ wait_suspend_loop: if (srv_fast_shutdown == 2 || !srv_was_started) { if (!srv_read_only_mode && srv_was_started) { - ib::info() << "MySQL has requested a very fast" - " shutdown without flushing the InnoDB buffer" - " pool to data files. At the next mysqld" - " startup InnoDB will do a crash recovery!"; + ib::info() << "Executing innodb_fast_shutdown=2." + " Next startup will execute crash recovery!"; /* In this fastest shutdown we do not flush the buffer pool: @@ -1144,10 +1142,7 @@ wait_suspend_loop: it is essentially a 'crash' of the InnoDB server. Make sure that the log is all flushed to disk, so that we can recover all committed transactions in - a crash recovery. 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. */ - + a crash recovery. */ log_buffer_flush_to_disk(); } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 5331373551c..ca41dd675b2 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1509,11 +1509,7 @@ file_checked: fil_system.sys_space->size_in_header = uint32_t(size); mtr.commit(); - /* Immediately write the log record about - increased tablespace size to disk, so that it - is durable even if mysqld would crash - quickly */ - log_buffer_flush_to_disk(); + log_write_up_to(mtr.commit_lsn(), true); } } |