logical decoding - reading a user catalog table

From: Steve Singer <steve(at)ssinger(dot)info>
To: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: logical decoding - reading a user catalog table
Date: 2014-10-25 22:18:07
Message-ID: BLU437-SMTP3190FD005AE98D6F675B95DC900@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

My logical decoding plugin is occasionally getting this error

"could not resolve cmin/cmax of catalog tuple"

I get this when my output plugin is trying to read one of the user
defined catalog tables (user_catalog_table=true)

I am not sure if this is a bug in the time-travel support in the logical
decoding support of if I'm just using it wrong (ie not getting a
sufficient lock on the relation or something).

This is the interesting part of the stack trace

#4 0x000000000091bbc8 in HeapTupleSatisfiesHistoricMVCC
(htup=0x7fffcf42a900,
snapshot=0x7f786ffe92d8, buffer=10568) at tqual.c:1631
#5 0x00000000004aedf3 in heapgetpage (scan=0x28d7080, page=0) at
heapam.c:399
#6 0x00000000004b0182 in heapgettup_pagemode (scan=0x28d7080,
dir=ForwardScanDirection, nkeys=0, key=0x0) at heapam.c:747
#7 0x00000000004b1ba6 in heap_getnext (scan=0x28d7080,
direction=ForwardScanDirection) at heapam.c:1475
#8 0x00007f787002dbfb in lookupSlonyInfo (tableOid=91754, ctx=0x2826118,
origin_id=0x7fffcf42ab8c, table_id=0x7fffcf42ab88,
set_id=0x7fffcf42ab84)
at slony_logical.c:663
#9 0x00007f787002b7a3 in pg_decode_change (ctx=0x2826118, txn=0x28cbec0,
relation=0x7f787a3446a8, change=0x7f786ffe3268) at slony_logical.c:237
#10 0x00000000007497d4 in change_cb_wrapper (cache=0x28cbda8,
txn=0x28cbec0,
relation=0x7f787a3446a8, change=0x7f786ffe3268) at logical.c:704

Here is what the code in lookupSlonyInfo is doing
------------------

sltable_oid = get_relname_relid("sl_table",slony_namespace);

sltable_rel = relation_open(sltable_oid,AccessShareLock);
tupdesc=RelationGetDescr(sltable_rel);
scandesc=heap_beginscan(sltable_rel,
GetCatalogSnapshot(sltable_oid),0,NULL);
reloid_attnum = get_attnum(sltable_oid,"tab_reloid");

if(reloid_attnum == InvalidAttrNumber)
elog(ERROR,"sl_table does not have a tab_reloid column");
set_attnum = get_attnum(sltable_oid,"tab_set");

if(set_attnum == InvalidAttrNumber)
elog(ERROR,"sl_table does not have a tab_set column");
tableid_attnum = get_attnum(sltable_oid, "tab_id");

if(tableid_attnum == InvalidAttrNumber)
elog(ERROR,"sl_table does not have a tab_id column");

while( (tuple = heap_getnext(scandesc,ForwardScanDirection) ))

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-10-25 23:17:51 Re: Possible problem with shm_mq spin lock
Previous Message Steve Singer 2014-10-25 22:09:36 "snapshot too large" error when initializing logical replication (9.4)