If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Relay Logs Not Being Cleaned up

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-07, 04:49
Dareet Dareet is offline
Registered User
 
Join Date: Apr 2007
Posts: 6
Red face Relay Logs Not Being Cleaned up

Hi Guys,
I currently have a server running mysql v.4.0.25 on Debian, Which is replicating from another server.
The slave is replicating fine, but the SQL-Thread is not cleaning up after itself, Its not deleting the relay logs once its done with them - Now the limit is 512mb to the relay logs but Im having to keep an eye on the disk space because of it.
I have searched dev.mysql, google, bugs.mysql, Ask, This forum - But to no avail!
Does anyone have an idea as to what could be causing this? and how it could be solved?
If I havent supplied enough info - Just let me know.
Thanks and best regards
Dareet
Reply With Quote
  #2 (permalink)  
Old 04-27-07, 08:05
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
The slave SQL thread processes the contents of the relay log files. When it starts, it reads events from the relay logs and executes them. As it finishes processing each relay log file it deletes it if the I/O thread is writing to a newer relay log. If the SQL thread is reading the same relay log that the I/O thread is writing, the SQL thread pauses until more events are available in the file.

It sounds like your SQL thread is constantly updating records and isn't able to remove the log file because the I/O thread is still writing to it.
Reply With Quote
  #3 (permalink)  
Old 04-27-07, 08:09
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
A good place to look is: http://dev.mysql.com/doc/refman/5.0/en/slave-logs.html
Check out the part about :

A slave server creates a new relay log file under the following conditions:
* Each time the I/O thread starts.
* When the logs are flushed; for example, with FLUSH LOGS or mysqladmin flush-logs.
* When the size of the current relay log file becomes too large. The meaning of “too large” is determined as follows:
o If the value of max_relay_log_size is greater than 0, that is the maximum relay log file size.
o If the value of max_relay_log_size is 0, max_binlog_size determines the maximum relay log file size.
Reply With Quote
  #4 (permalink)  
Old 04-27-07, 08:11
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
In other words check your max_binlog_size variable in your my.cnf
Also please show the result of
Code:
SHOW SLAVE STATUS
Reply With Quote
  #5 (permalink)  
Old 04-30-07, 07:09
Dareet Dareet is offline
Registered User
 
Join Date: Apr 2007
Posts: 6
Smile

Hi,
Thanks for the reply,
Firstly, I have read through the dev.mysql stuff - And for this situation, Its of no use - But thanks anyway.

The second thing is that the files are still progressing, So the sql_thread is creating the new files, and advancing to them.
The SHOW SLAVE STATUS shows that the slave is using the new files which are being created.
So the replication is working OK, and the new logs are being created OK when the old one hits the max size, Its just that the sql_thread isn't deleting them after its created a new file.
Now mysql is quite happy for me to manually delete them (Obviously with caution) and no problems occur from that.
I just have a messy sql_thread that wont tidy up after itself!
Thanks again for the reply and best regards
Phil
Reply With Quote
  #6 (permalink)  
Old 04-30-07, 08:18
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
I know it might not be an ideal solution but have you considered upgrading to 4.1 ? I'm sure there must be a binary for 4.1 for debian now.
Reply With Quote
  #7 (permalink)  
Old 04-30-07, 08:22
Dareet Dareet is offline
Registered User
 
Join Date: Apr 2007
Posts: 6
Their is the binary for it, But just the sheer size of the data which is on this server puts a hurdle their firstly.
Secondly the code which runs on this db is a tangled web, and would be a major project to change some things, The site is mission critical you see - And we cant afford to have the site down for too long. Upgrading would need some serious planning etc.
So although I would love to, Its simply out of the question at the moment
Best regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On