|
8 | 8 | "time"
|
9 | 9 |
|
10 | 10 | "github.com/fly-apps/postgres-flex/internal/flypg"
|
11 |
| - "github.com/jackc/pgx/v5" |
12 | 11 | )
|
13 | 12 |
|
14 | 13 | func monitorClusterState(ctx context.Context, node *flypg.Node) {
|
@@ -63,31 +62,3 @@ func clusterStateMonitorTick(ctx context.Context, node *flypg.Node) error {
|
63 | 62 |
|
64 | 63 | return nil
|
65 | 64 | }
|
66 |
| - |
67 |
| -func evaluateClusterState(ctx context.Context, conn *pgx.Conn, node *flypg.Node) error { |
68 |
| - primary, err := node.EvaluateClusterState(ctx, conn) |
69 |
| - if errors.Is(err, flypg.ErrZombieDiagnosisUndecided) || errors.Is(err, flypg.ErrZombieDiscovered) { |
70 |
| - // Quarantine primary |
71 |
| - if err := flypg.Quarantine(ctx, conn, node, primary); err != nil { |
72 |
| - return fmt.Errorf("failed to quarantine failed primary: %s", err) |
73 |
| - } |
74 |
| - return fmt.Errorf("primary has been quarantined: %s", err) |
75 |
| - } else if err != nil { |
76 |
| - return fmt.Errorf("failed to run zombie diagnosis: %s", err) |
77 |
| - } |
78 |
| - |
79 |
| - // Clear zombie lock if it exists |
80 |
| - if flypg.ZombieLockExists() { |
81 |
| - log.Println("Clearing zombie lock and enabling read/write") |
82 |
| - if err := flypg.RemoveZombieLock(); err != nil { |
83 |
| - return fmt.Errorf("failed to remove zombie lock: %s", err) |
84 |
| - } |
85 |
| - |
86 |
| - log.Println("Broadcasting readonly state change") |
87 |
| - if err := flypg.BroadcastReadonlyChange(ctx, node, false); err != nil { |
88 |
| - log.Printf("errors while disabling readonly: %s", err) |
89 |
| - } |
90 |
| - } |
91 |
| - |
92 |
| - return nil |
93 |
| -} |
0 commit comments