Re: BUG #18616: Long-running hash index build can not be interrupted

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18616: Long-running hash index build can not be interrupted
Date: 2024-09-13 18:00:00
Message-ID: 20a57c76-7aaf-a641-add3-147541a4dccf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Pavel,

13.09.2024 17:51, Pavel Borisov wrote:
>
>
> Reproduced on all supported versions.
>
> I was unable to reproduce it on my machine with these settings. Tried statement timeouts 30-120s. Index build appears
> to be in interruptible phase on my system.
> But could you check in your environment with the following patch?
>

Thank you for paying attention to this!

Yes, the patch works for me. The query is interrupted as expected.
But I wonder, why don't you the see same?

Could you please show the server log, with the following change applied and
log_statement = 'all'
backtrace_functions = 'ProcessInterrupts'
?

--- a/src/backend/access/hash/hashsort.c
+++ b/src/backend/access/hash/hashsort.c
@@ -125,6 +125,7 @@ _h_indexbuild(HSpool *hspool, Relation heapRel)
     uint32      hashkey = 0;
 #endif

+elog(LOG, "_h_indexbuild() start");
     tuplesort_performsort(hspool->sortstate);

     while ((itup = tuplesort_getindextuple(hspool->sortstate, true)) != NULL)
@@ -151,4 +152,5 @@ _h_indexbuild(HSpool *hspool, Relation heapRel)
pgstat_progress_update_param(PROGRESS_CREATEIDX_TUPLES_DONE,
                                      ++tups_done);
     }
+elog(LOG, "_h_indexbuild() end; tups_done: %ld", tups_done);
 }

Best regards,
Alexander

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-09-13 19:22:26 Re: BUG #18616: Long-running hash index build can not be interrupted
Previous Message Tom Lane 2024-09-13 16:56:03 Re: BUG #18617: PostgreSQL Server Subprocess Crashes by the XPATH Function Expression with Crafted Arguments