From: Sergei Golubchik Date: April 19 2011 10:40am Subject: Re: How to do custom work before binlog resources have been cleaned up? List-Archive: http://lists.mysql.com/internals/38302 Message-Id: <20110419104016.GF4080@janus.mylan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi, LeeRicky! > Hi Sergei, > Our storage engine writes binlog ourself to get better performance, using a background thread. Recently I got a bug. When shut down MySQL server, after MySQL had cleaned up the binlog resources, our binlog thread was still working and got into trouble. > Now I want to wait for this thread to exit before MySQL cleans up binlog resources.In function 'cleanup()' (mysqld.cc:1295, MySQL5.1.49), I found 'ha_binlog_end()' interface can do this work.But it is defined as empty macro except the 'HAVE_NDB_BINLOG' macro is defined. > If I implement the ''ha_binlog_end()' interface like NDB, 'binlog_func' interface of handlerton can be calledcorrectly and my problem is solved. But I don't want to modify codes in handler.cc and handler.h. > I feel this interface hasn't completely open to storage engine. I mean storage engine needn't modify the codes of MySQL internal to fit requirements like mine. > Can future version or patch solve this problem? Provide a way to let 'binlog_func' interface of handlertonbe called before MySQL cleans up binlog resources. > Sorry for my poor English. I don't know if I have explained the problem clearly. > Really looking forward to your reply. Thanks! You can try to add -DHAVE_NDB_BINLOG to the CXXFLAGS and see if that helps. And you can automate it by modifying CXXFLAGS from your plug.in file. Yes, it's a hack. For a proper solution, submit a bug report and pray that it is fixed within our lifetime. Regards, Sergei