From 086721f7fbfcf16094589ae2c418e9cee707659a Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Sun, 27 Oct 2024 14:07:28 +0100 Subject: [PATCH 1/2] tmp fix parser/snprintf.c --- src/parser/snprintf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parser/snprintf.c b/src/parser/snprintf.c index 19e666b7c..599637216 100644 --- a/src/parser/snprintf.c +++ b/src/parser/snprintf.c @@ -43,9 +43,11 @@ #include #include #include +#include #include "pool_parser.h" #include "stringinfo.h" #include "utils/palloc.h" +#include "postgresql/16/server/postgres_fe.h" /* * We used to use the platform's NL_ARGMAX here, but that's a bad idea, From 2b897a4d334a48415ce2e76d3bc78b76dbdb88ae Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Sun, 27 Oct 2024 14:04:24 +0100 Subject: [PATCH 2/2] fix build time_t for 32-bits --- src/include/utils/json.h | 2 +- src/include/watchdog/wd_json_data.h | 4 ++-- src/utils/json.c | 2 +- src/watchdog/watchdog.c | 4 ++-- src/watchdog/wd_commands.c | 2 +- src/watchdog/wd_json_data.c | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/include/utils/json.h b/src/include/utils/json.h index 67cc0255a..dccf2c0d3 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -313,7 +313,7 @@ extern "C" /* pgpool-II extensions */ json_value *json_get_value_for_key(json_value * source, const char *key); int json_get_int_value_for_key(json_value * source, const char *key, int *value); -int json_get_long_value_for_key(json_value * source, const char *key, long *value); +int json_get_long_value_for_key(json_value * source, const char *key, time_t *value); char *json_get_string_value_for_key(json_value * source, const char *key); int json_get_bool_value_for_key(json_value * source, const char *key, bool *value); diff --git a/src/include/watchdog/wd_json_data.h b/src/include/watchdog/wd_json_data.h index 7b53999ee..c4d3dbd5e 100644 --- a/src/include/watchdog/wd_json_data.h +++ b/src/include/watchdog/wd_json_data.h @@ -51,8 +51,8 @@ extern bool parse_node_status_json(char *json_data, int data_len, int *nodeID, i extern bool parse_beacon_message_json(char *json_data, int data_len, int *state, - long *seconds_since_node_startup, - long *seconds_since_current_state, + time_t *seconds_since_node_startup, + time_t *seconds_since_current_state, int *quorumStatus, int *standbyNodesCount, bool *escalated); diff --git a/src/utils/json.c b/src/utils/json.c index 319c8fdbf..1faa9501a 100644 --- a/src/utils/json.c +++ b/src/utils/json.c @@ -1191,7 +1191,7 @@ json_get_int_value_for_key(json_value * source, const char *key, int *value) } int -json_get_long_value_for_key(json_value * source, const char *key, long *value) +json_get_long_value_for_key(json_value * source, const char *key, time_t *value) { json_value *jNode; diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c index 0c29cc68d..d8ef4186f 100644 --- a/src/watchdog/watchdog.c +++ b/src/watchdog/watchdog.c @@ -6654,8 +6654,8 @@ watchdog_state_machine_nw_isolation(WD_EVENTS event, WatchdogNode * wdNode, WDPa static bool beacon_message_received_from_node(WatchdogNode * wdNode, WDPacketData * pkt) { - long seconds_since_node_startup; - long seconds_since_current_state; + time_t seconds_since_node_startup; + time_t seconds_since_current_state; int quorum_status; int standby_nodes_count; bool escalated; diff --git a/src/watchdog/wd_commands.c b/src/watchdog/wd_commands.c index 145955865..3f6c6e14e 100644 --- a/src/watchdog/wd_commands.c +++ b/src/watchdog/wd_commands.c @@ -193,7 +193,7 @@ get_wd_runtime_variable_value(char* wd_authkey, char *varName) case VALUE_DATA_TYPE_LONG: { - long longVal; + time_t longVal; if (json_get_long_value_for_key(root, WD_JSON_KEY_VALUE_DATA, &longVal)) { diff --git a/src/watchdog/wd_json_data.c b/src/watchdog/wd_json_data.c index 474fc37a4..2b5dee7a5 100644 --- a/src/watchdog/wd_json_data.c +++ b/src/watchdog/wd_json_data.c @@ -540,8 +540,8 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey) if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec)) { bool escalated; - long seconds_since_node_startup; - long seconds_since_current_state; + time_t seconds_since_node_startup; + time_t seconds_since_current_state; struct timeval current_time; gettimeofday(¤t_time, NULL); @@ -640,8 +640,8 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey) bool parse_beacon_message_json(char *json_data, int data_len, int *state, - long *seconds_since_node_startup, - long *seconds_since_current_state, + time_t *seconds_since_node_startup, + time_t *seconds_since_current_state, int *quorumStatus, int *standbyNodesCount, bool *escalated)