Commit 025eed06 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove unnecessary InnoDB log writes

parent 0ff90b3b
...@@ -12729,7 +12729,6 @@ ha_innobase::create( ...@@ -12729,7 +12729,6 @@ ha_innobase::create(
bool file_per_table, bool file_per_table,
trx_t* trx) trx_t* trx)
{ {
int error;
char norm_name[FN_REFLEN]; /* {database}/{tablename} */ char norm_name[FN_REFLEN]; /* {database}/{tablename} */
char remote_path[FN_REFLEN]; /* Absolute path of table */ char remote_path[FN_REFLEN]; /* Absolute path of table */
...@@ -12746,13 +12745,18 @@ ha_innobase::create( ...@@ -12746,13 +12745,18 @@ ha_innobase::create(
remote_path, remote_path,
file_per_table, trx); file_per_table, trx);
if ((error = info.initialize()) {
|| (error = info.prepare_create_table(name, !trx))) { int error = info.initialize();
if (trx) { if (!error) {
trx_rollback_for_mysql(trx); error = info.prepare_create_table(name, !trx);
row_mysql_unlock_data_dictionary(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; const bool own_trx = !trx;
...@@ -12767,7 +12771,7 @@ ha_innobase::create( ...@@ -12767,7 +12771,7 @@ ha_innobase::create(
DBUG_ASSERT(trx_state_eq(trx, TRX_STATE_NOT_STARTED)); 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, /* Drop the being-created table before rollback,
so that rollback can possibly rename back a table so that rollback can possibly rename back a table
that could have been renamed before the failed creation. */ that could have been renamed before the failed creation. */
...@@ -12792,16 +12796,9 @@ ha_innobase::create( ...@@ -12792,16 +12796,9 @@ ha_innobase::create(
trx->free(); 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); ut_ad(!srv_read_only_mode);
error = info.create_table_update_dict(); DBUG_RETURN(info.create_table_update_dict());
DBUG_RETURN(error);
} }
/** Create a new table to an InnoDB database. /** 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) ...@@ -13132,11 +13129,6 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
} }
ut_ad(!srv_read_only_mode); 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); innobase_commit_low(trx);
...@@ -13232,12 +13224,6 @@ innobase_drop_database( ...@@ -13232,12 +13224,6 @@ innobase_drop_database(
my_free(namebuf); 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); innobase_commit_low(trx);
trx->free(); trx->free();
...@@ -13330,12 +13316,6 @@ inline dberr_t innobase_rename_table(trx_t *trx, const char *from, ...@@ -13330,12 +13316,6 @@ inline dberr_t innobase_rename_table(trx_t *trx, const char *from,
row_mysql_unlock_data_dictionary(trx); 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); DBUG_RETURN(error);
} }
......
...@@ -1133,10 +1133,8 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() ...@@ -1133,10 +1133,8 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown()
if (srv_fast_shutdown == 2 || !srv_was_started) { if (srv_fast_shutdown == 2 || !srv_was_started) {
if (!srv_read_only_mode && srv_was_started) { if (!srv_read_only_mode && srv_was_started) {
ib::info() << "MySQL has requested a very fast" ib::info() << "Executing innodb_fast_shutdown=2."
" shutdown without flushing the InnoDB buffer" " Next startup will execute crash recovery!";
" pool to data files. At the next mysqld"
" startup InnoDB will do a crash recovery!";
/* In this fastest shutdown we do not flush the /* In this fastest shutdown we do not flush the
buffer pool: buffer pool:
...@@ -1144,10 +1142,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() ...@@ -1144,10 +1142,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown()
it is essentially a 'crash' of the InnoDB server. it is essentially a 'crash' of the InnoDB server.
Make sure that the log is all flushed to disk, so Make sure that the log is all flushed to disk, so
that we can recover all committed transactions in that we can recover all committed transactions in
a crash recovery. We must not write the lsn stamps a crash recovery. */
to the data files, since at a startup InnoDB deduces
from the stamps if the previous shutdown was clean. */
log_buffer_flush_to_disk(); log_buffer_flush_to_disk();
} }
......
...@@ -1509,11 +1509,7 @@ dberr_t srv_start(bool create_new_db) ...@@ -1509,11 +1509,7 @@ dberr_t srv_start(bool create_new_db)
fil_system.sys_space->size_in_header fil_system.sys_space->size_in_header
= uint32_t(size); = uint32_t(size);
mtr.commit(); mtr.commit();
/* Immediately write the log record about log_write_up_to(mtr.commit_lsn(), true);
increased tablespace size to disk, so that it
is durable even if mysqld would crash
quickly */
log_buffer_flush_to_disk();
} }
} }
......
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