public inbox for [email protected]  
help / color / mirror / Atom feed
Add missing CHECK_FOR_INTERRUPTS calls in dblink module
3+ messages / 2 participants
[nested] [flat]

* Add missing CHECK_FOR_INTERRUPTS calls in dblink module
@ 2026-03-10 08:37 Lakshmi N <[email protected]>
  2026-03-10 09:25 ` Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module Kirill Reshke <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Lakshmi N @ 2026-03-10 08:37 UTC (permalink / raw)
  To: pgsql-hackers

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:

  [application/octet-stream] 0001-Add-missing-CHECK_FOR_INTERRUPTS-in-dblink-module.patch (591B, 3-0001-Add-missing-CHECK_FOR_INTERRUPTS-in-dblink-module.patch)
  download | inline diff:
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 8bf8fc8ea2f..d9e06915e3a 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -952,6 +952,8 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
 		{
 			HeapTuple	tuple;
 
+			CHECK_FOR_INTERRUPTS();
+
 			if (!is_sql_cmd)
 			{
 				int			i;
@@ -1894,6 +1896,8 @@ dblink_get_notify(PG_FUNCTION_ARGS)
 		Datum		values[DBLINK_NOTIFY_COLS];
 		bool		nulls[DBLINK_NOTIFY_COLS];
 
+		CHECK_FOR_INTERRUPTS();
+
 		memset(values, 0, sizeof(values));
 		memset(nulls, 0, sizeof(nulls));
 


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module
  2026-03-10 08:37 Add missing CHECK_FOR_INTERRUPTS calls in dblink module Lakshmi N <[email protected]>
@ 2026-03-10 09:25 ` Kirill Reshke <[email protected]>
  2026-03-15 18:22   ` Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module Lakshmi N <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Kirill Reshke @ 2026-03-10 09:25 UTC (permalink / raw)
  To: Lakshmi N <[email protected]>; +Cc: pgsql-hackers

On Tue, 10 Mar 2026 at 14:00, Lakshmi N <[email protected]> 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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module
  2026-03-10 08:37 Add missing CHECK_FOR_INTERRUPTS calls in dblink module Lakshmi N <[email protected]>
  2026-03-10 09:25 ` Re: Add missing CHECK_FOR_INTERRUPTS calls in dblink module Kirill Reshke <[email protected]>
@ 2026-03-15 18:22   ` Lakshmi N <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Lakshmi N @ 2026-03-15 18:22 UTC (permalink / raw)
  To: Kirill Reshke <[email protected]>; +Cc: pgsql-hackers

Hi Kirill,

Apologies for the delay in responding.

On Tue, Mar 10, 2026 at 2:25 AM Kirill Reshke <[email protected]>
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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-03-15 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 08:37 Add missing CHECK_FOR_INTERRUPTS calls in dblink module Lakshmi N <[email protected]>
2026-03-10 09:25 ` Kirill Reshke <[email protected]>
2026-03-15 18:22   ` Lakshmi N <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox