Hot standby, conflict resolution

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Hot standby, conflict resolution
Date: 2009-01-23 15:51:16
Message-ID: 4979E774.3070204@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The FATAL and ERROR cancellation modes are quite different. In FATAL
mode, you just want to kill the backend. The target connection doesn't
need to know the LSN.

In ERROR mode, you don't really want to interrupt the target backend. In
ReadBuffer, you're checking a global variable,
BufferRecoveryConflictPending on each call, and if it's set, you check
the buffer's LSN against the LSN of the earliest LSN conflicting LSN,
and throw an error if it's greater than that. Why do we jump through so
many hoops to get the earliest conflicting LSN to where it's needed? At
the moment:

1. Startup process sets the LSN in the target backend's PGPROC entry,
and signals it with SIGINT.
2. The target backend receives the signal; ProcessInterrupts is called
either immediately or at the next CHECK_FOR_INTERRUPTS() call.
3. ProcessInterrupts reads the value from PGPROC, and passes it to bufmgr.c

ISTM that if ReadBuffer read the value directly from the PGPROC entry,
there would be no need for the signaling (in the ERROR mode).

Correct me if I'm wrong, but I thought the idea of this new conflict
resolution was that the startup process doesn't need to wait for the
target backend to die. Instead, the target backend knows to commit
suicide if it stumbles into a buffer that's been modified in a
conflicting way. Looking at ResolveRecoveryConflictWithVirtualXIDs, it
looks like we still wait.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-01-23 16:00:54 Re: Hot Standby (v9d)
Previous Message Andrew Chernow 2009-01-23 15:44:28 Re: AIX 4.3 getaddrinfo busted