mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
repmgr master unregister: check for downstream nodes
Foreign key dependencies will make it impossible to remove the node if it still has downstream nodes pointing to it.
This commit is contained in:
10
dbutils.h
10
dbutils.h
@@ -73,6 +73,7 @@ typedef struct s_node_info
|
||||
}
|
||||
|
||||
|
||||
/* structs to store a list of node records */
|
||||
typedef struct NodeInfoListCell
|
||||
{
|
||||
struct NodeInfoListCell *next;
|
||||
@@ -83,8 +84,14 @@ typedef struct NodeInfoList
|
||||
{
|
||||
NodeInfoListCell *head;
|
||||
NodeInfoListCell *tail;
|
||||
int node_count;
|
||||
} NodeInfoList;
|
||||
|
||||
#define T_NODE_INFO_LIST_INITIALIZER { \
|
||||
NULL, \
|
||||
NULL, \
|
||||
0 \
|
||||
}
|
||||
|
||||
typedef struct s_event_info
|
||||
{
|
||||
@@ -126,6 +133,8 @@ typedef struct s_connection_user
|
||||
bool is_superuser;
|
||||
} t_connection_user;
|
||||
|
||||
|
||||
|
||||
/* connection functions */
|
||||
PGconn *establish_db_connection(const char *conninfo,
|
||||
const bool exit_on_error);
|
||||
@@ -190,6 +199,7 @@ int get_node_record(PGconn *conn, int node_id, t_node_info *node_info);
|
||||
int get_node_record_by_name(PGconn *conn, const char *node_name, t_node_info *node_info);
|
||||
bool get_local_node_record(PGconn *conn, int node_id, t_node_info *node_info);
|
||||
bool get_master_node_record(PGconn *conn, t_node_info *node_info);
|
||||
void get_downstream_node_records(PGconn *conn, int node_id, NodeInfoList *nodes);
|
||||
|
||||
bool create_node_record(PGconn *conn, char *repmgr_action, t_node_info *node_info);
|
||||
bool update_node_record(PGconn *conn, char *repmgr_action, t_node_info *node_info);
|
||||
|
||||
Reference in New Issue
Block a user