Re: Shouldn't postgres_fdw report warning when it gives up getting result from foreign server?

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-12-06T08:16:59Z
Lists: pgsql-hackers

Attachments


On 2021/12/03 23:04, Bharath Rupireddy wrote:
> Let's not use the boolean just for the cancel request which isn't
> scalable IMO. Maybe a macro/enum?
> 
> Otherwise, we could just do, although it doesn't look elegant:
> 
> if (pgfdw_get_cleanup_result(conn, endtime, &result, "(cancel request)"))
> 
> if (strcmp(query, "(cancel request)") == 0)
>      WARNING without  "remote SQL command:
> else
>      WARNING with "remote SQL command:

Yeah, I agree that's not elegant..

So I'd like to propose new patch with different design from
what I proposed before. Patch attached.

This patch changes pgfdw_exec_cleanup_query() so that it tells
its callers the information about whether the timeout expired
or not. Then the callers (pgfdw_exec_cleanup_query and
pgfdw_cancel_query) report the warning messages based on
the results from pgfdw_exec_cleanup_query().

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Commits

  1. postgres_fdw: Report warning when timeout expires while getting query result.