Hi Sven
How about the other fix, make write_cache check the return value of
flush_and sync(), and return error if flush_and_sync failed?
Sven Sandberg wrote:
> Hi Zhenxing,
>
> Thanks for your fix.
>
> While reviewing, I noticed a strange thing related to flush_and_sync.
> It's not your fault, but would be nice if you could fix that too:
>
> MYSQL_BIN_LOG::write_cache calls flush_and_sync() near the end. This
> call has the problem that it does not check the return value. Actually,
> I don't think flush_and_sync() should be called here at all - it's only
> called if the parameter sync_log is true, and there is only one call in
> the code that sets sync_log to true. So I would suggest removing the
> sync_log parameter from MYSQL_BIN_LOG::write_cache, remove 'if
> (sync_log) flush_and_sync();' from MYSQL_BIN_LOG::write_cache, and add
> an explicit call to flush_and_sync() inside
> DBUG_EXECUTE_IF("crash_before_writing_xid",...) in MYSQL_BIN_LOG::write
> instead.
>
> You can fix this if you like. Otherwise, your patch is good to push.
>
> /Sven
>
>
> He Zhenxing wrote:
> > #At file:///media/sda3/work/mysql/bzrwork/b31665/5.1-rpl/
> >
> > 2611 He Zhenxing 2008-07-11
> > BUG#31665 sync_binlog should cause relay logs to be synchronized
> > BUG#35542 Add option to sync master and relay log to disk after every
> event
> >
> > Add sync_relay_log option to server, this option works for relay log
> > the same as option sync_binlog for binlog. This option also synchronize
> > master info to disk when set to non-zero value.
> >
> > Original patches from Sinisa and Mark, with some modifications
> > modified:
> > sql/log.cc
> > sql/log.h
> > sql/mysql_priv.h
> > sql/mysqld.cc
> > sql/rpl_mi.cc
> > sql/rpl_rli.cc
> > sql/sql_repl.cc
[snip]