Re: [HACKERS] Logical replication existing data copy - Mailing list pgsql-hackers

From Michael Banck
Subject Re: [HACKERS] Logical replication existing data copy
Date
Msg-id 20170323220645.GA17115@nighthawk.caipicrew.dd-dns.de
Whole thread Raw
In response to Re: [HACKERS] Logical replication existing data copy  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] Logical replication existing data copy  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
List pgsql-hackers
Hi,

On Thu, Mar 23, 2017 at 09:00:16AM -0400, Peter Eisentraut wrote:
> On 3/21/17 21:38, Peter Eisentraut wrote:
> > This patch is looking pretty good to me, modulo the failing pg_dump tests.
> > 
> > Attached is a fixup patch.  I have mainly updated some comments and
> > variable naming for (my) clarity.  No functional changes.
> 
> Committed all that.

Maybe I'm doing something wrong, but I'm getting a segfault trying to
start logical replication since that patch went in.

I've blown away my build tree and started over with this minimal
example, any obvious mistakes here?  Quoting the publisher/subscriber
names doesn't seem to change things:

$ initdb --pgdata=data_pg1
$ sed -i -e 's/^#wal_level.=.replica/wal_level = logical/' data_pg1/postgresql.conf
$ pg_ctl --pgdata=data_pg1 -l pg1.log start
$ pg_basebackup --pgdata=data_pg2
$ sed -i -e 's/^#port.=.5432/port = 5433/' data_pg2/postgresql.conf
$ pg_ctl --pgdata=data_pg2 -l pg2.log start
$ psql -c "CREATE PUBLICATION pub1;"
$ psql --port=5433 -c "CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=postgres' PUBLICATION pub1;"

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
ExecSetSlotDescriptor (slot=slot@entry=0xfc4d38, tupdesc=tupdesc@entry=0x0)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/executor/execTuples.c:269
269             PinTupleDesc(tupdesc);
(gdb) bt
#0  ExecSetSlotDescriptor (slot=slot@entry=0xfc4d38, tupdesc=tupdesc@entry=0x0)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/executor/execTuples.c:269
#1  0x00000000005dc4fc in MakeSingleTupleTableSlot (tupdesc=0x0)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/executor/execTuples.c:203
#2  0x00000000005a16ff in fetch_table_list (wrconn=wrconn@entry=0xc00300000001,
publications=publications@entry=0xffb448)  at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/commands/subscriptioncmds.c:996
#3  0x00000000005a1efa in CreateSubscription (stmt=0x101cd40, isTopLevel=<optimized out>)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/commands/subscriptioncmds.c:396
#4  0x00000000006ecf96 in ProcessUtilitySlow (pstate=0x0, pstate@entry=0xfc4818, pstmt=0x0,   pstmt@entry=0x101d080,
queryString=0xf9d248<incomplete sequence \340>,   queryString@entry=0x101c0b8 "CREATE SUBSCRIPTION \"sub1\" CONNECTION
'dbname=postgres'PUBLICATION pub1 WITH (COPY DATA);", context=(unknown: 16534992),
context@entry=PROCESS_UTILITY_TOPLEVEL,  params=0x7ffd7e6263d0, params@entry=0x0,   completionTag=0x45 <error: Cannot
accessmemory at address 0x45>,   completionTag@entry=0x7ffd7e626b00 "", dest=<optimized out>)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/utility.c:1612
#5  0x00000000006ec4e9 in standard_ProcessUtility (pstmt=0x101d080,   queryString=0x101c0b8 "CREATE SUBSCRIPTION
\"sub1\"CONNECTION 'dbname=postgres' PUBLICATION pub1 WITH (COPY DATA);", context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
dest=0x101d160,  completionTag=0x7ffd7e626b00 "")   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/utility.c:922
#6  0x00000000006e9f5f in PortalRunUtility (portal=0xfbb9d8, pstmt=0x101d080,   isTopLevel=<optimized out>,
setHoldSnapshot=<optimizedout>, dest=<optimized out>,   completionTag=0x7ffd7e626b00 "")   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/pquery.c:1165
#7  0x00000000006ea977 in PortalRunMulti (portal=portal@entry=0xfbb9d8,   isTopLevel=isTopLevel@entry=1 '\001',
setHoldSnapshot=setHoldSnapshot@entry=0'\000',   dest=dest@entry=0x101d160, altdest=altdest@entry=0x101d160,
completionTag=completionTag@entry=0x7ffd7e626b00"")   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/pquery.c:1315
#8  0x00000000006eb4cb in PortalRun (portal=portal@entry=0xfbb9d8,   count=count@entry=9223372036854775807,
isTopLevel=isTopLevel@entry=1'\001',   dest=dest@entry=0x101d160, altdest=altdest@entry=0x101d160,
completionTag=completionTag@entry=0x7ffd7e626b00"")   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/pquery.c:788
#9  0x00000000006e7868 in exec_simple_query (   query_string=0x101c0b8 "CREATE SUBSCRIPTION \"sub1\" CONNECTION
'dbname=postgres'PUBLICATION pub1 WITH (COPY DATA);")   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/postgres.c:1101
#10 0x00000000006e94a9 in PostgresMain (argc=1, argv=0x101c0b8, dbname=0xfc8478 "postgres",   username=0xfc8458
"postgres")  at /home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/tcop/postgres.c:4069
 
#11 0x00000000004770ad in BackendRun (port=0xfc2970)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/postmaster/postmaster.c:4317
#12 BackendStartup (port=0xfc2970)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/postmaster/postmaster.c:3989
#13 ServerLoop ()   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/postmaster/postmaster.c:1729
#14 0x000000000068819c in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0xf9c420)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/postmaster/postmaster.c:1337
#15 0x0000000000477f27 in main (argc=3, argv=0xf9c420)   at
/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/backend/main/main.c:228

The TAP tests in src/test/subscriber pass for me, going back to
707576b571f05ec5b89adb65964d55f3ccccbd1b also makes the above chain of
commands run fine.

Michael

-- 
Michael Banck
Projektleiter / Senior Berater
Tel.: +49 2166 9901-171
Fax:  +49 2166 9901-100
Email: michael.banck@credativ.de

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] [PATCH] few fts functions for jsonb
Next
From: Euler Taveira
Date:
Subject: Re: [HACKERS] createlang/droplang deprecated