agora inbox for pgpool-committers@postgresql.orghelp / color / mirror / Atom feed
pgpool: Make time calculations always long long. 2+ messages / 1 participants [nested] [flat]
* pgpool: Make time calculations always long long. @ 2025-10-09 11:34 Tatsuo Ishii <ishii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tatsuo Ishii @ 2025-10-09 11:34 UTC (permalink / raw) To: pgpool-committers@lists.postgresql.org Make time calculations always long long. Previously pgpool assumed that time_t to be a simple long. This causes a lot of compile time warnings on certain systems, for example OpenBSD because on the system time_t is __int64, which results in long long. This commit upcasts such calculations to long long to avoid the issue. This way times can't get truncated and for the places where time_t is actually used as a time and not a time diff this would allow pgpool to keep working correctly post Y2038 on 64 bit clean time_t systems (e.g. i386 OpenBSD). Moreover, json_get_long_value_for_key is changed to json_get_llong_value_for_key and changed the parameter to long long. This makes it more in line _json_value's integer, which is defined as int64. This should also give 32 bit platforms proper retrieval of the max value of an integer and may or may not solve some weird integer overflow issues. Backpatch for 4.6 was rebased by Gyorgy Sarvari. Author: Martijn van Duren <pgpool@list.imperialat.at> Reviewed-by: Tatsuo Ishii <ishii@postgresql.org> Reviewed-by: Gyorgy Sarvari <skandigraun@gmail.com> Backpatch-through: v4.6 Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004584.html Discussion: https://www.postgresql.org/message-id/20251003.211957.2067537305399895611.ishii%40postgresql.org Discussion: https://github.com/pgpool/pgpool2/pull/128 Branch ------ master Details ------- https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=97ab3f1257c6fe0635281f31e8beaf8850bde... Modified Files -------------- src/include/utils/json.h | 2 +- src/include/watchdog/wd_commands.h | 2 +- src/include/watchdog/wd_json_data.h | 4 ++-- src/main/pgpool_logger.c | 2 +- src/pcp_con/pcp_worker.c | 4 ++-- src/protocol/pool_connection_pool.c | 12 ++++++------ src/query_cache/pool_memqcache.c | 8 ++++---- src/utils/json.c | 2 +- src/utils/pool_process_reporting.c | 2 +- src/utils/pool_relcache.c | 2 +- src/watchdog/watchdog.c | 4 ++-- src/watchdog/wd_commands.c | 4 ++-- src/watchdog/wd_heartbeat.c | 4 ++-- src/watchdog/wd_json_data.c | 20 +++++++++++--------- 14 files changed, 37 insertions(+), 35 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgpool: Make time calculations always long long. @ 2025-10-09 11:35 Tatsuo Ishii <ishii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tatsuo Ishii @ 2025-10-09 11:35 UTC (permalink / raw) To: pgpool-committers@lists.postgresql.org Make time calculations always long long. Previously pgpool assumed that time_t to be a simple long. This causes a lot of compile time warnings on certain systems, for example OpenBSD because on the system time_t is __int64, which results in long long. This commit upcasts such calculations to long long to avoid the issue. This way times can't get truncated and for the places where time_t is actually used as a time and not a time diff this would allow pgpool to keep working correctly post Y2038 on 64 bit clean time_t systems (e.g. i386 OpenBSD). Moreover, json_get_long_value_for_key is changed to json_get_llong_value_for_key and changed the parameter to long long. This makes it more in line _json_value's integer, which is defined as int64. This should also give 32 bit platforms proper retrieval of the max value of an integer and may or may not solve some weird integer overflow issues. Backpatch for 4.6 was rebased by Gyorgy Sarvari. Author: Martijn van Duren <pgpool@list.imperialat.at> Reviewed-by: Tatsuo Ishii <ishii@postgresql.org> Reviewed-by: Gyorgy Sarvari <skandigraun@gmail.com> Backpatch-through: v4.6 Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004584.html Discussion: https://www.postgresql.org/message-id/20251003.211957.2067537305399895611.ishii%40postgresql.org Discussion: https://github.com/pgpool/pgpool2/pull/128 Branch ------ V4_6_STABLE Details ------- https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=f91abf862d74b0eeac57857933ecdbb292af4... Modified Files -------------- src/include/utils/json.h | 2 +- src/include/watchdog/wd_commands.h | 2 +- src/include/watchdog/wd_json_data.h | 4 ++-- src/main/pgpool_logger.c | 2 +- src/pcp_con/pcp_worker.c | 4 ++-- src/protocol/pool_connection_pool.c | 12 ++++++------ src/query_cache/pool_memqcache.c | 6 +++--- src/utils/json.c | 2 +- src/utils/pool_process_reporting.c | 2 +- src/utils/pool_relcache.c | 2 +- src/watchdog/watchdog.c | 4 ++-- src/watchdog/wd_commands.c | 4 ++-- src/watchdog/wd_heartbeat.c | 4 ++-- src/watchdog/wd_json_data.c | 20 +++++++++++--------- 14 files changed, 36 insertions(+), 34 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-10-09 11:35 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-10-09 11:34 pgpool: Make time calculations always long long. Tatsuo Ishii <ishii@postgresql.org> 2025-10-09 11:35 pgpool: Make time calculations always long long. Tatsuo Ishii <ishii@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox