On 2013-01-15 17:41:50 +1300, Mark Kirkwood wrote:
> On 15/01/13 17:37, Mark Kirkwood wrote:
> >On 15/01/13 14:38, Andres Freund wrote:
> >>Hi everyone,
> >>
> >>Here is the newest version of logical changeset generation.
> >>
> >>
> >
> >
> >
> >I'm quite interested in this feature - so tried applying the 19 patches to
> >the latest 9.3 checkout. Patch and compile are good.

Thanks! Any input welcome.

The git tree might make it easier to follow development ;)

> >However portals seem busted:
> >
> >bench=# BEGIN;
> >BEGIN
> >bench=# DECLARE c1 CURSOR FOR SELECT * FROM pgbench_accounts;
> >DECLARE CURSOR
> >bench=# FETCH 2 FROM c1;
> > aid | bid | abalance | filler
> >
> >-----+-----+----------+---------------------------------------------------------
> >
> >-----------------------------
> >   1 |   1 |        0 |
> >
> >   2 |   1 |        0 |
> >
> >(2 rows)
> >
> >bench=# DELETE FROM pgbench_accounts WHERE CURRENT OF c1;
> >The connection to the server was lost. Attempting reset: Failed.
> >
> 
> Sorry - forgot to add: assert and debug build, and it is an assertion
> failure that is being picked up:
> 
> TRAP: FailedAssertion("!(htup->t_tableOid != ((Oid) 0))", File: "tqual.c",
> Line: 940)

I unfortunately don't see the error here, I guess its related to how
stack is reused. But I think I found the error, check the attached patch
which I also pushed to the git repository.

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
>From 25bd9aeefb03ec39ff1d1cbbac4d2507d533f6d1 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Tue, 15 Jan 2013 11:50:33 +0100
Subject: [PATCH] wal_decoding: mergeme *Satisfies: Setup a correct
 tup->t_tableOid in heap_get_latest_tid

Code review found one other case where tableOid potentially didn'T get set, in
nodeBitmapHeapscan. Thats fixed as well.

Found independently by Mark Kirkwood and Abhijit Menon-Sen
---
 src/backend/access/heap/heapam.c          | 1 +
 src/backend/executor/nodeBitmapHeapscan.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 1ff58a4..3346c8a 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -1789,6 +1789,7 @@ heap_get_latest_tid(Relation relation,
 		tp.t_self = ctid;
 		tp.t_data = (HeapTupleHeader) PageGetItem(page, lp);
 		tp.t_len = ItemIdGetLength(lp);
+		tp.t_tableOid = RelationGetRelid(relation);
 
 		/*
 		 * After following a t_ctid link, we might arrive at an unrelated
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index c83f972..eda1394 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -258,6 +258,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
 
 		scan->rs_ctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
 		scan->rs_ctup.t_len = ItemIdGetLength(lp);
+		scan->rs_ctup.t_tableOid = scan->rs_rd->rd_id;
 		ItemPointerSet(&scan->rs_ctup.t_self, tbmres->blockno, targoffset);
 
 		pgstat_count_heap_fetch(scan->rs_rd);
-- 
1.7.12.289.g0ce9864.dirty

-- 
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