diff --git a/internal/flypg/node.go b/internal/flypg/node.go index f309092a..c3d28e0c 100644 --- a/internal/flypg/node.go +++ b/internal/flypg/node.go @@ -133,11 +133,6 @@ func (n *Node) Init(ctx context.Context) error { return fmt.Errorf("failed initialize cluster state store: %s", err) } - // Determine if we are performing a remote restore. - if err := n.handleRemoteRestore(ctx, store); err != nil { - return fmt.Errorf("failed to handle remote restore: %s", err) - } - // Ensure we have the required s3 credentials set. if os.Getenv("S3_ARCHIVE_CONFIG") != "" || os.Getenv("S3_ARCHIVE_REMOTE_RESTORE_CONFIG") != "" { if err := writeS3Credentials(ctx, s3AuthDir); err != nil { @@ -145,6 +140,11 @@ func (n *Node) Init(ctx context.Context) error { } } + // Determine if we are performing a remote restore. + if err := n.handleRemoteRestore(ctx, store); err != nil { + return fmt.Errorf("failed to handle remote restore: %s", err) + } + // Verify whether we are a booting zombie. if ZombieLockExists() { if err := handleZombieLock(ctx, n); err != nil {