query cancel issues in contrib/dblink

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: query cancel issues in contrib/dblink
Date: 2009-06-26 02:41:37
Message-ID: 20090626100150.9ABF.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

contrib/dblink seems to have no treatments for query cancels.
It causes the following issues:

(1) Users need to wait for completion of remote query.
Requests for query cancel won't be delivered to remote servers.

(2) PGresult objects will be memory leak. The result is not released
when query is cancelled; it is released only when dblink function
is called max_calls times.

They are long standing issues (not only in 8.4),
but I hope we will fix them to make dblink more robust.

For (1), asynchronous libpq functions should be used instead of blocking
ones, and wait for the remote query using a loop with CHECK_FOR_INTERRUPTS().
For (2), we might need to store PGresult not only in funcctx->user_fctx
but also in a global list, and free all results in XactCallback if remain.

Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-06-26 02:48:58 Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Previous Message Jeremy Kerr 2009-06-26 02:18:58 Re: [PATCH] backend: compare word-at-a-time in bcTruelen