From b3874e6efaffb45685c384e28d50387dafcd0650 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 19 Feb 2026 14:51:45 -0800 Subject: [PATCH 1/2] Add WaitEventExtensionNew calls for Pg17+, to make the use of the extension more visible for long-running http() calls --- http.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index c4a4e5c..e3f7ce5 100644 --- a/http.c +++ b/http.c @@ -66,6 +66,10 @@ #include #include +#if PG_VERSION_NUM >= 170000 +#include +#endif + #if PG_VERSION_NUM >= 90300 # include #endif @@ -217,6 +221,10 @@ static size_t http_readback(void *buffer, size_t size, size_t nitems, void *inst /* Global variables */ static CURL * g_http_handle = NULL; +#if PG_VERSION_NUM >= 170000 +static uint32 wait_event_transfer = 0; +#endif + /* * Interrupt support is dependent on CURLOPT_XFERINFOFUNCTION which * is only available from 7.39.0 and up @@ -421,6 +429,10 @@ void _PG_init(void) */ http_guc_init(); +#if PG_VERSION_NUM >= 170000 + wait_event_transfer = WaitEventExtensionNew("HttpTransfer"); +#endif + #ifdef HTTP_MEM_CALLBACKS /* * Use PgSQL memory management in Curl @@ -872,7 +884,7 @@ http_check_curl_version(const curl_version_info_data *version_info) if ( version_info->version_num < CURL_MIN_VERSION ) { - elog(ERROR, "pgsql-http requires Curl version 0.7.20 or higher"); + elog(ERROR, "pgsql-http requires Curl version 7.20.0 or higher"); } } @@ -1363,10 +1375,20 @@ Datum http_request(PG_FUNCTION_ARGS) /* Set the headers */ CURL_SETOPT(g_http_handle, CURLOPT_HTTPHEADER, headers); +#if PG_VERSION_NUM >= 170000 + /* Set up wait event tracking */ + pgstat_report_wait_start(wait_event_transfer); +#endif + /************************************************************************* * PERFORM THE REQUEST! **************************************************************************/ http_return = curl_easy_perform(g_http_handle); + +#if PG_VERSION_NUM >= 170000 + pgstat_report_wait_end(); +#endif + elog(DEBUG2, "pgsql-http: queried '%s'", uri); elog(DEBUG2, "pgsql-http: http_return '%d'", http_return); From fe34bea30c8400176ea7ca8b7a09496decc659fe Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 19 Feb 2026 14:53:14 -0800 Subject: [PATCH 2/2] Drop pg13 test --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0e32dd..aaca106 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ jobs: fail-fast: true matrix: ci: - - { PGVER: 13 } - { PGVER: 14 } - { PGVER: 15 } - { PGVER: 16 }