Hi Jasonh,
Thank you for the review.
Cheers.
He Zhenxing wrote:
> Hi Alfranio,
>
> STATUS
> ------
> Approved!
>
> REQUIRED
> --------
> N/A
>
> REQUESTS
> --------
> N/A
>
> SUGGESTIONS
> -----------
>
> S1. Please do not indent #ifdef HAVE_REPLICATION lines
done.
>
> S2. There are lines only changed in space that would be better removed.
done.
>
> Please see below!
>
> Alfranio Correia wrote:
>> #At
> file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-45292/mysql-5.1-bugteam/
> based on revid:li-bing.song@stripped
>>
>> 3215 Alfranio Correia 2009-11-30
>> BUG#45292 orphan binary log created when starting server twice
>>
>
> [ snip ]
>
>> @@ -2629,23 +2689,43 @@ bool MYSQL_BIN_LOG::open(const char *log
>>
>> if (write_file_name_to_index_file)
>> {
>> + #ifdef HAVE_REPLICATION
>> + DBUG_EXECUTE_IF("crash_create_critical_before_update_index", abort(););
>> + #endif
>> +
>
> S1
>
>> + DBUG_ASSERT(my_b_inited(&index_file) != 0);
>> + reinit_io_cache(&index_file, WRITE_CACHE,
>> + my_b_filelength(&index_file), 0, 0);
>> /*
>> As this is a new log file, we write the file name to the index
>> file. As every time we write to the index file, we sync it.
>> */
>> - if (my_b_write(&index_file, (uchar*) log_file_name,
>> - strlen(log_file_name)) ||
>> - my_b_write(&index_file, (uchar*) "\n", 1) ||
>> - flush_io_cache(&index_file) ||
>> + if (DBUG_EVALUATE_IF("fault_injection_updating_index", 1, 0) ||
>> + my_b_write(&index_file, (uchar*) log_file_name,
>> + strlen(log_file_name)) ||
>> + my_b_write(&index_file, (uchar*) "\n", 1) ||
>> + flush_io_cache(&index_file) ||
>> my_sync(index_file.file, MYF(MY_WME)))
>> - goto err;
>> + goto err;
>> +
>> + #ifdef HAVE_REPLICATION
>> + DBUG_EXECUTE_IF("crash_create_after_update_index", abort(););
>> + #endif
>
> S1
>
>> }
>> }
>> log_state= LOG_OPENED;
>>
>> + #ifdef HAVE_REPLICATION
>> + close_purge_index_file();
>> + #endif
>> +
>> DBUG_RETURN(0);
>>
>> err:
>> + #ifdef HAVE_REPLICATION
>> + purge_index_entry(NULL, NULL, need_mutex);
>> + close_purge_index_file();
>> + #endif
>
> S1
>
> [ snip ]
>
>> - }
>> - if (my_errno == EMFILE)
>> - {
>> - DBUG_PRINT("info",
>> - ("my_errno: %d, set ret = LOG_INFO_EMFILE", my_errno));
>> - error= LOG_INFO_EMFILE;
>> + }
>> + else
>> + {
>> + sql_print_information("Failed to delete file '%s'; "
>> + "consider examining correspondence "
>> + "of your binlog index file "
>> + "to the actual binlog files",
>> + log_info.log_file_name);
>> + }
>> + if (my_errno == EMFILE)
>> + {
>> + DBUG_PRINT("info",
>> + ("my_errno: %d, set ret = LOG_INFO_EMFILE",
> my_errno));
>> + error= LOG_INFO_EMFILE;
>> + goto err;
>> + }
>> + error= LOG_INFO_FATAL;
>> goto err;
>> }
>> - error= LOG_INFO_FATAL;
>> - goto err;
>> }
>> }
>> }
>> }
>> -
>
> S2
>
>> err:
>> - close_cached_file(&purge_temp);
>> - if (need_mutex)
>> - pthread_mutex_unlock(&LOCK_index);
>> DBUG_RETURN(error);
>> }
>>
>> @@ -3407,7 +3599,8 @@ int MYSQL_BIN_LOG::purge_logs_before_dat
>> goto err;
>>
>> while (strcmp(log_file_name, log_info.log_file_name) &&
>> - !log_in_use(log_info.log_file_name))
>> + !is_active(log_info.log_file_name) &&
>> + !log_in_use(log_info.log_file_name))
>> {
>> if (!my_stat(log_info.log_file_name, &stat_area, MYF(0)))
>> {
>> @@ -3416,14 +3609,6 @@ int MYSQL_BIN_LOG::purge_logs_before_dat
>> /*
>> It's not fatal if we can't stat a log file that does not exist.
>> */
>> - if (thd)
>> - {
>> - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
>> - ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
>> - log_info.log_file_name);
>> - }
>> - sql_print_information("Failed to execute my_stat on file '%s'",
>> - log_info.log_file_name);
>> my_errno= 0;
>> }
>> else
>> @@ -3604,6 +3789,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool n
>> name=0; // Don't free name
>> close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX);
>>
>> +
>
> S2
>
> [ snip ]
>
>