Index: storage/innobase/log/log0log.cc =================================================================== --- storage/innobase/log/log0log.cc (revision 6927) +++ storage/innobase/log/log0log.cc (working copy) @@ -1230,18 +1230,23 @@ log_sys->write_lsn, log_sys->lsn)); + group = UT_LIST_GET_FIRST(log_sys->log_groups); + if (flush_to_disk) { log_sys->n_pending_flushes++; log_sys->current_flush_lsn = log_sys->lsn; MONITOR_INC(MONITOR_PENDING_LOG_FLUSH); os_event_reset(log_sys->flush_event); + + if (log_sys->buf_free == log_sys->buf_next_to_write) + goto flush_op; } - group = UT_LIST_GET_FIRST(log_sys->log_groups); - start_offset = log_sys->buf_next_to_write; end_offset = log_sys->buf_free; + ut_ad(start_offset != end_offset); + area_start = ut_calc_align_down(start_offset, OS_FILE_LOG_BLOCK_SIZE); area_end = ut_calc_align(end_offset, OS_FILE_LOG_BLOCK_SIZE); @@ -1252,8 +1257,6 @@ log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE, log_sys->next_checkpoint_no); - group = UT_LIST_GET_FIRST(log_sys->log_groups); - /* Calculate pad_size if needed. */ pad_size = 0; if (write_ahead_size > OS_FILE_LOG_BLOCK_SIZE) { @@ -1300,6 +1303,7 @@ log_sys_write_completion(); +flush_op: if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) { /* O_DSYNC means the OS did not buffer the log file at all: so we have also flushed to disk what we have written */