Skip to content

Commit

Permalink
Wait host become read-only before remove 'recovery' (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Shevchuk <[email protected]>
  • Loading branch information
teem0n and Aleksandr Shevchuk authored Jul 18, 2023
1 parent 47d9595 commit 485ec03
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ func (app *App) checkRecovery() {
app.logger.Errorf("recovery: local node %s is NOT behind the master %s, need RESETUP", localNode.Host(), masterNode)
app.writeResetupFile("")
} else {
readOnly, _, err := localNode.IsReadOnly()
if err != nil {
app.logger.Errorf("recovery: failed to check if host is read-only: %v", err)
return
}

if !readOnly {
app.logger.Errorf("recovery: host is not read-only, we should wait for it...")
return
}

app.logger.Infof("recovery: local node %s is not ahead of master, recovery finished", localNode.Host())
err = app.ClearRecovery(app.config.Hostname)
if err != nil {
Expand Down

0 comments on commit 485ec03

Please sign in to comment.