possible deadlock: different lock ordering for heap pages - Mailing list pgsql-hackers

From Nishant, Fnu
Subject possible deadlock: different lock ordering for heap pages
Date
Msg-id 5883C831-2ED1-47C8-BFAC-2D5BAE5A8CAE@amazon.com
Whole thread Raw
Responses Re: possible deadlock: different lock ordering for heap pages  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers

Hello,

While locking heap pages (function RelationGetBufferForTuple() in file hio.c) we acquire locks in increasing block number order to avoid deadlock. In certain cases, we do have to drop and reacquire lock on heap pages (when we have to pin visibility map pages) to avoid doing IO while holding exclusive lock. The problem is we now acquire locks in bufferId order, which looks like a slip and the intention was to grab it in block number order. Since it is a trivial change, I am attaching a patch to correct it.

Thanks,

Nishant

 

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: What to name the current heap after pluggable storage / what torename?
Next
From: Tomas Vondra
Date:
Subject: Re: jsonpath