MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / IsShutdown

Method IsShutdown

pkg/utils/parser.go:145–160  ·  view source on GitHub ↗

IsShutdown checks if the PGDATA status represents a shut down instance

(ctx context.Context)

Source from the content-addressed store, hash-verified

143// IsShutdown checks if the PGDATA status represents
144// a shut down instance
145func (state PgDataState) IsShutdown(ctx context.Context) bool {
146 contextLogger := log.FromContext(ctx)
147
148 switch state {
149 case "shut down", "shut down in recovery":
150 return true
151
152 case "starting up", "shutting down", "in crash recovery", "in archive recovery", "in production":
153 return false
154 }
155
156 err := fmt.Errorf("unknown pg_controldata cluster state")
157 contextLogger.Error(err, "Unknown pg_controldata cluster state, defaulting to running cluster",
158 "state", state)
159 return false
160}
161
162// ParsePgControldataOutput parses a pg_controldata output into a map of key-value pairs
163func ParsePgControldataOutput(data string) PgControlData {

Callers 2

parser_test.goFile · 0.80
generateDemotionTokenFunction · 0.80

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected