From 76df80e628b06436e0a17d1c6b015a016babf963 Mon Sep 17 00:00:00 2001 From: shunki-fujita Date: Wed, 10 Jul 2024 11:10:27 +0000 Subject: [PATCH] WIP --- clustering/operations.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clustering/operations.go b/clustering/operations.go index b126d283..057fa020 100644 --- a/clustering/operations.go +++ b/clustering/operations.go @@ -162,6 +162,9 @@ func (p *managerProcess) switchover(ctx context.Context, ss *StatusSet) error { select { case err := <-done: if err != nil { + if errKill := pdb.KillConnections(ctx); errKill != nil { + return fmt.Errorf("failed to make instance %d read-only: %w, and failed to kill connections: %w", ss.Primary, err, errKill) + } return fmt.Errorf("failed to make instance %d read-only: %w", ss.Primary, err) } time.Sleep(100 * time.Millisecond)