From: Rick James Date: August 31 2011 8:28pm Subject: Re: Binlog has bad magic number error List-Archive: http://lists.mysql.com/internals/38377 Message-Id: <4E5E9974.4060502@yahoo-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit What version? A long time ago, MySQL would briefly swap two file descriptors, thereby leading to random corruption. On 8/31/11 12:05 AM, Mats Kindahl wrote: > On 08/30/2011 06:21 AM, Kamal O wrote: >> Hi Mats, >> Thanks for the reply! >> >> I wonder, what could be the resolution for the error. > There is really no automatic resolution. The magic number can be wrong > because the file is corrupt, in which case you have to repair it, or > because it is not a binlog file (did you accidentally copy another > file on top of the binlog file?) > >> >> Whether it works fine, if slave is restarted pointing to the next >> binlog file, initial position. > Is this a question? You get the magic number error when you start at > the initial position in a binlog file and the magic number is bad. You > can point replication to any binlog file you like, but if you skip > events this way, you will (of course) lose changes done at the master. > > The decision if these events can be skipped is a decision you have to > make. > > Best wishes, > Mats Kindahl > >> >> >> Thanks, >> Kamal >> >> >> >> On Mon, Aug 29, 2011 at 12:04 PM, Mats Kindahl >> > wrote: >> >> Hi Kamalakar, >> >> If you get that error, it is simply a bad magic number for the file >> (this is the 4 first bytes of the file), use hexdump to see that the >> first bytes are FE 62 69 6E: >> >> $ hexdump -C -n16 context-bin.000001 >> 00000000 fe 62 69 6e 07 a9 53 4e 0f 01 00 00 00 66 00 00 >> |.bin..SN.....f..| >> 00000010 >> >> There is no connection between the latter error and the first >> one. As >> a matter of fact, it should not be possible to get the "Can't find >> record" if the magic number is not correct for the file and the only >> way I can figure out that could give you the "bad magic" error when >> skipping events is if the binlog file ends after that and you rotate >> to a corrupt file. >> >> Just my few cents, >> Mats Kindahl >> >> On 08/19/2011 12:53 PM, Kamalakar Reddy Y wrote: >> > Thanks! Please help! We are getting the below replication error >> > >> > Last_SQL_Errno: 1593 Last_SQL_Error: *Error initializing relay >> log position: >> > Binlog has bad magic number; It's not a binary log file that >> can be used by >> > this version of MySQL.* >> > >> > >> > >> > Initially we were facing the below error, which we skipped >> that resulted the >> > above error. >> > >> > >> > >> > Last_Error: Could not execute Update_rows event on tables >> xxxxxxx.zzzzz: >> > Can't find record in 'zzzzz', Error_code:1032; handle error >> > HA_ERR_KEY_NOT_FOUND; the event's master log >> mysql-binlog-LLL01.000683, >> > end_log_pos 776331958. >> > >> > >> > >> > Please do help!...... >> > >> >> > -- Rick James - MySQL Geek