Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
fail-fast: true
matrix:
ci:
- { PGVER: 13 }
- { PGVER: 14 }
- { PGVER: 15 }
- { PGVER: 16 }
Expand Down
24 changes: 23 additions & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
#include <utils/fmgroids.h>
#include <utils/guc.h>

#if PG_VERSION_NUM >= 170000
#include <utils/wait_event.h>
#endif

#if PG_VERSION_NUM >= 90300
# include <access/htup_details.h>
#endif
Expand Down Expand Up @@ -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
Expand Down Expand 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
Expand Down Expand Up @@ -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");
}
}

Expand Down Expand Up @@ -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);

Expand Down