MCPcopy Create free account
hub / github.com/Tencent/phxsql / purge

Method purge

phx_percona/percona/sql/binlog.cc:5681–5705  ·  view source on GitHub ↗

The method executes logs purging routine. @retval nonzero - error in rotating routine. */

Source from the content-addressed store, hash-verified

5679 nonzero - error in rotating routine.
5680*/
5681void MYSQL_BIN_LOG::purge()
5682{
5683#ifdef HAVE_REPLICATION
5684 if (expire_logs_days)
5685 {
5686 DEBUG_SYNC(current_thd, "at_purge_logs_before_date");
5687 time_t purge_time= my_time(0) - expire_logs_days*24*60*60;
5688 DBUG_EXECUTE_IF("expire_logs_always",
5689 { purge_time= my_time(0);});
5690 if (purge_time >= 0)
5691 {
5692 /*
5693 Flush logs for storage engines, so that the last transaction
5694 is fsynced inside storage engines.
5695 */
5696 ha_flush_logs(NULL);
5697 purge_logs_before_date(purge_time, true);
5698 }
5699 }
5700 if (max_binlog_files)
5701 {
5702 purge_logs_maximum_number(max_binlog_files);
5703 }
5704#endif
5705}
5706
5707/**
5708 The method is a shortcut of @c rotate() and @c purge().

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected