On 2014-03-05 18:39:52 +0100, Andres Freund wrote:
> On March 5, 2014 6:07:43 PM CET, Tom Lane <t...@sss.pgh.pa.us> wrote:
> >$ pg_dump -F d -j 4 -f foo regression
> >pg_dump: [archiver (db)] query failed: pg_dump: [parallel archiver]
> >query was: SET TRANSACTION SNAPSHOT '00002130-1'
> >pg_dump: [archiver (db)] query failed: pg_dump: [archiver (db)] query
> >failed: pg_dump: [archiver (db)] query failed: $
> >
> >postmaster log shows:
> >
> >TRAP: FailedAssertion("!(HistoricSnapshotActive())", File: "snapmgr.c",
> >Line: 355)
> >TRAP: FailedAssertion("!(HistoricSnapshotActive())", File: "snapmgr.c",
> >Line: 355)
> >TRAP: FailedAssertion("!(HistoricSnapshotActive())", File: "snapmgr.c",
> >Line: 355)
> >TRAP: FailedAssertion("!(HistoricSnapshotActive())", File: "snapmgr.c",
> >Line: 355)
> >LOG:  server process (PID 15069) was terminated by signal 6: Aborted
> >DETAIL:  Failed process was running: SET TRANSACTION SNAPSHOT
> >'00002130-1'
> >LOG:  terminating any other active server processes
> >
> >That Assert appears to have been introduced by commit b89e1510.
> 
> It's a typo. It should make sure there is *no* historical
> snapshot. Will later test if it really works, but I'd be surprised if
> not.

So, after crashing my laptop by doing pg_dump -j16 on a cluster with 4GB
of shared_buffers (causing 16 parallel coredumps to be written) I can
confirm that indeed that the reason is just a typo in an assert.

Patch fixing that attached, it also includes a fix for a comment in a
related checks for historical snapshots.

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
>From 20da7e70cf5bc3c4dc943e71ec77f53ecc5f785a Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Wed, 5 Mar 2014 21:20:56 +0100
Subject: [PATCH] Fix typo in Assert() statement causing
 SetTransactionSnapshot() to fail.

Also fix comment that hasn't got the message about removing the need
for temporarily suspending historical snapshots.
---
 src/backend/utils/time/snapmgr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index 4146527..9802fa7 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -261,9 +261,11 @@ Snapshot
 GetCatalogSnapshot(Oid relid)
 {
 	/*
-	 * Return historic snapshot if we're doing logical decoding, but
-	 * return a non-historic, snapshot if we temporarily are doing up2date
-	 * lookups.
+	 * Return historic snapshot while we're doing logical decoding, so we can
+	 * see the appropriate state of the catalog.
+	 *
+	 * This is the primary reason for needing to reset the system caches after
+	 * finishing decoding.
 	 */
 	if (HistoricSnapshotActive())
 		return HistoricSnapshot;
@@ -352,7 +354,7 @@ SetTransactionSnapshot(Snapshot sourcesnap, TransactionId sourcexid)
 
 	Assert(RegisteredSnapshots == 0);
 	Assert(FirstXactSnapshot == NULL);
-	Assert(HistoricSnapshotActive());
+	Assert(!HistoricSnapshotActive());
 
 	/*
 	 * Even though we are not going to use the snapshot it computes, we must
-- 
1.8.3.251.g1462b67

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to