1

I'm developing 1 java application to reading a binlog file to catch query event. Everything would be fine without exception. But what will happen if my application was crashed, i will miss many event to from my database. So i wondering when mysql save new bin log position in a new binlog file? So i can save a checkpoint so as not to miss any event from my database.

My external library use to read binlog mysql :

<dependency>
    <groupId>com.github.shyiko</groupId>
    <artifactId>mysql-binlog-connector-java</artifactId>
    <version>0.21.0</version>
</dependency>

1 Answers1

1

MySQL opens a new binary log file in three cases:

  • The current binary log file exceeds max_binlog_size. The file can go over that size slightly, to allow the current event to finish writing.

  • Some client runs the command FLUSH LOGS. For example, mysqldump does this if you use the --flush-logs command option.

  • The MySQL Server restarts.

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828