File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 7
7
"os"
8
8
9
9
"github.com/fly-apps/postgres-flex/internal/flypg"
10
+ "github.com/fly-apps/postgres-flex/internal/flypg/admin"
10
11
"github.com/fly-apps/postgres-flex/internal/utils"
11
12
)
12
13
@@ -48,5 +49,20 @@ func processUnregistration(ctx context.Context) error {
48
49
return fmt .Errorf ("failed to unregister member: %v" , err )
49
50
}
50
51
52
+ slots , err := admin .ListReplicationSlots (ctx , conn )
53
+ if err != nil {
54
+ return fmt .Errorf ("failed to list replication slots: %v" , err )
55
+ }
56
+
57
+ targetSlot := fmt .Sprintf ("repmgr_slot_%d" , member .ID )
58
+ for _ , slot := range slots {
59
+ if slot .Name == targetSlot {
60
+ if err := admin .DropReplicationSlot (ctx , conn , targetSlot ); err != nil {
61
+ return fmt .Errorf ("failed to drop replication slot: %v" , err )
62
+ }
63
+ break
64
+ }
65
+ }
66
+
51
67
return nil
52
68
}
You can’t perform that action at this time.
0 commit comments