Hi, Kristian!

Look good. Just one comment, see below, and ok to push

On Jun 20, Kristian Nielsen wrote:
> 
> ------------------------------------------------------------
> revno: 3449
> revision-id: [email protected]
> parent: [email protected]
> committer: [email protected]
> branch nick: mariadb-5.5
> timestamp: Tue 2012-06-19 15:03:27 +0200
> message:
>   MDEV-342: Do not mark old binlog file as cleanly closed during rotate until
>   the new file is fully synced to disk and binlog index. This fixes a window
>   where a crash would leave next server restart unable to detect that a crash
>   occured, causing recovery to fail.

> === modified file 'sql/log.cc'
> --- a/sql/log.cc      2012-05-21 18:54:41 +0000
> +++ b/sql/log.cc      2012-06-19 13:03:27 +0000
> @@ -6344,6 +6373,21 @@ void MYSQL_BIN_LOG::close(uint exiting)
>  }
>  
>  
> +/*
> +  For binlog rotation, this function is used to ensure that the old binlog
> +  file is not marked as cleanly closed until the new binlog file is synced to
> +  disk and index. This is needed to ensure that we will always detect a prior
> +  crash at next server restart.
> +*/
> +void MYSQL_BIN_LOG::delayed_close(File file)
> +{
> +  my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET;
> +  uchar flags= 0;            // clearing LOG_EVENT_BINLOG_IN_USE_F
> +  mysql_file_pwrite(file, &flags, 1, offset, MYF(0));

I'd rather reuse this piece of code that overwrites the flag.
If you move mysql_file_close() to the caller, you can call this function
set_binlog_flag_when_closing() and use it both for normal and delayed
close.

> +  mysql_file_close(file, MYF(MY_WME));
> +}
> +
Regards,
Sergei

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to