Removed redundant log_type == LOG_BIN checks

This commit is contained in:
Sergey Vojtovich 2019-08-06 14:04:38 +04:00
parent 6b0b25a25b
commit afe969ba05

View File

@ -5218,8 +5218,6 @@ int MYSQL_BIN_LOG::new_file_impl()
} }
new_name_ptr=new_name; new_name_ptr=new_name;
if (log_type == LOG_BIN)
{
{ {
/* /*
We log the whole file name for log file as the user may decide We log the whole file name for log file as the user may decide
@ -5233,8 +5231,10 @@ int MYSQL_BIN_LOG::new_file_impl()
*/ */
if (is_relay_log) if (is_relay_log)
r.checksum_alg= relay_log_checksum_alg; r.checksum_alg= relay_log_checksum_alg;
DBUG_ASSERT(!is_relay_log || relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF); DBUG_ASSERT(!is_relay_log ||
if(DBUG_EVALUATE_IF("fault_injection_new_file_rotate_event", (error=close_on_error=TRUE), FALSE) || relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
if (DBUG_EVALUATE_IF("fault_injection_new_file_rotate_event",
(error= close_on_error= TRUE), FALSE) ||
(error= write_event(&r))) (error= write_event(&r)))
{ {
DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno= 2;); DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno= 2;);
@ -5246,7 +5246,6 @@ int MYSQL_BIN_LOG::new_file_impl()
} }
bytes_written+= r.data_written; bytes_written+= r.data_written;
} }
}
/* /*
Update needs to be signalled even if there is no rotate event Update needs to be signalled even if there is no rotate event
@ -5276,7 +5275,7 @@ int MYSQL_BIN_LOG::new_file_impl()
delay_close= true; delay_close= true;
} }
close(close_flag); close(close_flag);
if (log_type == LOG_BIN && checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF) if (checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF)
{ {
DBUG_ASSERT(!is_relay_log); DBUG_ASSERT(!is_relay_log);
DBUG_ASSERT(binlog_checksum_options != checksum_alg_reset); DBUG_ASSERT(binlog_checksum_options != checksum_alg_reset);
@ -8487,9 +8486,9 @@ void MYSQL_BIN_LOG::close(uint exiting)
if (log_state == LOG_OPENED) if (log_state == LOG_OPENED)
{ {
DBUG_ASSERT(log_type == LOG_BIN);
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
if (log_type == LOG_BIN && if (exiting & LOG_CLOSE_STOP_EVENT)
(exiting & LOG_CLOSE_STOP_EVENT))
{ {
Stop_log_event s; Stop_log_event s;
// the checksumming rule for relay-log case is similar to Rotate // the checksumming rule for relay-log case is similar to Rotate
@ -8526,8 +8525,7 @@ void MYSQL_BIN_LOG::close(uint exiting)
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
/* don't pwrite in a file opened with O_APPEND - it doesn't work */ /* don't pwrite in a file opened with O_APPEND - it doesn't work */
if (log_file.type == WRITE_CACHE && log_type == LOG_BIN if (log_file.type == WRITE_CACHE && !(exiting & LOG_CLOSE_DELAYED_CLOSE))
&& !(exiting & LOG_CLOSE_DELAYED_CLOSE))
{ {
my_off_t org_position= mysql_file_tell(log_file.file, MYF(0)); my_off_t org_position= mysql_file_tell(log_file.file, MYF(0));
if (!failed_to_save_state) if (!failed_to_save_state)