Re: Commit Timestamp and LSN Inversion issue - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: Commit Timestamp and LSN Inversion issue
Date
Msg-id 4410956c-dcb9-4bbc-a47b-8abb2fddd6d8@wi3ck.info
Whole thread Raw
In response to Re: Commit Timestamp and LSN Inversion issue  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On 11/6/24 06:23, Amit Kapila wrote:

> I think we avoid calling hook/callback functions after holding a lock
> (spinlock or LWLock) as the user may do an expensive operation or
> acquire some other locks in those functions which could lead to
> deadlocks or impact the concurrency. So, it would be better to
> directly call an inline function to perform the required operation.

This is a valid concern. The reason why I kept it as a hook is because 
ReserveXLogInsertLocation() has no knowledge that this is allocating WAL 
space for a commit record. Only the caller does. We certainly need to be 
extremely careful what any such hook function is doing. Acquiring 
additional locks is definitely not acceptable. But I am not sure we 
should burden this function with specialized knowledge about what it is 
reserving WAL space for.


Regards, Jan




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: define pg_structiszero(addr, s, r)
Next
From: Maiquel Grassi
Date:
Subject: RE: Rename Function: pg_postmaster_start_time