mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Refactor show matrix to handle node IDs correctly.
Previously the code assumed repmgr node IDs to be sequential, which is not guaranteed to be the case. With a non-sequential list of node IDs, an incorrect node id would be displayed, and memory accessed beyond the bounds of the matrix array. The refactored code is considerably less elegant than the original but will correctly handle a non-sequential sequence of node IDs.
This commit is contained in:
27
repmgr.h
27
repmgr.h
@@ -165,5 +165,32 @@ typedef struct
|
||||
t_configfile_info **files;
|
||||
} t_configfile_list;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int node_id;
|
||||
int node_status;
|
||||
} t_node_status_rec;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int node_id;
|
||||
char node_name[MAXLEN];
|
||||
t_node_status_rec **node_status_list;
|
||||
} t_node_status_matrix_rec;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int length;
|
||||
t_node_status_matrix_rec **matrix_list;
|
||||
} t_node_status_matrix;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int node_id;
|
||||
t_node_status_matrix **node_matrix;
|
||||
} t_node_status_cube;
|
||||
|
||||
|
||||
#define T_CONFIGFILE_LIST_INITIALIZER { 0, 0, NULL }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user