Re: Review: Hot standby

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: Hot standby
Date: 2008-11-21 13:35:35
Message-ID: 1227274535.7015.80.camel@hp_dx2400_1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Fri, 2008-11-21 at 15:21 +0530, Pavan Deolasee wrote:
>
> + /*
> + * Release locks, if any.
> + */
> + RelationReleaseRecoveryLocks(xlrec->slotId);
>
>
> If I am reading the patch correctly, AccessExclusiveLocks acquired by
> a transaction will be released when the transaction is committed or
> aborted. If the transaction errors out with FATAL, the locks will be
> released when the next transaction occupying the same slot is
> committed/aborted.
>
> I smell some sort of deadlock condition here. What if the following
> events happen:
>
> - transaction A (slot 1) starts and acquires AEL lock on relation
> - transaction A errors out with FATAL error
> - transaction B (slot 1) starts and requests AEL lock on the same
> relation
>
> Won't B deadlock with A ? Since B hasn't yet committed/aborted, the
> lock held by A is not released and
> relation_redo_lock() would indefinitely wait for the lock.

This won't happen because the lock is held by the startup process on
behalf of slot 1. Explained in comments in inval.c code.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-11-21 13:36:07 Re: Autoconf, libpq and replacement function
Previous Message Magnus Hagander 2008-11-21 13:33:39 Re: SSL configure patch: review