@@ -122,13 +122,18 @@ func (n *Node) Init(ctx context.Context) error {
122122
123123 // Attempt to re-introduce zombie back into the cluster.
124124 if ZombieLockExists () {
125- fmt .Println ("Zombie lock detected" )
125+ fmt .Println ("Zombie lock detected! " )
126126 zHostname , err := readZombieLock ()
127127 if err != nil {
128128 return fmt .Errorf ("failed to read zombie lock: %s" , zHostname )
129129 }
130130
131131 if zHostname != "" {
132+ ip := net .ParseIP (zHostname )
133+ if ip == nil {
134+ return fmt .Errorf ("zombie.lock file contained an invalid ipv6 address" )
135+ }
136+
132137 if err := n .RepMgr .rejoinCluster (zHostname ); err != nil {
133138 return fmt .Errorf ("failed to rejoin cluster: %s" , err )
134139 }
@@ -141,7 +146,7 @@ func (n *Node) Init(ctx context.Context) error {
141146 utils .RunCommand ("pg_ctl -D /data/postgresql/ stop" )
142147 } else {
143148 // TODO - Provide link to documention on how to address this
144- fmt .Println ("Zombie lock does not contain a valid hostname! " )
149+ fmt .Println ("The zombie lock file does not contain a hostname. " )
145150 fmt .Println ("This likely means that we were unable to build a consensus on who the real primary is." )
146151 }
147152 }
@@ -197,9 +202,9 @@ func (n *Node) Init(ctx context.Context) error {
197202// PostInit are operations that should be executed against a running Postgres on boot.
198203func (n * Node ) PostInit (ctx context.Context ) error {
199204 if ZombieLockExists () {
200- fmt .Println ("If you feel like this is a mistake, you can force a retry by deleting the zombie.lock file " )
201- fmt .Println ("Sleeping for 2 minutes." )
202- time .Sleep (2 * time .Minute )
205+ fmt .Println ("Manual intervention required. Delete the zombie.lock file and restart the machine to force a retry. " )
206+ fmt .Println ("Sleeping for 5 minutes." )
207+ time .Sleep (5 * time .Minute )
203208
204209 return fmt .Errorf ("unrecoverable zombie" )
205210 }
@@ -269,7 +274,6 @@ func (n *Node) PostInit(ctx context.Context) error {
269274 if member != nil && member .Role != "" {
270275 role = member .Role
271276 }
272- fmt .Printf ("My current role is: %s\n " , role )
273277
274278 switch role {
275279 case PrimaryRoleName :
@@ -284,6 +288,7 @@ func (n *Node) PostInit(ctx context.Context) error {
284288 totalActive := 1 // include self
285289 totalInactive := 0
286290 totalConflicts := 0
291+
287292 conflictMap := map [string ]int {}
288293
289294 for _ , standby := range standbys {
0 commit comments