Postgres Escalating Lock based on Blocked Stmts - Mailing list pgsql-bugs

From Eric Alders
Subject Postgres Escalating Lock based on Blocked Stmts
Date
Msg-id 1E2D5762-2E5A-4E7A-9FF8-2D7B814F2D5D@zelis.com
Whole thread Raw
Responses Re: Postgres Escalating Lock based on Blocked Stmts
List pgsql-bugs

We have an interesting locking scenario that seems like a bug but I’d like you guys to weigh in…

 

To reproduce the scenario:

  1. Start with a table in a schema that executes a Read Committed Select that may take some time.
  2. Issue a DROP SCHEMA stmt to the schema where the SELECT is taking place. (Because the DROP requires Exclusive lock on the schema it blocks as expected until the SELECT is complete).
  3. Issue a second SELECT query on the same schema table. In this scenario the stmt is blocked by the DROP Schema stmt which is still blocked by the original SELECT. This seems odd as Postgres has elevated the lock based on a blocked DROP stmt instead of the current executing SELECT stmt. In fact, every stmt is blocked to anything trying to read from the schema.
  4. If you manually cancel the DROP stmt to allow the second SELECT to continue the second SELECT query hangs and does not return. A manual restart of the Postgres server must happen to fix the issue.

 

Current version of Postgres that we are using is v11.2

 

Eric Alders

Senior Software Architect

Zelis

7007 College Blvd, Suite 650

Overland Park, KS 66211

eric.alders@zelis.com

www.zelis.com

 


cidimage002.png@01D57AB1.77FA9A90

 


Confidentiality Notice

This email and the attachments may contain information which is privileged and/or confidential and is intended for the business and/or confidential use of the recipient only. Such information may be protected by applicable State and/or Federal laws from disclosure or unauthorized use. If you are not the intended recipient, you are hereby notified that any disclosure is strictly prohibited. If you have received this email in error, please contact the sender immediately.

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres turns LEFT JOIN into INNER JOIN - incorrect results
Next
From: Heikki Linnakangas
Date:
Subject: Re: Postgres Escalating Lock based on Blocked Stmts