MySQL Forums
Forum List  »  General

binary log rotation
Posted by: mmmm mmmm
Date: April 17, 2020 10:51AM

I set the max_binlog_size=150M in the my.cnf and rebooted the server. I checked the variable and it's 157MB. However the binlog rotated from bin.000017 to bin.000018. bin.000017 is only 144 bytes. Why did 000017 rote to 000018 if 000017 did not reach 150MB?


-rw-rw---- 1 mysql adm 144 Apr 16 14:05 bin.000014
-rw-rw---- 1 mysql adm 144 Apr 16 14:09 bin.000015
-rw-rw---- 1 mysql adm 1491 Apr 17 02:30 bin.000016
-rw-rw---- 1 mysql adm 144 Apr 17 06:25 bin.000017
-rw-rw---- 1 mysql adm 107 Apr 17 06:25 bin.000018
-rw-rw---- 1 mysql adm 540 Apr 17 06:25 bin-log.index


#binary log
log-bin=/var/binlogs/bin.log
log-bin-index=/var/binlogs/bin-log.index
max_binlog_size=150G


mysql> show variables like '%binlog_size%';
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| max_binlog_size | 157286400 |
+-----------------+-----------+


dba@testing:~$ mysqlbinlog --defaults-extra-file=~/login.ini -v -dproduction /var/binlogs/bin.000017
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#200417 2:30:01 server id 2 end_log_pos 107 Start: binlog v 4, server v 5.5.46-0+deb7u1-log created 200417 2:30:01
BINLOG '
GXeZXg8CAAAAZwAAAGsAAAAAAAQANS41LjQ2LTArZGViN3UxLWxvZwAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
'/*!*/;
# at 107
#200417 6:25:07 server id 2 end_log_pos 144 Rotate to bin.000018 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
dba@testing:~$

Options: ReplyQuote


Subject
Written By
Posted
binary log rotation
April 17, 2020 10:51AM
April 17, 2020 11:41AM
April 17, 2020 10:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.