Add missing CHECK_FOR_INTERRUPTS calls in dblink module

Started by Lakshmi N30 days ago3 messageshackers
Jump to latest
#1Lakshmi N
lakshmin.jhs@gmail.com

Hi All,

This is my first patch submission, please guide me if I made any mistakes.
I noticed that CHECK_FOR_INTERRUPTS is missing at two places in dblink.c.
Submitting a small patch to address this.

Regards,
Lakshmi

Attachments:

0001-Add-missing-CHECK_FOR_INTERRUPTS-in-dblink-module.patchapplication/octet-stream; name=0001-Add-missing-CHECK_FOR_INTERRUPTS-in-dblink-module.patchDownload+4-0
#2Kirill Reshke
reshkekirill@gmail.com
In reply to: Lakshmi N (#1)
Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module

On Tue, 10 Mar 2026 at 14:00, Lakshmi N <lakshmin.jhs@gmail.com> wrote:

Hi All,

This is my first patch submission, please guide me if I made any mistakes. I noticed that CHECK_FOR_INTERRUPTS is missing at two places in dblink.c. Submitting a small patch to address this.

Regards,
Lakshmi

Hi!
Are you trying to fix any real problem? So, do you have any reproduces
where dblink stucks while processing tuples? I am somehow surprised if
we do not have CFI somewhere inside tuplestore_puttuple...

--
Best regards,
Kirill Reshke

#3Lakshmi N
lakshmin.jhs@gmail.com
In reply to: Kirill Reshke (#2)
Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module

Hi Kirill,

Apologies for the delay in responding.

On Tue, Mar 10, 2026 at 2:25 AM Kirill Reshke <reshkekirill@gmail.com>
wrote:

Hi!
Are you trying to fix any real problem? So, do you have any reproduces
where dblink stucks while processing tuples? I am somehow surprised if
we do not have CFI somewhere inside tuplestore_puttuple...

This can be reproduced when iteration over millions of tuples, particularly
when the tuples spill to a temp file on disk.
I added pg_usleep(1000L) before the end of the loop to have a
predictable repro, which looks like no CFI in tuplestore_puttuple.
Tested with the below queries to verify the behavior (which should trigger
temp IO).

SET work_mem = '64kB';
SELECT dblink_connect('myconn', 'dbname=' || current_database());
SELECT dblink_open('myconn', 'mycursor', 'SELECT i, repeat(''x'', 1024)
FROM generate_series(1, 100000) i');
explain analyze SELECT * FROM dblink_fetch('myconn', 'mycursor', 100000) AS
t(i int, pad text);
SELECT dblink_close('myconn', 'mycursor');
SELECT dblink_disconnect('myconn');
RESET work_mem;

Regards,
Lakshmi