IsShutdown checks if the PGDATA status represents a shut down instance
(ctx context.Context)
| 143 | // IsShutdown checks if the PGDATA status represents |
| 144 | // a shut down instance |
| 145 | func (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 |
| 163 | func ParsePgControldataOutput(data string) PgControlData { |
no test coverage detected