回合commit f60dd06e
This commit is contained in:
@ -1772,6 +1772,7 @@ int init_gauss_cluster_config(void)
|
||||
|
||||
if (g_nodeHeader.node <= 0) {
|
||||
free(g_node);
|
||||
g_node = nullptr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1784,12 +1785,14 @@ int init_gauss_cluster_config(void)
|
||||
|
||||
if (NULL == g_currentNode) {
|
||||
free(g_node);
|
||||
g_node = nullptr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (get_dynamic_dn_role() != 0) {
|
||||
// failed to get dynamic dn role
|
||||
free(g_node);
|
||||
g_node = nullptr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1810,7 +1813,6 @@ bool check_synchronous_standby_names(char **newval, void **extra, GucSource sour
|
||||
SyncRepConfigData *pconf = NULL;
|
||||
syncrep_scanner_yyscan_t yyscanner;
|
||||
char* data_dir = t_thrd.proc_cxt.DataDir;
|
||||
uint32 idx;
|
||||
char* p = NULL;
|
||||
|
||||
/* Reset communication variables to ensure a fresh start */
|
||||
@ -1845,20 +1847,15 @@ bool check_synchronous_standby_names(char **newval, void **extra, GucSource sour
|
||||
// The sync number must less or equals to the number of standby node names.
|
||||
return false;
|
||||
}
|
||||
|
||||
/* get current cluster information from cluster_staic_config */
|
||||
if (strcmp(u_sess->attr.attr_common.application_name, "gsql") == 0 && has_static_config()
|
||||
&& 0 == init_gauss_cluster_config()) {
|
||||
for (idx = 0; idx < g_node_num; idx++) {
|
||||
if (g_currentNode->node == g_node[idx].node) {
|
||||
g_local_node_idx = idx;
|
||||
break;
|
||||
}
|
||||
if (t_thrd.role == WORKER && strcmp(u_sess->attr.attr_common.application_name, "gsql") == 0
|
||||
&& has_static_config()) {
|
||||
if (0 != init_gauss_cluster_config()) {
|
||||
goto pass;
|
||||
}
|
||||
} else {
|
||||
goto pass;
|
||||
}
|
||||
g_local_node_name = g_node[g_local_node_idx].nodeName;
|
||||
|
||||
p = pconf->member_names;
|
||||
for (int i = 1; i <= pconf->nmembers; i++) {
|
||||
|
||||
@ -294,11 +294,6 @@ int read_config_file(const char* file_path, int* err_no, bool inReload, int mall
|
||||
FREAD(&g_nodeHeader.nodeCount, 1, sizeof(uint32), fd);
|
||||
FREAD(&g_nodeHeader.node, 1, sizeof(uint32), fd);
|
||||
|
||||
if (g_node != NULL && !inReload) {
|
||||
free(g_node);
|
||||
g_node = NULL;
|
||||
}
|
||||
|
||||
if (g_nodeHeader.nodeCount > CM_NODE_MAXNUM || g_nodeHeader.nodeCount == 0) {
|
||||
fclose(fd);
|
||||
return READ_FILE_ERROR;
|
||||
@ -308,14 +303,16 @@ int read_config_file(const char* file_path, int* err_no, bool inReload, int mall
|
||||
goto read_failed;
|
||||
|
||||
if (!inReload) {
|
||||
if (mallocByNodeNum == MALLOC_BY_NODE_NUM) {
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * g_nodeHeader.nodeCount);
|
||||
} else {
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * CM_NODE_MAXNUM);
|
||||
}
|
||||
if (g_node == NULL) {
|
||||
fclose(fd);
|
||||
return OUT_OF_MEMORY;
|
||||
if (mallocByNodeNum == MALLOC_BY_NODE_NUM) {
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * g_nodeHeader.nodeCount);
|
||||
} else {
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * CM_NODE_MAXNUM);
|
||||
}
|
||||
if (g_node == NULL) {
|
||||
fclose(fd);
|
||||
return OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
/* g_node size may be larger than SECUREC_STRING_MAX_LEN in large cluster.*/
|
||||
@ -816,15 +813,12 @@ int read_lc_config_file(const char* file_path, int* err_no)
|
||||
return READ_FILE_ERROR;
|
||||
}
|
||||
|
||||
if (g_node != NULL) {
|
||||
free(g_node);
|
||||
g_node = NULL;
|
||||
}
|
||||
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * g_node_num);
|
||||
if (g_node == NULL) {
|
||||
fclose(fd);
|
||||
return OUT_OF_MEMORY;
|
||||
g_node = (staticNodeConfig*)malloc(sizeof(staticNodeConfig) * g_node_num);
|
||||
if (g_node == NULL) {
|
||||
fclose(fd);
|
||||
return OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = 0; ii < g_node_num; ii++) {
|
||||
|
||||
Reference in New Issue
Block a user