Compare commits

..

1 Commits

Author SHA1 Message Date
Gianni Ciolli
d52b045113 Factoring out switchover sanity checks
We refactor switchover sanity checks into a separate function, using a
dedicated structure to pass variables across.

Signed-off-by: Gianni Ciolli <gianni.ciolli@enterprisedb.com>
2022-11-09 21:10:17 +00:00
3 changed files with 438 additions and 389 deletions

View File

@@ -16,7 +16,7 @@ jobs:
ref: '${{ github.head_ref }}'
- name: Checkout GitHub Action Repo
uses: actions/checkout@v3.3.0
uses: actions/checkout@master
with:
repository: EnterpriseDB/edb-github-actions.git
ref: master

File diff suppressed because it is too large Load Diff

View File

@@ -19,6 +19,77 @@
#ifndef _REPMGR_ACTION_STANDBY_H_
#define _REPMGR_ACTION_STANDBY_H_
typedef struct
{
int reachable_sibling_node_count;
int reachable_sibling_nodes_with_slot_count;
int unreachable_sibling_node_count;
int min_required_wal_senders;
int min_required_free_slots;
} SiblingNodeStats;
#define T_SIBLING_NODES_STATS_INITIALIZER { \
0, \
0, \
0, \
0, \
0 \
}
typedef struct
{
RepmgrdInfo **repmgrd_info;
int repmgrd_running_count;
bool dry_run_success;
/* store list of configuration files on the demotion candidate */
KeyValueList remote_config_files;
/* used for handling repmgrd pause/unpause */
NodeInfoList all_nodes;
NodeInfoList sibling_nodes;
SiblingNodeStats sibling_nodes_stats;
t_event_info event_info;
int remote_node_id;
t_node_info remote_node_record;
t_node_info local_node_record;
char remote_conninfo[MAXCONNINFO];
bool switchover_success;
RecoveryType recovery_type;
PGconn *superuser_conn;
/* the remote server is the primary to be demoted */
char remote_host[MAXLEN];
int remote_repmgr_version;
PGconn *remote_conn;
PGconn *local_conn;
} t_standby_switchover_rec;
#define T_STANDBY_SWITCHOVER_INITIALIZER { \
NULL, \
true, \
{NULL, NULL}, \
T_NODE_INFO_LIST_INITIALIZER, \
T_NODE_INFO_LIST_INITIALIZER, \
T_SIBLING_NODES_STATS_INITIALIZER, \
T_EVENT_INFO_INITIALIZER, \
UNKNOWN_NODE_ID, \
T_NODE_INFO_INITIALIZER, \
T_NODE_INFO_INITIALIZER, \
"", \
true, \
RECTYPE_UNKNOWN, \
NULL, \
"", \
UNKNOWN_REPMGR_VERSION_NUM, \
NULL, \
NULL \
}
extern void do_standby_clone(void);
extern void do_standby_register(void);
extern void do_standby_unregister(void);