Skip to content

Commit 399b524

Browse files
authored
Merge pull request #877 from globocom/feat/mysql_expire_bin_log
Fixed expire bin log when database stopped more days than expire_bin_log
2 parents 68d358f + dfe4ff0 commit 399b524

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

dbaas/drivers/replication_topologies/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ def get_stop_database_vm_steps(self):
724724
'workflow.steps.util.database.checkAndFixMySQLReplication',
725725
)}, {
726726
'Stopping database': (
727+
'workflow.steps.util.mysql.SaveMysqlBinlog',
727728
'workflow.steps.util.database.Stop',
728729
'workflow.steps.util.database.StopRsyslog',
729730
'workflow.steps.util.database.CheckIsDown',

dbaas/workflow/steps/util/mysql.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,19 @@ def do(self):
227227

228228
driver = self.infra.get_driver()
229229
client = driver.get_client(self.instance)
230-
mysql_binlog_save(client, self.instance)
230+
231+
232+
class SaveMySqlBinlog(MySQLStep):
233+
234+
def __unicode__(self):
235+
return "Saving binlog position to stop database..."
236+
237+
def do(self):
238+
driver = self.infra.get_driver()
239+
client = driver.get_client(self.instance)
240+
241+
if 'MySQL' in type(driver).__name__:
242+
mysql_binlog_save(client, self.instance)
231243

232244

233245
class RestoreSnapshotMySQL(RestoreSnapshot):

0 commit comments

Comments
 (0)