pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15114: logical decoding Segmentation fault
30+ messages / 9 participants
[nested] [flat]

Commits from this thread:
  2019-01-30 dfa774ff9a cf25498f71 2bac1d8c98 650296f8f6 edd8278c54 452253eae9  Fix a crash in logical replication
* BUG #15114: logical decoding Segmentation fault
@ 2018-03-15 09:24  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 30+ messages in thread

From: PG Bug reporting form @ 2018-03-15 09:24 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: pet.slavov@gmail.com

The following bug has been logged on the website:

Bug reference:      15114
Logged by:          Peter Slavov
Email address:      pet.slavov@gmail.com
PostgreSQL version: 10.3
Operating system:   Ubuntu xenial
Description:        

Hi,
I have a Segmentation fault problem when trying to start logical decoding on
the latest Postgres version - 10.3 (package version 10.3-1.pgdg16.04+1).
Here is what happens:

--- Query on master db server ---
create publication big_tables FOR TABLE table1, table2, table3, table4;

--- Query on the logical replica db server
create subscription sub_name CONNECTION 'host=master.server dbname=db_name
user=db_user password=db_password' PUBLICATION big_tables ;

--- Code dump: ---
------------------
Reading symbols from /usr/lib/postgresql/10/bin/postgres...Reading symbols
from
/usr/lib/debug/.build-id/a3/2aff963eb198ec48d1946523ef49379fa49c5e.debug...done.
done.
[New LWP 26112]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by 'postgres: 10/main: wal sender process lg_replica
ip-10-4-1-11.eu-west-1.compute'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  GetActiveSnapshot () at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843
843	/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:
No such file or directory.
(gdb)

--- Logs ---
------------
# Master db server:
2018-03-14 23:30:35 UTC [23352]: [7-1] user=,db= host=,app=[] LOG:  server
process (PID 26112) was terminated by signal 11: Segmentation fault
2018-03-14 23:30:35 UTC [23352]: [8-1] user=,db= host=,app=[] LOG: 
terminating any other active server processes

# logical Replica db server:
2018-03-14 23:29:22 UTC [6777]: [3-1] user=postgres,db=db_replica_name
host=[local],app=[psql] LOG:  duration: 73.901 ms  statement: create
subscription sub_name CONNECTION 'host=master.server dbname=db_name
user=db_user password=db_password' PUBLICATION big_tables ;
2018-03-14 23:29:22 UTC [6779]: [1-1] user=,db= host=,app=[] LOG:  logical
replication apply worker for subscription "sub_name" has started
2018-03-14 23:29:22 UTC [6780]: [1-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table1" has started
2018-03-14 23:29:22 UTC [6781]: [1-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table2" has started
2018-03-14 23:29:23 UTC [6780]: [2-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table1" has finished
2018-03-14 23:29:23 UTC [6782]: [1-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table3" has started
2018-03-14 23:29:24 UTC [6781]: [2-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table2" has finished
2018-03-14 23:29:24 UTC [6783]: [1-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table4" has started
2018-03-14 23:29:26 UTC [6783]: [2-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table4" has finished
2018-03-14 23:29:26 UTC [6782]: [2-1] user=,db= host=,app=[] LOG:  logical
replication table synchronization worker for subscription "sub_name", table
"table3" has finished
2018-03-14 23:30:35 UTC [6779]: [2-1] user=,db= host=,app=[] ERROR:  could
not receive data from WAL stream: SSL SYSCALL error: EOF detected
2018-03-14 23:30:35 UTC [6739]: [7-1] user=,db= host=,app=[] LOG:  worker
process: logical replication worker for subscription 17178 (PID 6779) exited
with exit code 1
2018-03-14 23:30:35 UTC [6798]: [1-1] user=,db= host=,app=[] LOG:  logical
replication apply worker for subscription "sub_name" has started
2018-03-14 23:30:35 UTC [6798]: [2-1] user=,db= host=,app=[] ERROR:  could
not connect to the publisher: FATAL:  the database system is in recovery
mode


--- Configurations ---
----------------------
Default debian postgresql.conf with this changes:

listen_addresses = '*'

max_connections = 500

shared_buffers = 1GB
work_mem = 4MB
maintenance_work_mem = 128MB
effective_cache_size = 4GB
effective_io_concurrency = 5

wal_level = logical
max_wal_senders = 10
max_replication_slots = 10
max_worker_processes = 20
wal_log_hints = off
hot_standby = on

shared_preload_libraries = 'pg_stat_statements'

tcp_keepalives_idle = 300
tcp_keepalives_interval = 10
tcp_keepalives_count = 6

log_min_duration_statement = 5
log_lock_waits = on
log_checkpoints = on

log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
log_filename = '%A.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
log_rotation_size = 0
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d host=%h,app=[%a] '
log_timezone = 'UTC'
log_statement = 'none'
log_duration = off
log_min_duration_statement = 0
log_hostname = on
log_checkpoints = on
log_connections = on
log_disconnections = on

wal_compression = on

ssl_cert_file = '/etc/postgresql/ssl/database_public.crt'
ssl_key_file = '/etc/postgresql/ssl/database_private.key'


Does it sound familiar? what am I doing wrong ?





^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-15 14:56  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 30+ messages in thread

From: Alvaro Herrera @ 2018-03-15 14:56 UTC (permalink / raw)
  To: pet.slavov@gmail.com; pgsql-bugs@lists.postgresql.org

PG Bug reporting form wrote:

> --- Code dump: ---
> ------------------
> Reading symbols from /usr/lib/postgresql/10/bin/postgres...Reading symbols
> from
> /usr/lib/debug/.build-id/a3/2aff963eb198ec48d1946523ef49379fa49c5e.debug...done.
> done.
> [New LWP 26112]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by 'postgres: 10/main: wal sender process lg_replica
> ip-10-4-1-11.eu-west-1.compute'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  GetActiveSnapshot () at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843
> 843	/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:
> No such file or directory.
> (gdb)

Can you do a "bt" in that gdb and paste the output, please?



-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-15 22:55  Петър Славов <pet.slavov@gmail.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 2 replies; 30+ messages in thread

From: Петър Славов @ 2018-03-15 22:55 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-bugs@lists.postgresql.org

Here is the code dump with bt:

Reading symbols from /usr/lib/postgresql/10/bin/postgres...Reading symbols
from
/usr/lib/debug/.build-id/a3/2aff963eb198ec48d1946523ef49379fa49c5e.debug...done.
done.
[New LWP 26112]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `postgres: 10/main: wal sender process lg_replica
ip-10-4-1-11.eu-west-1.compute'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  GetActiveSnapshot () at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843
843
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:
No such file or directory.
(gdb) bt
#0  GetActiveSnapshot () at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843
#1  0x00005649b753e928 in postquel_start (fcache=0x5649b89b7968,
es=0x5649b89c1288) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/executor/functions.c:809
#2  fmgr_sql (fcinfo=0x5649b89b5c48) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/executor/functions.c:1150
#3  0x00005649b7530ae1 in ExecInterpExpr (state=0x5649b89b5b68,
econtext=0x5649b89b6468, isnull=<optimized out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/executor/execExprInterp.c:650
#4  0x00005649b75d9bc7 in ExecEvalExprSwitchContext (isNull=0x7fff8d0a8794
"", econtext=<optimized out>, state=0x5649b89b5b68) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/include/executor/executor.h:308
#5  evaluate_expr (expr=<optimized out>, result_type=result_type@entry=1114,
result_typmod=result_typmod@entry=-1,
result_collation=result_collation@entry=0) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:4739
#6  0x00005649b75dba31 in evaluate_function (context=0x7fff8d0a8b50,
func_tuple=0x7f76e7843548, funcvariadic=0 '\000', args=0x5649b89b2730,
input_collid=0, result_collid=0, result_typmod=-1, result_type=1114,
funcid=16506)
    at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:4296
#7  simplify_function (funcid=16506, result_type=1114, result_typmod=-1,
result_collid=result_collid@entry=0, input_collid=input_collid@entry=0,
args_p=args_p@entry=0x7fff8d0a8930, funcvariadic=0 '\000', process_args=1
'\001', allow_non_const=1 '\001', context=0x7fff8d0a8b50)
    at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:3936
#8  0x00005649b75dc449 in eval_const_expressions_mutator
(node=0x5649b89b2530, context=0x7fff8d0a8b50) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2595
#9  0x00005649b757bc8b in expression_tree_mutator (node=<optimized out>,
mutator=mutator@entry=0x5649b75dc210 <eval_const_expressions_mutator>,
context=context@entry=0x7fff8d0a8b50) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/nodes/nodeFuncs.c:2903
#10 0x00005649b75dbfce in simplify_function (funcid=2057, result_type=16,
result_typmod=result_typmod@entry=-1, result_collid=0, input_collid=0,
args_p=args_p@entry=0x7fff8d0a8b00, funcvariadic=0 '\000', process_args=1
'\001', allow_non_const=1 '\001', context=0x7fff8d0a8b50)
    at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:3927
#11 0x00005649b75dc38b in eval_const_expressions_mutator
(node=node@entry=0x5649b89b0888,
context=context@entry=0x7fff8d0a8b50) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2643
#12 0x00005649b75ddabf in eval_const_expressions (root=root@entry=0x0,
node=node@entry=0x5649b89b0888) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2437
#13 0x00005649b777181a in RelationGetIndexPredicate
(relation=relation@entry=0x7f76e7841568)
at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4813
#14 0x00005649b7443d60 in BuildIndexInfo (index=index@entry=0x7f76e7841568)
at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/catalog/index.c:1660
#15 0x00005649b7771b90 in RelationGetIndexAttrBitmap
(relation=relation@entry=0x7f76e7836638,
attrKind=attrKind@entry=INDEX_ATTR_BITMAP_IDENTITY_KEY)
at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4938
#16 0x00005649b7614368 in logicalrep_write_attrs (rel=0x7f76e7836638,
out=0x5649b88dee38) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:530
#17 logicalrep_write_rel (out=0x5649b88dee38, rel=0x7f76e7836638) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:317
#18 0x00007f76998b5e6f in pgoutput_change (ctx=<optimized out>,
txn=<optimized out>, relation=0x7f76e7836638, change=0x5649b899b1f8) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/pgoutput/pgoutput.c:324
#19 0x00005649b760fbc9 in change_cb_wrapper (cache=<optimized out>,
txn=<optimized out>, relation=<optimized out>, change=<optimized out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/logical.c:711
#20 0x00005649b761844b in ReorderBufferCommit (rb=0x5649b89848a8,
xid=xid@entry=71743261, commit_lsn=commit_lsn@entry=463103922872,
end_lsn=end_lsn@entry=463103922928,
commit_time=commit_time@entry=574385433206439,
origin_id=origin_id@entry=0, origin_lsn=0)
    at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/reorderbuffer.c:1445
#21 0x00005649b760e012 in DecodeCommit (xid=71743261,
parsed=0x7fff8d0a91e0, buf=<synthetic pointer>, ctx=0x5649b88b0d48) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/decode.c:611
#22 DecodeXactOp (buf=<synthetic pointer>, ctx=0x5649b88b0d48) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/decode.c:241
#23 LogicalDecodingProcessRecord (ctx=0x5649b88b0d48, record=<optimized
out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/decode.c:113
#24 0x00005649b761ff19 in XLogSendLogical () at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/walsender.c:2781
#25 0x00005649b7621883 in WalSndLoop (send_data=send_data@entry=0x5649b761feb0
<XLogSendLogical>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/walsender.c:2149
#26 0x00005649b76224c3 in StartLogicalReplication (cmd=<optimized out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/walsender.c:1102
#27 exec_replication_command (cmd_string=cmd_string@entry=0x5649b8966768
"START_REPLICATION SLOT \"rbank_staging\" LOGICAL 0/0 (proto_version '1',
publication_names '\"big_tables\"')")
    at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/walsender.c:1539
#28 0x00005649b766ca72 in PostgresMain (argc=<optimized out>,
argv=argv@entry=0x5649b88d9990, dbname=0x5649b88d9838 "receiptbank",
username=<optimized out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/tcop/postgres.c:4084
#29 0x00005649b73a60d9 in BackendRun (port=0x5649b88d7000) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/postmaster/postmaster.c:4405
#30 BackendStartup (port=0x5649b88d7000) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/postmaster/postmaster.c:4077
#31 ServerLoop () at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/postmaster/postmaster.c:1755
#32 0x00005649b75fc78b in PostmasterMain (argc=5, argv=<optimized out>) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/postmaster/postmaster.c:1363
#33 0x00005649b73a74d5 in main (argc=5, argv=0x5649b8891850) at
/build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/main/main.c:228
(gdb)


2018-03-15 15:56 GMT+01:00 Alvaro Herrera <alvherre@alvh.no-ip.org>:

> PG Bug reporting form wrote:
>
> > --- Code dump: ---
> > ------------------
> > Reading symbols from /usr/lib/postgresql/10/bin/postgres...Reading
> symbols
> > from
> > /usr/lib/debug/.build-id/a3/2aff963eb198ec48d1946523ef4937
> 9fa49c5e.debug...done.
> > done.
> > [New LWP 26112]
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib/x86_64-linux-gnu/
> libthread_db.so.1".
> > Core was generated by 'postgres: 10/main: wal sender process lg_replica
> > ip-10-4-1-11.eu-west-1.compute'.
> > Program terminated with signal SIGSEGV, Segmentation fault.
> > #0  GetActiveSnapshot () at
> > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../
> src/backend/utils/time/snapmgr.c:843
> > 843   /build/postgresql-10-drhiey/postgresql-10-10.3/build/../
> src/backend/utils/time/snapmgr.c:
> > No such file or directory.
> > (gdb)
>
> Can you do a "bt" in that gdb and paste the output, please?
>
>
>
> --
> Álvaro Herrera                https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-16 00:15  Andres Freund <andres@anarazel.de>
  parent: Петър Славов <pet.slavov@gmail.com>
  1 sibling, 0 replies; 30+ messages in thread

From: Andres Freund @ 2018-03-16 00:15 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-bugs@lists.postgresql.org

Hi,

On 2018-03-15 23:55:32 +0100, Петър Славов wrote:
> Here is the code dump with bt:

Thanks, this is interesting.  Could you show the definition of the
tables involved in this?

For some reason I dont understand you appear to have managed to get a
predicated index used as the identity column.


> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2437
> #13 0x00005649b777181a in RelationGetIndexPredicate
> (relation=relation@entry=0x7f76e7841568)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4813
> #14 0x00005649b7443d60 in BuildIndexInfo (index=index@entry=0x7f76e7841568)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/catalog/index.c:1660
> #15 0x00005649b7771b90 in RelationGetIndexAttrBitmap
> (relation=relation@entry=0x7f76e7836638,
> attrKind=attrKind@entry=INDEX_ATTR_BITMAP_IDENTITY_KEY)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4938
> #16 0x00005649b7614368 in logicalrep_write_attrs (rel=0x7f76e7836638,
> out=0x5649b88dee38) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:530
> #17 logicalrep_write_rel (out=0x5649b88dee38, rel=0x7f76e7836638) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:317
> #18 0x00007f76998b5e6f in pgoutput_change (ctx=<optimized out>,
> txn=<optimized out>, relation=0x7f76e7836638, change=0x5649b899b1f8) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/pgoutput/pgoutput.c:324

We should never end up with an identity index that has a predicate. So
something's wrong here...

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 15:52  Andres Freund <andres@anarazel.de>
  parent: Петър Славов <pet.slavov@gmail.com>
  1 sibling, 2 replies; 30+ messages in thread

From: Andres Freund @ 2018-03-26 15:52 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; Petr Jelinek <petr@2ndquadrant.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-bugs@lists.postgresql.org

Hi,

On 2018-03-15 23:55:32 +0100, Петър Славов wrote:
> #0  GetActiveSnapshot () at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843
> #1  0x00005649b753e928 in postquel_start (fcache=0x5649b89b7968,
2
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2437
> #13 0x00005649b777181a in RelationGetIndexPredicate
> (relation=relation@entry=0x7f76e7841568)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4813
> #14 0x00005649b7443d60 in BuildIndexInfo (index=index@entry=0x7f76e7841568)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/catalog/index.c:1660
> #15 0x00005649b7771b90 in RelationGetIndexAttrBitmap
> (relation=relation@entry=0x7f76e7836638,
> attrKind=attrKind@entry=INDEX_ATTR_BITMAP_IDENTITY_KEY)
> at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4938
> #16 0x00005649b7614368 in logicalrep_write_attrs (rel=0x7f76e7836638,
> out=0x5649b88dee38) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:530
> #17 logicalrep_write_rel (out=0x5649b88dee38, rel=0x7f76e7836638) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:317
> #18 0x00007f76998b5e6f in pgoutput_change (ctx=<optimized out>,
> txn=<optimized out>, relation=0x7f76e7836638, change=0x5649b899b1f8) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/pgoutput/pgoutput.c:324
> #19 0x00005649b760fbc9 in change_cb_wrapper (cache=<optimized out>,
> txn=<optimized out>, relation=<optimized out>, change=<optimized out>) at
> /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/logical.c:711

Alvaro, Petr: If I understand correctly what happens here is that some
*other* column than the replica identity has a predicate with a full
blown SQL function.  We shouldn't evaluate arbitrary code like that
inside the otuput plugin!

So RelationGetIndexAttrBitmap() builds a bitmap of *all* indexed
columns. Besides the code exec problem above, this is also just
inefficient.  I think this needs to be replaced by some replident
bespoke code?

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 16:08  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Andres Freund <andres@anarazel.de>
  1 sibling, 2 replies; 30+ messages in thread

From: Alvaro Herrera @ 2018-03-26 16:08 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Петър Славов <pet.slavov@gmail.com>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Andres Freund wrote:

> Alvaro, Petr: If I understand correctly what happens here is that some
> *other* column than the replica identity has a predicate with a full
> blown SQL function.  We shouldn't evaluate arbitrary code like that
> inside the otuput plugin!
> 
> So RelationGetIndexAttrBitmap() builds a bitmap of *all* indexed
> columns. Besides the code exec problem above, this is also just
> inefficient.  I think this needs to be replaced by some replident
> bespoke code?

I agree -- I think logicalrep_write_attrs() should not use
RelationGetIndexAttrBitmap at all but instead use some lower-level way
to obtain columns of the replica identity.  I don't know whether there
are historical-snapshot-related considerations to care about, in this
code, though.

This is neither my area nor my code, but if Petr and Peter decline
producing a patch for this quickly, I can look at it in a few days.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 16:19  Andres Freund <andres@anarazel.de>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 0 replies; 30+ messages in thread

From: Andres Freund @ 2018-03-26 16:19 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Петър Славов <pet.slavov@gmail.com>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi,

On 2018-03-26 13:08:01 -0300, Alvaro Herrera wrote:
> I agree -- I think logicalrep_write_attrs() should not use
> RelationGetIndexAttrBitmap at all but instead use some lower-level way
> to obtain columns of the replica identity.

Indeed.


> I don't know whether there are historical-snapshot-related
> considerations to care about, in this code, though.

There shouldn't be much of an issue if all that's accessed is system
tables/cols.


> This is neither my area nor my code, but if Petr and Peter decline
> producing a patch for this quickly, I can look at it in a few days.

Cool!

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 20:59  Петър Славов <pet.slavov@gmail.com>
  parent: Andres Freund <andres@anarazel.de>
  1 sibling, 2 replies; 30+ messages in thread

From: Петър Славов @ 2018-03-26 20:59 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Petr Jelinek <petr@2ndquadrant.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-bugs@lists.postgresql.org

Hi Andres,

Alvaro, Petr: If I understand correctly what happens here is that some
> *other* column than the replica identity has a predicate with a full
> blown SQL function.  We shouldn't evaluate arbitrary code like that
> inside the otuput plugin!
>

Not sure what you mean here, but in my case the replica identity is a
regular integer primary key, without any functions as predicates in the
index or anything else.

... or my schema is not the problem at all in this case ?

Peter Slavov

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 21:04  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Петър Славов <pet.slavov@gmail.com>
  1 sibling, 0 replies; 30+ messages in thread

From: Alvaro Herrera @ 2018-03-26 21:04 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; +Cc: Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org

Петър Славов wrote:
> Hi Andres,
> 
> > Alvaro, Petr: If I understand correctly what happens here is that some
> > *other* column than the replica identity has a predicate with a full
> > blown SQL function.  We shouldn't evaluate arbitrary code like that
> > inside the otuput plugin!
> 
> Not sure what you mean here, but in my case the replica identity is a
> regular integer primary key, without any functions as predicates in the
> index or anything else.
> 
> ... or my schema is not the problem at all in this case ?

Andres is saying that you have some other index that contains a
predicate.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 21:06  Andres Freund <andres@anarazel.de>
  parent: Петър Славов <pet.slavov@gmail.com>
  1 sibling, 1 reply; 30+ messages in thread

From: Andres Freund @ 2018-03-26 21:06 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; +Cc: Petr Jelinek <petr@2ndquadrant.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-bugs@lists.postgresql.org

On 2018-03-26 22:59:12 +0200, Петър Славов wrote:
> Hi Andres,
> 
> Alvaro, Petr: If I understand correctly what happens here is that some
> > *other* column than the replica identity has a predicate with a full
> > blown SQL function.  We shouldn't evaluate arbitrary code like that
> > inside the otuput plugin!
> >
> 
> Not sure what you mean here, but in my case the replica identity is a
> regular integer primary key, without any functions as predicates in the
> index or anything else.

Turns out it it's not the replica identity index that's the problem,
it's *another* index with a WHERE clause that evaluates an SQL
function. That's a bug that needs to be fixed. But you might be able to
work around it for now by simplifying your WHERE clauses for the indexes
to not use SQL functions.

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-03-26 21:19  Петър Славов <pet.slavov@gmail.com>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 30+ messages in thread

From: Петър Славов @ 2018-03-26 21:19 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Petr Jelinek <petr@2ndquadrant.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-bugs@lists.postgresql.org

Hi,

Now I understand - I have partial index with this predicate - "WHERE
created_at > months_ago(2)",
where months_ago(int) is immutable function that returns current timestamp
minus the given number of months.

Just to confirm - removing this index on the testing server stopped this
Segmentation fault from happening.
Of course I will have to wait for a fix to be able to use logical decoding
in this case.

One more thing - I am almost curtain that the same thing have to be fixed
in pglogical extension ..

Peter Slavov

2018-03-26 23:06 GMT+02:00 Andres Freund <andres@anarazel.de>:

> On 2018-03-26 22:59:12 +0200, Петър Славов wrote:
> > Hi Andres,
> >
> > Alvaro, Petr: If I understand correctly what happens here is that some
> > > *other* column than the replica identity has a predicate with a full
> > > blown SQL function.  We shouldn't evaluate arbitrary code like that
> > > inside the otuput plugin!
> > >
> >
> > Not sure what you mean here, but in my case the replica identity is a
> > regular integer primary key, without any functions as predicates in the
> > index or anything else.
>
> Turns out it it's not the replica identity index that's the problem,
> it's *another* index with a WHERE clause that evaluates an SQL
> function. That's a bug that needs to be fixed. But you might be able to
> work around it for now by simplifying your WHERE clauses for the indexes
> to not use SQL functions.
>
> Greetings,
>
> Andres Freund
>

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-04-16 17:59  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 1 reply; 30+ messages in thread

From: Alvaro Herrera @ 2018-04-16 17:59 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Петър Славов <pet.slavov@gmail.com>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Alvaro Herrera wrote:

> I agree -- I think logicalrep_write_attrs() should not use
> RelationGetIndexAttrBitmap at all but instead use some lower-level way
> to obtain columns of the replica identity.  I don't know whether there
> are historical-snapshot-related considerations to care about, in this
> code, though.

Here's a patch.  There is a disadvantage: one additional syscache lookup
each time logicalrep_write_attrs() is called.  I think that's all right,
since that's done once for each relation being replicated (not, say,
once per tuple or once per transaction).  Even so, I tried to move this
code as a special "quick-path" case in RelationGetIndexAttrBitmap, so
that it could be cached separately without processing the other indexes.
That turned out a bit too messy for my taste.


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

proto.patch (text/plain, 1.8K) download diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index edc97a7662..06fa5c5647 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -582,8 +582,47 @@ logicalrep_write_attrs(StringInfo out, Relation rel) /* fetch bitmap of REPLICATION IDENTITY attributes */ replidentfull = (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL); if (!replidentfull) - idattrs = RelationGetIndexAttrBitmap(rel, - INDEX_ATTR_BITMAP_IDENTITY_KEY); + { + Oid idindex = rel->rd_replidindex; + + /* + * Building the index list determines the replica index OID as a side + * effect, so do so now unless we already have it. + */ + if (rel->rd_replidindex == InvalidOid) + { + list_free(RelationGetIndexList(rel)); + idindex = rel->rd_replidindex; + } + + /* + * Now build the bitmap. We cannot use RelationGetIndexAttrBitmap + * here: it would try to build IndexInfo for all the relation's + * indexes, which would be a problem, as the right authorization + * environment for that has not been set up yet (a problem + * particularly if there are any SQL-language functions.) + * + * It would be nice to cache this somewhere, but it's not clear how to + * invalidate it when the time comes. + */ + if (OidIsValid(idindex)) + { + HeapTuple tuple; + Form_pg_index index; + int natts; + + tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(idindex)); + if (!tuple) + elog(ERROR, "cache lookup failed for index %u", idindex); + index = (Form_pg_index) GETSTRUCT(tuple); + natts = index->indnkeyatts; + + for (i = 0; i < natts; i++) + idattrs = bms_add_member(idattrs, index->indkey.values[i] - + FirstLowInvalidHeapAttributeNumber); + ReleaseSysCache(tuple); + } + } /* send the attributes */ for (i = 0; i < desc->natts; i++)
^ permalink raw reply [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-04-26 22:26  Петър Славов <pet.slavov@gmail.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 30+ messages in thread

From: Петър Славов @ 2018-04-26 22:26 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi,

I tried to compile this and i had this error:

gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-O2 -I. -I../../../../src/include  -D_GNU_SOURCE   -c -o proto.o proto.c
proto.c: In function ‘logicalrep_write_attrs’:
proto.c:565:17: error: ‘FormData_pg_index {aka struct FormData_pg_index}’
has no member named ‘indnkeyatts’
    natts = index->indnkeyatts;
                 ^
<builtin>: recipe for target 'proto.o' failed
make[4]: *** [proto.o] Error 1
make[4]: Leaving directory
'/usr/src/postgresql-10.3/src/backend/replication/logical'
../../../src/backend/common.mk:41: recipe for target 'logical-recursive'
failed
make[3]: *** [logical-recursive] Error 2
make[3]: Leaving directory
'/usr/src/postgresql-10.3/src/backend/replication'
common.mk:41: recipe for target 'replication-recursive' failed
make[2]: *** [replication-recursive] Error 2
make[2]: Leaving directory '/usr/src/postgresql-10.3/src/backend'
Makefile:38: recipe for target 'all-backend-recurse' failed
make[1]: *** [all-backend-recurse] Error 2
make[1]: Leaving directory '/usr/src/postgresql-10.3/src'
GNUmakefile:11: recipe for target 'all-src-recurse' failed
make: *** [all-src-recurse] Error 2

-----
maybe - index->indnatts; ??

Peter Slavov

2018-04-16 19:59 GMT+02:00 Alvaro Herrera <alvherre@alvh.no-ip.org>:

> Alvaro Herrera wrote:
>
> > I agree -- I think logicalrep_write_attrs() should not use
> > RelationGetIndexAttrBitmap at all but instead use some lower-level way
> > to obtain columns of the replica identity.  I don't know whether there
> > are historical-snapshot-related considerations to care about, in this
> > code, though.
>
> Here's a patch.  There is a disadvantage: one additional syscache lookup
> each time logicalrep_write_attrs() is called.  I think that's all right,
> since that's done once for each relation being replicated (not, say,
> once per tuple or once per transaction).  Even so, I tried to move this
> code as a special "quick-path" case in RelationGetIndexAttrBitmap, so
> that it could be cached separately without processing the other indexes.
> That turned out a bit too messy for my taste.
>
>
> --
> Álvaro Herrera                https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-04-27 01:22  Michael Paquier <michael@paquier.xyz>
  parent: Петър Славов <pet.slavov@gmail.com>
  0 siblings, 1 reply; 30+ messages in thread

From: Michael Paquier @ 2018-04-27 01:22 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Fri, Apr 27, 2018 at 12:26:52AM +0200, Петър Славов wrote:
> I tried to compile this and i had this error:
> 
> proto.c: In function ‘logicalrep_write_attrs’:
> proto.c:565:17: error: ‘FormData_pg_index {aka struct FormData_pg_index}’
> has no member named ‘indnkeyatts’
>     natts = index->indnkeyatts;

The patch Alvaro has sent is made for the master branch, and you are
visibly using a build of REL_10_STABLE.  Ths conflict you are seeing
comes from 8224de4 which introduced Covering indexes, and renamed
indnatts to indnkeyatts in Form_pg_index.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-04 08:03  Петър Славов <pet.slavov@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 30+ messages in thread

From: Петър Славов @ 2018-10-04 08:03 UTC (permalink / raw)
  To: michael@paquier.xyz; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi,
What happen here - I cannot see fix for this bug.
I also cannot see the workaround parch in the code.
Do I have to do something to mo e this fix forward?

I think we agreed that this bug braked logical decoding or I am wrong ?

Peter Slavov

На пт, 27.04.2018 г. в 3:22 ч. Michael Paquier <michael@paquier.xyz> написа:

> On Fri, Apr 27, 2018 at 12:26:52AM +0200, Петър Славов wrote:
> > I tried to compile this and i had this error:
> >
> > proto.c: In function ‘logicalrep_write_attrs’:
> > proto.c:565:17: error: ‘FormData_pg_index {aka struct FormData_pg_index}’
> > has no member named ‘indnkeyatts’
> >     natts = index->indnkeyatts;
>
> The patch Alvaro has sent is made for the master branch, and you are
> visibly using a build of REL_10_STABLE.  Ths conflict you are seeing
> comes from 8224de4 which introduced Covering indexes, and renamed
> indnatts to indnkeyatts in Form_pg_index.
> --
> Michael
>

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-28 22:59  Petr Jelinek <petr.jelinek@2ndquadrant.com>
  parent: Петър Славов <pet.slavov@gmail.com>
  0 siblings, 1 reply; 30+ messages in thread

From: Petr Jelinek @ 2018-10-28 22:59 UTC (permalink / raw)
  To: Петър Славов <pet.slavov@gmail.com>; michael@paquier.xyz; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi,

This thread was brought to my attention during pgconf.eu (as I sadly
missed it).

On 04/10/2018 10:03, Петър Славов wrote:
> Hi,
> What happen here - I cannot see fix for this bug.
> I also cannot see the workaround parch in the code.
> Do I have to do something to mo e this fix forward?
> 
> I think we agreed that this bug braked logical decoding or I am wrong ?
>

Yes it's definitely a bug.

Also please note that we bottom-post in PostgreSQL mailing lists.

> 
> На пт, 27.04.2018 г. в 3:22 ч. Michael Paquier <michael@paquier.xyz
> <mailto:michael@paquier.xyz>> написа:
> 
>     On Fri, Apr 27, 2018 at 12:26:52AM +0200, Петър Славов wrote:
>     > I tried to compile this and i had this error:
>     >
>     > proto.c: In function ‘logicalrep_write_attrs’:
>     > proto.c:565:17: error: ‘FormData_pg_index {aka struct
>     FormData_pg_index}’
>     > has no member named ‘indnkeyatts’
>     >     natts = index->indnkeyatts;
> 
>     The patch Alvaro has sent is made for the master branch, and you are
>     visibly using a build of REL_10_STABLE.  Ths conflict you are seeing
>     comes from 8224de4 which introduced Covering indexes, and renamed
>     indnatts to indnkeyatts in Form_pg_index.
>     --
>     Michael
> 

I wrote my own patch to solve this which is quite similar to Alvaro's
except that it does not do the manual work to build indexes list as we
already have RelationGetReplicaIndex which does all the necessary work
and also uses the same rd_idattr for cache that
RelationGetIndexAttrBitmap does, it's better for performance and looks
safe to me.

I attached both patch for PG11+ (ie master) and the backport patch for
PG10, they only differ in the line identified above as problematic.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services

Attachments: download all (2 files, .tar.gz)

pg10-0001-Fix-REPLICA-IDENTITY-handling-in-logical-replication.patch (text/x-patch, 3.5K) download From c235ea36218bf3466397a713dc5e93112349024a Mon Sep 17 00:00:00 2001 From: Petr Jelinek <pjmodos@pjmodos.net> Date: Sun, 28 Oct 2018 23:22:42 +0100 Subject: [PATCH] Fix REPLICA IDENTITY handling in logical replication protocol We need column bitmap of replica identity so that we can send the correct key to the downstream. We used to build all the index information for this purpose but hat has two flaws: - The logical decoding does not have proper snapshot for building index info for functional indexes. - It's also not very efficient to build info we will never need This commit solves both of those by introducing special purpose function which only builds index info and hence the bitmap for REPLICA IDENTITY index. --- src/backend/replication/logical/proto.c | 58 ++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index 94dfee0b24..54855844f6 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -18,6 +18,7 @@ #include "libpq/pqformat.h" #include "replication/logicalproto.h" #include "utils/builtins.h" +#include "utils/catcache.h" #include "utils/lsyscache.h" #include "utils/syscache.h" @@ -501,6 +502,60 @@ logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple) } } +/* + * Get a bitmap of identity index attribute numbers. + * + * We cannot use RelationGetIndexAttrBitmap in output plugin because it would + * try to build IndexInfo for all the relation's indexes, which would be a + * problem, as the right authorization environment for that has not been set + * up (a problem particularly if there are any SQL-language functions.) + */ +static Bitmapset * +get_rel_idattrs(Relation relation) +{ + Bitmapset *idattrs = NULL; + Oid idindex = RelationGetReplicaIndex(relation); + int i; + + /* If we already have the bitmap, just return it. */ + if (relation->rd_idattr != NULL) + return bms_copy(relation->rd_idattr); + + /* Otherwise build it from the identity index if there is one. */ + if (OidIsValid(idindex)) + { + HeapTuple tuple; + Form_pg_index index; + int natts; + MemoryContext oldcxt; + + tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(idindex)); + if (!tuple) + elog(ERROR, "cache lookup failed for index %u", idindex); + index = (Form_pg_index) GETSTRUCT(tuple); + natts = index->indnatts; + + for (i = 0; i < natts; i++) + idattrs = bms_add_member(idattrs, index->indkey.values[i] - + FirstLowInvalidHeapAttributeNumber); + ReleaseSysCache(tuple); + + /* + * Save copy of the bitmap in the relcache entry. + * Note this will not make the relcache index info valid for + * RelationGetIndexAttrBitmap, but that does not matter as we don't + * mind if it rebuilds it - it should not anyway as this is supposed + * to be only called in output plugin where + * RelationGetIndexAttrBitmap does not work. + */ + oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + relation->rd_idattr = bms_copy(idattrs); + MemoryContextSwitchTo(oldcxt); + } + + return idattrs; +} + /* * Write relation attributes to the stream. */ @@ -527,8 +582,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel) /* fetch bitmap of REPLICATION IDENTITY attributes */ replidentfull = (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL); if (!replidentfull) - idattrs = RelationGetIndexAttrBitmap(rel, - INDEX_ATTR_BITMAP_IDENTITY_KEY); + idattrs = get_rel_idattrs(rel); /* send the attributes */ for (i = 0; i < desc->natts; i++) -- 2.17.1
pg11-0001-Fix-REPLICA-IDENTITY-handling-in-logical-replication.patch (text/x-patch, 3.5K) download From d150377286c0e6aa61361586133d6f9e00d86c92 Mon Sep 17 00:00:00 2001 From: Petr Jelinek <pjmodos@pjmodos.net> Date: Sun, 28 Oct 2018 23:22:42 +0100 Subject: [PATCH] Fix REPLICA IDENTITY handling in logical replication protocol We need column bitmap of replica identity so that we can send the correct key to the downstream. We used to build all the index information for this purpose but hat has two flaws: - The logical decoding does not have proper snapshot for building index info for functional indexes. - It's also not very efficient to build info we will never need This commit solves both of those by introducing special purpose function which only builds index info and hence the bitmap for REPLICA IDENTITY index. --- src/backend/replication/logical/proto.c | 58 ++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index 19451714da..d7d0fe0407 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -18,6 +18,7 @@ #include "libpq/pqformat.h" #include "replication/logicalproto.h" #include "utils/builtins.h" +#include "utils/catcache.h" #include "utils/lsyscache.h" #include "utils/syscache.h" @@ -556,6 +557,60 @@ logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple) } } +/* + * Get a bitmap of identity index attribute numbers. + * + * We cannot use RelationGetIndexAttrBitmap in output plugin because it would + * try to build IndexInfo for all the relation's indexes, which would be a + * problem, as the right authorization environment for that has not been set + * up (a problem particularly if there are any SQL-language functions.) + */ +static Bitmapset * +get_rel_idattrs(Relation relation) +{ + Bitmapset *idattrs = NULL; + Oid idindex = RelationGetReplicaIndex(relation); + int i; + + /* If we already have the bitmap, just return it. */ + if (relation->rd_idattr != NULL) + return bms_copy(relation->rd_idattr); + + /* Otherwise build it from the identity index if there is one. */ + if (OidIsValid(idindex)) + { + HeapTuple tuple; + Form_pg_index index; + int natts; + MemoryContext oldcxt; + + tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(idindex)); + if (!tuple) + elog(ERROR, "cache lookup failed for index %u", idindex); + index = (Form_pg_index) GETSTRUCT(tuple); + natts = index->indnkeyatts; + + for (i = 0; i < natts; i++) + idattrs = bms_add_member(idattrs, index->indkey.values[i] - + FirstLowInvalidHeapAttributeNumber); + ReleaseSysCache(tuple); + + /* + * Save copy of the bitmap in the relcache entry. + * Note this will not make the relcache index info valid for + * RelationGetIndexAttrBitmap, but that does not matter as we don't + * mind if it rebuilds it - it should not anyway as this is supposed + * to be only called in output plugin where + * RelationGetIndexAttrBitmap does not work. + */ + oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + relation->rd_idattr = bms_copy(idattrs); + MemoryContextSwitchTo(oldcxt); + } + + return idattrs; +} + /* * Write relation attributes to the stream. */ @@ -582,8 +637,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel) /* fetch bitmap of REPLICATION IDENTITY attributes */ replidentfull = (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL); if (!replidentfull) - idattrs = RelationGetIndexAttrBitmap(rel, - INDEX_ATTR_BITMAP_IDENTITY_KEY); + idattrs = get_rel_idattrs(rel); /* send the attributes */ for (i = 0; i < desc->natts; i++) -- 2.17.1
^ permalink raw reply [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-29 01:54  Michael Paquier <michael@paquier.xyz>
  parent: Petr Jelinek <petr.jelinek@2ndquadrant.com>
  0 siblings, 2 replies; 30+ messages in thread

From: Michael Paquier @ 2018-10-29 01:54 UTC (permalink / raw)
  To: Petr Jelinek <petr.jelinek@2ndquadrant.com>; +Cc: Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Sun, Oct 28, 2018 at 11:59:49PM +0100, Petr Jelinek wrote:
> I wrote my own patch to solve this which is quite similar to Alvaro's
> except that it does not do the manual work to build indexes list as we
> already have RelationGetReplicaIndex which does all the necessary work
> and also uses the same rd_idattr for cache that
> RelationGetIndexAttrBitmap does, it's better for performance and looks
> safe to me.
> 
> I attached both patch for PG11+ (ie master) and the backport patch for
> PG10, they only differ in the line identified above as problematic.

Hmm.  I am studying this patch, and this visibly cannot be easily
reproduced?  I would have imagined that something like this would be
enough, with a predicate index on the publisher side which is in charge
of loading the :
-- connect to publisher
\c postgres postgres /tmp 5432
create table aa (a int not null, b int);
create function copy_int(a int) returns int as $$ select $1 $$
  language sql immutable;
create index aai on aa (b) where copy_int(b) > 0;
create unique index aai2 on aa (a);
alter table aa replica identity using index aai2;
create publication big_tables for table aa;
insert into aa values (generate_series(1,100), 1);

-- connect to subscriber
\c postgres postgres /tmp 5433
create table aa (a int not null, b int);
create function copy_int(a int) returns int as $$ select $1 $$
  language sql immutable;
create index aai on aa (b) where copy_int(b) > 0;
create unique index aai2 on aa (a);
alter table aa replica identity using index aai2;
create subscription sub_name CONNECTION 'host=/tmp dbname=postgres
user=postgres' PUBLICATION big_tables;

Is there something I am missing?

If possible, could it be possible to add a test case in
001_rep_changes.pl with a more complete schema? 
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-29 08:44  Петър Славов <pet.slavov@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  1 sibling, 0 replies; 30+ messages in thread

From: Петър Славов @ 2018-10-29 08:44 UTC (permalink / raw)
  To: michael@paquier.xyz; +Cc: petr.jelinek@2ndquadrant.com, Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi Michael,

My latest tests was with immutable function with a now() function inside,
which is a little different. Here is the schema that replicates the problem:

on Producer:
CREATE FUNCTION public.months_ago(integer) RETURNS timestamp without time
zone

  LANGUAGE sql IMMUTABLE
  AS $_$
    SELECT (NOW() - '1 month'::interval * $1)::timestamp;
$_$;

CREATE TABLE public.replicated_table (
    id serial PRIMARY KEY NOT NULL,
    a text,
    b bigint,
    created_at timestamp without time zone DEFAULT now()
);

CREATE INDEX ON public.replicated_table (a) WHERE (created_at >
public.months_ago(4));

on Subscriber:
CREATE TABLE public.replicated_table (
    id integer NOT NULL,
    a text,
    b bigint,
    created_at timestamp without time zone DEFAULT now()
);

Peter


На пн, 29.10.2018 г. в 2:54 ч. Michael Paquier <michael@paquier.xyz> написа:

> On Sun, Oct 28, 2018 at 11:59:49PM +0100, Petr Jelinek wrote:
> > I wrote my own patch to solve this which is quite similar to Alvaro's
> > except that it does not do the manual work to build indexes list as we
> > already have RelationGetReplicaIndex which does all the necessary work
> > and also uses the same rd_idattr for cache that
> > RelationGetIndexAttrBitmap does, it's better for performance and looks
> > safe to me.
> >
> > I attached both patch for PG11+ (ie master) and the backport patch for
> > PG10, they only differ in the line identified above as problematic.
>
> Hmm.  I am studying this patch, and this visibly cannot be easily
> reproduced?  I would have imagined that something like this would be
> enough, with a predicate index on the publisher side which is in charge
> of loading the :
> -- connect to publisher
> \c postgres postgres /tmp 5432
> create table aa (a int not null, b int);
> create function copy_int(a int) returns int as $$ select $1 $$
>   language sql immutable;
> create index aai on aa (b) where copy_int(b) > 0;
> create unique index aai2 on aa (a);
> alter table aa replica identity using index aai2;
> create publication big_tables for table aa;
> insert into aa values (generate_series(1,100), 1);
>
> -- connect to subscriber
> \c postgres postgres /tmp 5433
> create table aa (a int not null, b int);
> create function copy_int(a int) returns int as $$ select $1 $$
>   language sql immutable;
> create index aai on aa (b) where copy_int(b) > 0;
> create unique index aai2 on aa (a);
> alter table aa replica identity using index aai2;
> create subscription sub_name CONNECTION 'host=/tmp dbname=postgres
> user=postgres' PUBLICATION big_tables;
>
> Is there something I am missing?
>
> If possible, could it be possible to add a test case in
> 001_rep_changes.pl with a more complete schema?
> --
> Michael
>

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-29 15:03  Petr Jelinek <petr.jelinek@2ndquadrant.com>
  parent: Michael Paquier <michael@paquier.xyz>
  1 sibling, 1 reply; 30+ messages in thread

From: Petr Jelinek @ 2018-10-29 15:03 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Hi Michael,

On 29/10/2018 02:54, Michael Paquier wrote:
> On Sun, Oct 28, 2018 at 11:59:49PM +0100, Petr Jelinek wrote:
>> I wrote my own patch to solve this which is quite similar to Alvaro's
>> except that it does not do the manual work to build indexes list as we
>> already have RelationGetReplicaIndex which does all the necessary work
>> and also uses the same rd_idattr for cache that
>> RelationGetIndexAttrBitmap does, it's better for performance and looks
>> safe to me.
>>
>> I attached both patch for PG11+ (ie master) and the backport patch for
>> PG10, they only differ in the line identified above as problematic.
> 
> Hmm.  I am studying this patch, and this visibly cannot be easily
> reproduced?  I would have imagined that something like this would be
> enough, with a predicate index on the publisher side which is in charge
> of loading the :
> -- connect to publisher
> \c postgres postgres /tmp 5432
> create table aa (a int not null, b int);
> create function copy_int(a int) returns int as $$ select $1 $$
>   language sql immutable;
> create index aai on aa (b) where copy_int(b) > 0;
> create unique index aai2 on aa (a);
> alter table aa replica identity using index aai2;
> create publication big_tables for table aa;
> insert into aa values (generate_series(1,100), 1);
> 
> -- connect to subscriber
> \c postgres postgres /tmp 5433
> create table aa (a int not null, b int);
> create function copy_int(a int) returns int as $$ select $1 $$
>   language sql immutable;
> create index aai on aa (b) where copy_int(b) > 0;
> create unique index aai2 on aa (a);
> alter table aa replica identity using index aai2;
> create subscription sub_name CONNECTION 'host=/tmp dbname=postgres
> user=postgres' PUBLICATION big_tables;
> 
> Is there something I am missing?

It needs to be function that requires snapshot to be built, which yours
does not. This all happens because we try to inline the SQL functions
into expression so all the expression machinery for running the function
gets involved and if the function needs snapshot the snapshot will be
created (which is where the crash comes from).

The reason why it breaks for OP is that his IMMUTABLE function is not
actually IMMUTABLE, that's also why we don't see it reported much.

Given this I am not sure if we want to add test for this as it's
something one should not do because it has unpredictable side effects,
but if you think it will be useful anyway I can whip something out.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-30 06:28  Michael Paquier <michael@paquier.xyz>
  parent: Petr Jelinek <petr.jelinek@2ndquadrant.com>
  0 siblings, 1 reply; 30+ messages in thread

From: Michael Paquier @ 2018-10-30 06:28 UTC (permalink / raw)
  To: Petr Jelinek <petr.jelinek@2ndquadrant.com>; +Cc: Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Mon, Oct 29, 2018 at 04:03:31PM +0100, Petr Jelinek wrote:
> The reason why it breaks for OP is that his IMMUTABLE function is not
> actually IMMUTABLE, that's also why we don't see it reported much.

Thanks, Petr.  I have missed that part.  Now I can see the failure
easily.  Please note that on the receiver side you have the same
problem, RelationGetIndexAttrBitmap() is still being used in
logicalrep_rel_open() so that crashes the receiver:
#18 0x0000563cc278baa4 in RelationGetIndexPredicate
 (relation=0x7f9764cdc050) at relcache.c:4720
#19 0x0000563cc22ccdd6 in BuildIndexInfo (index=0x7f9764cdc050) at
 index.c:1789
#20 0x0000563cc278be4f in RelationGetIndexAttrBitmap
 (relation=0x7f9764de52e8, attrKind=INDEX_ATTR_BITMAP_IDENTITY_KEY) at
 relcache.c:4921
#21 0x0000563cc25a6b0c in logicalrep_rel_open (remoteid=16388,
 lockmode=3) at relation.c:313

> Given this I am not sure if we want to add test for this as it's
> something one should not do because it has unpredictable side effects,
> but if you think it will be useful anyway I can whip something out.

Hmm.  People should not do that but they can do it, so this thread is
telling is to be careful.  Adding new objects in the schema of the
publisher and the receiver would be also cheap.  A test like that is not
something we would see but I would suggest to stress the new routine on
both sides.  In the patch, something which makes me uncomfortable is
that get_rel_idattr() is a duplicate of the code paths taken by
RelationGetIndexAttrBitmap() when INDEX_ATTR_BITMAP_IDENTITY_KEY gets
used to fill in the relation cache.  In this case, wouldn't we want to
just fetch the replica index instead of the full index list?  What is
proposed here needs more thoughts I think.  Something that we could
consider on HEAD is to remove INDEX_ATTR_BITMAP_IDENTITY_KEY as it is
visibly unsafe.  rd_idattr is also an unsafe concept.

Putting a safeguard in RelationGetIndexAttrBitmap() so as it generates
an ERROR if called in an output plugin, or just assert would be nice,
however such a check would need to use MyReplicationSlot (I don't recall
something else), and the limitations could just be documented as well.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-30 07:45  Petr Jelinek <petr.jelinek@2ndquadrant.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 30+ messages in thread

From: Petr Jelinek @ 2018-10-30 07:45 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>



On 30/10/2018 07:28, Michael Paquier wrote:
> On Mon, Oct 29, 2018 at 04:03:31PM +0100, Petr Jelinek wrote:
>> The reason why it breaks for OP is that his IMMUTABLE function is not
>> actually IMMUTABLE, that's also why we don't see it reported much.
> 
> Thanks, Petr.  I have missed that part.  Now I can see the failure
> easily.  Please note that on the receiver side you have the same
> problem, RelationGetIndexAttrBitmap() is still being used in
> logicalrep_rel_open() so that crashes the receiver:
> #18 0x0000563cc278baa4 in RelationGetIndexPredicate
>  (relation=0x7f9764cdc050) at relcache.c:4720
> #19 0x0000563cc22ccdd6 in BuildIndexInfo (index=0x7f9764cdc050) at
>  index.c:1789
> #20 0x0000563cc278be4f in RelationGetIndexAttrBitmap
>  (relation=0x7f9764de52e8, attrKind=INDEX_ATTR_BITMAP_IDENTITY_KEY) at
>  relcache.c:4921
> #21 0x0000563cc25a6b0c in logicalrep_rel_open (remoteid=16388,
>  lockmode=3) at relation.c:313

The receiver side *should* actually use RelationGetIndexAttrBitmap, the
problem there seems to be rather than we setup snapshot few lines of
code too late in worker.c.

> 
>> Given this I am not sure if we want to add test for this as it's
>> something one should not do because it has unpredictable side effects,
>> but if you think it will be useful anyway I can whip something out.
> 
> Hmm.  People should not do that but they can do it, so this thread is
> telling is to be careful.  Adding new objects in the schema of the
> publisher and the receiver would be also cheap.  A test like that is not
> something we would see but I would suggest to stress the new routine on

Well, considering we don't test for this misuse of IMMUTABLE anywhere
else either, meh, but okay.

> both sides.  In the patch, something which makes me uncomfortable is
> that get_rel_idattr() is a duplicate of the code paths taken by
> RelationGetIndexAttrBitmap() when INDEX_ATTR_BITMAP_IDENTITY_KEY gets
> used to fill in the relation cache.  In this case, wouldn't we want to
> just fetch the replica index instead of the full index list?

I don't follow, we *do* only fetch replica index in the new function.

> What is
> proposed here needs more thoughts I think.  Something that we could
> consider on HEAD is to remove INDEX_ATTR_BITMAP_IDENTITY_KEY as it is
> visibly unsafe.  rd_idattr is also an unsafe concept.
> 

I don't agree, about that, INDEX_ATTR_BITMAP_IDENTITY_KEY is perfectly
safe when used correctly. Not sure what you mean regarding unsafety of
rd_idattr but I don't see why it should not be safe.

> Putting a safeguard in RelationGetIndexAttrBitmap() so as it generates
> an ERROR if called in an output plugin, or just assert would be nice,
> however such a check would need to use MyReplicationSlot (I don't recall
> something else), and the limitations could just be documented as well.
If we want to put additional Asserts it should be about having snapshot
not about output plugin IMHO.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-30 23:07  Michael Paquier <michael@paquier.xyz>
  parent: Petr Jelinek <petr.jelinek@2ndquadrant.com>
  0 siblings, 1 reply; 30+ messages in thread

From: Michael Paquier @ 2018-10-30 23:07 UTC (permalink / raw)
  To: Petr Jelinek <petr.jelinek@2ndquadrant.com>; +Cc: Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Tue, Oct 30, 2018 at 08:45:57AM +0100, Petr Jelinek wrote:
> The receiver side *should* actually use RelationGetIndexAttrBitmap, the
> problem there seems to be rather than we setup snapshot few lines of
> code too late in worker.c.

Does the worker need this much information though?  It just needs to
know about the replication index itself and its columns, not about all
the other indexes.  It may make sense to unify both code paths to behave
similarly.

>> both sides.  In the patch, something which makes me uncomfortable is
>> that get_rel_idattr() is a duplicate of the code paths taken by
>> RelationGetIndexAttrBitmap() when INDEX_ATTR_BITMAP_IDENTITY_KEY gets
>> used to fill in the relation cache.  In this case, wouldn't we want to
>> just fetch the replica index instead of the full index list?
> 
> I don't follow, we *do* only fetch replica index in the new function.

I am wondering if both things should be unified, or simply if we should
just remove completely the dependency on the cached Relation in
get_rel_idattr().  One function able to overwrite what the other does is
weird.

> If we want to put additional Asserts it should be about having snapshot
> not about output plugin IMHO.

That looks like a good idea to me in any case, and that's a good thing
for HEAD.  Something like Assert(ActiveSnapshotSet()) perhaps?  I have
not thought much about it to be honest.  Let's tackle that with a
HEAD-only, separate patch.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-30 23:09  Andres Freund <andres@anarazel.de>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 30+ messages in thread

From: Andres Freund @ 2018-10-30 23:09 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Petr Jelinek <petr.jelinek@2ndquadrant.com>; Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On 2018-10-31 08:07:36 +0900, Michael Paquier wrote:
> On Tue, Oct 30, 2018 at 08:45:57AM +0100, Petr Jelinek wrote:
> > The receiver side *should* actually use RelationGetIndexAttrBitmap, the
> > problem there seems to be rather than we setup snapshot few lines of
> > code too late in worker.c.
> 
> Does the worker need this much information though?  It just needs to
> know about the replication index itself and its columns, not about all
> the other indexes.  It may make sense to unify both code paths to behave
> similarly.

Replication needs to maintain the other indexes, and for that it needs
to evaluate predicates.  So I don't understand how you could say that it
doesn't need to know about other indexes?


Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-10-31 07:29  Michael Paquier <michael@paquier.xyz>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 30+ messages in thread

From: Michael Paquier @ 2018-10-31 07:29 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Petr Jelinek <petr.jelinek@2ndquadrant.com>; Петър Славов <pet.slavov@gmail.com>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Petr Jelinek <petr@2ndquadrant.com>; pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Tue, Oct 30, 2018 at 04:09:31PM -0700, Andres Freund wrote:
> Replication needs to maintain the other indexes, and for that it needs
> to evaluate predicates.  So I don't understand how you could say that
> it doesn't need to know about other indexes?

You are right, sorry for the noise.  The worker applies the changes so
it needs to know about all the indexes and its information.  So we need
to tackle three separate issues here then:
1) On the sender side, make sure that only the replica index information
is fetched.  I actually would prefer something like what Alvaro proposed
upthread, to not save the saved information into the cached Relation,
and potentially have RelationGetIndexAttrBitmap() overwrite it.
2) On the apply side, move the snapshot build a bit earlier so as the
index information can be built properly.
3) Make sure that RelationGetIndexAttrBitmap() never gets called if
there is no snapshot available.

1) and 2) are the actual bug fixes to back-patch.  3) is optionally
something for HEAD, which Petr proposed.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2018-11-19 09:49  Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 30+ messages in thread

From: Kyotaro HORIGUCHI @ 2018-11-19 09:49 UTC (permalink / raw)
  To: michael@paquier.xyz; +Cc: andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org; peter.eisentraut@2ndquadrant.com

At Wed, 31 Oct 2018 16:29:38 +0900, Michael Paquier <michael@paquier.xyz> wrote in <20181031072938.GC7862@paquier.xyz>
> On Tue, Oct 30, 2018 at 04:09:31PM -0700, Andres Freund wrote:
> > Replication needs to maintain the other indexes, and for that it needs
> > to evaluate predicates.  So I don't understand how you could say that
> > it doesn't need to know about other indexes?
> 
> You are right, sorry for the noise.  The worker applies the changes so
> it needs to know about all the indexes and its information.  So we need
> to tackle three separate issues here then:

> 1) On the sender side, make sure that only the replica index information
> is fetched.  I actually would prefer something like what Alvaro proposed
> upthread, to not save the saved information into the cached Relation,
> and potentially have RelationGetIndexAttrBitmap() overwrite it.

+1. We won't reuse it elsewhere, and we don't build other
bitmaps there.

> 2) On the apply side, move the snapshot build a bit earlier so as the
> index information can be built properly.

Subscriber crashes without it and fixed with it.

> 3) Make sure that RelationGetIndexAttrBitmap() never gets called if
> there is no snapshot available.

I'm not sure putting assertion into only the place is
reasonable. BuildIndexInfo has the same hazard and will catch the
similar cases widely.

> 1) and 2) are the actual bug fixes to back-patch.  3) is optionally
> something for HEAD, which Petr proposed.

Agreed.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center





^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2019-01-28 21:32  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
  0 siblings, 2 replies; 30+ messages in thread

From: Peter Eisentraut @ 2019-01-28 21:32 UTC (permalink / raw)
  To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>; michael@paquier.xyz; +Cc: andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org

I have another approach for this.

Recall that the issue is ultimately that RelationGetIndexAttrBitmap()
might need a snapshot under certain circumstances, and it will crash if
there isn't one.  There are actually two separate bugs, in the publisher
and in the subscriber.  Some patches have been proposed in this thread
that either bypass RelationGetIndexAttrBitmap() or obtain a snapshot at
different times in the publisher or subscriber code.

My approach is to make RelationGetIndexAttrBitmap() not need a snapshot.
 The whole code was overly complicated anyway, calling BuildIndexInfo()
and then throwing the result away.  We can do it directly more
efficiently and avoid all the business about eval_const_expressions().
Moreover, this fixes the problem in a central place and does not require
bespoke separate fixes in the publisher and subscriber code.  External
logical decoding or logical replication implementations could also be
affected and would benefit from this fix.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Fix-a-crash-in-logical-replication.patch (text/plain, 8.2K) download From fbdd6559ceea4bf860a2c4bab58d55827ba23ecb Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Mon, 28 Jan 2019 22:09:33 +0100 Subject: [PATCH] Fix a crash in logical replication The bug was that determining which columns are part of the replica identity index using RelationGetIndexAttrBitmap() would run eval_const_expressions() on index expressions and predicates across all indexes of the table, which in turn might require a snapshot, but there wasn't one set, so it crashes. There were actually two separate bugs, one on the publisher and one on the subscriber. To trigger the bug, a table that is part of a publication or subscription needs to have an index with a predicate or expression that lends itself to constant expressions simplification. The fix is to avoid the constant expressions simplification in RelationGetIndexAttrBitmap(), so that it becomes safe to call in these contexts. The constant expressions simplification comes from the calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling BuildIndexInfo() is overkill. The latter just takes pg_index catalog information, packs it into the IndexInfo structure, which former than just unpacks again and throws away. We can just do this directly with less overhead and skip the troublesome calls to eval_const_expressions(). This also removes the awkward cross-dependency between relcache.c and index.c. Bug: #15114 --- src/backend/utils/cache/relcache.c | 50 +++++++++++++++------- src/test/subscription/t/100_bugs.pl | 65 +++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 14 deletions(-) create mode 100644 src/test/subscription/t/100_bugs.pl diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index bcf4f104cf..12624a130c 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -41,7 +41,6 @@ #include "access/xact.h" #include "access/xlog.h" #include "catalog/catalog.h" -#include "catalog/index.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/partition.h" @@ -4717,7 +4716,10 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) { Oid indexOid = lfirst_oid(l); Relation indexDesc; - IndexInfo *indexInfo; + Datum datum; + bool isnull; + Node *indexExpressions; + Node *indexPredicate; int i; bool isKey; /* candidate key */ bool isPK; /* primary key */ @@ -4725,13 +4727,33 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) indexDesc = index_open(indexOid, AccessShareLock); - /* Extract index key information from the index's pg_index row */ - indexInfo = BuildIndexInfo(indexDesc); + /* + * Extract index expressions and index predicate. Note: Don't use + * RelationGetIndexExpressions()/RelationGetIndexPredicate(), because + * those might run constants evaluation, which needs a snapshot, which + * we might not have here. (Also, it's probably more sound to collect + * the bitmaps before any transformations that might eliminate + * columns, but the practical impact of this is limited.) + */ + + datum = heap_getattr(indexDesc->rd_indextuple, Anum_pg_index_indexprs, + GetPgIndexDescriptor(), &isnull); + if (!isnull) + indexExpressions = stringToNode(TextDatumGetCString(datum)); + else + indexExpressions = NULL; + + datum = heap_getattr(indexDesc->rd_indextuple, Anum_pg_index_indpred, + GetPgIndexDescriptor(), &isnull); + if (!isnull) + indexPredicate = stringToNode(TextDatumGetCString(datum)); + else + indexPredicate = NULL; /* Can this index be referenced by a foreign key? */ - isKey = indexInfo->ii_Unique && - indexInfo->ii_Expressions == NIL && - indexInfo->ii_Predicate == NIL; + isKey = indexDesc->rd_index->indisunique && + indexExpressions == NULL && + indexPredicate == NULL; /* Is this a primary key? */ isPK = (indexOid == relpkindex); @@ -4740,9 +4762,9 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) isIDKey = (indexOid == relreplindex); /* Collect simple attribute references */ - for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++) + for (i = 0; i < indexDesc->rd_index->indnatts; i++) { - int attrnum = indexInfo->ii_IndexAttrNumbers[i]; + int attrnum = indexDesc->rd_index->indkey.values[i]; /* * Since we have covering indexes with non-key columns, we must @@ -4757,25 +4779,25 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) indexattrs = bms_add_member(indexattrs, attrnum - FirstLowInvalidHeapAttributeNumber); - if (isKey && i < indexInfo->ii_NumIndexKeyAttrs) + if (isKey && i < indexDesc->rd_index->indnkeyatts) uindexattrs = bms_add_member(uindexattrs, attrnum - FirstLowInvalidHeapAttributeNumber); - if (isPK && i < indexInfo->ii_NumIndexKeyAttrs) + if (isPK && i < indexDesc->rd_index->indnkeyatts) pkindexattrs = bms_add_member(pkindexattrs, attrnum - FirstLowInvalidHeapAttributeNumber); - if (isIDKey && i < indexInfo->ii_NumIndexKeyAttrs) + if (isIDKey && i < indexDesc->rd_index->indnkeyatts) idindexattrs = bms_add_member(idindexattrs, attrnum - FirstLowInvalidHeapAttributeNumber); } } /* Collect all attributes used in expressions, too */ - pull_varattnos((Node *) indexInfo->ii_Expressions, 1, &indexattrs); + pull_varattnos(indexExpressions, 1, &indexattrs); /* Collect all attributes in the index predicate, too */ - pull_varattnos((Node *) indexInfo->ii_Predicate, 1, &indexattrs); + pull_varattnos(indexPredicate, 1, &indexattrs); index_close(indexDesc, AccessShareLock); } diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl new file mode 100644 index 0000000000..cbdb30a8bb --- /dev/null +++ b/src/test/subscription/t/100_bugs.pl @@ -0,0 +1,65 @@ +# Tests for various bugs found over time +use strict; +use warnings; +use PostgresNode; +use TestLib; +use Test::More tests => 1; + +# Bug #15114 + +# The bug was that determining which columns are part of the replica +# identity index using RelationGetIndexAttrBitmap() would run +# eval_const_expressions() on index expressions and predicates across +# all indexes of the table, which in turn might require a snapshot, +# but there wasn't one set, so it crashes. There were actually two +# separate bugs, one on the publisher and one on the subscriber. The +# fix was to avoid the constant expressions simplification in +# RelationGetIndexAttrBitmap(), so it's safe to call in more contexts. + +my $node_publisher = get_new_node('publisher'); +$node_publisher->init(allows_streaming => 'logical'); +$node_publisher->start; + +my $node_subscriber = get_new_node('subscriber'); +$node_subscriber->init(allows_streaming => 'logical'); +$node_subscriber->start; + +my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; + +$node_publisher->safe_psql('postgres', + "CREATE TABLE tab1 (a int PRIMARY KEY, b int)"); + +$node_publisher->safe_psql('postgres', + "CREATE FUNCTION double(x int) RETURNS int IMMUTABLE LANGUAGE SQL AS 'select x * 2'"); + +# an index with a predicate that lends itself to constant expressions +# evaluation +$node_publisher->safe_psql('postgres', + "CREATE INDEX ON tab1 (b) WHERE a > double(1)"); + +# and the same setup on the subscriber +$node_subscriber->safe_psql('postgres', + "CREATE TABLE tab1 (a int PRIMARY KEY, b int)"); + +$node_subscriber->safe_psql('postgres', + "CREATE FUNCTION double(x int) RETURNS int IMMUTABLE LANGUAGE SQL AS 'select x * 2'"); + +$node_subscriber->safe_psql('postgres', + "CREATE INDEX ON tab1 (b) WHERE a > double(1)"); + +$node_publisher->safe_psql('postgres', + "CREATE PUBLICATION pub1 FOR ALL TABLES"); + +$node_subscriber->safe_psql('postgres', + "CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr application_name=sub1' PUBLICATION pub1"); + +$node_publisher->wait_for_catchup('sub1'); + +# This would crash, first on the publisher, and then (if the publisher +# is fixed) on the subscriber. +$node_publisher->safe_psql('postgres', + "INSERT INTO tab1 VALUES (1, 2)"); + +$node_publisher->wait_for_catchup('sub1'); + +pass('index predicates do not cause crash'); -- 2.20.1
^ permalink raw reply [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2019-01-29 01:53  Noah Misch <noah@leadboat.com>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 0 replies; 30+ messages in thread

From: Noah Misch @ 2019-01-29 01:53 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>; michael@paquier.xyz; andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org

Looks good.  I found no functional problems.

On Mon, Jan 28, 2019 at 10:32:16PM +0100, Peter Eisentraut wrote:
> The fix is to avoid the constant expressions simplification in
> RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
> contexts.  The constant expressions simplification comes from the
> calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
> BuildIndexInfo().  But RelationGetIndexAttrBitmap() calling
> BuildIndexInfo() is overkill.  The latter just takes pg_index catalog
> information, packs it into the IndexInfo structure, which former than
> just unpacks again and throws away.

s/former than/the former then/




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2019-01-29 07:59  Michael Paquier <michael@paquier.xyz>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 1 reply; 30+ messages in thread

From: Michael Paquier @ 2019-01-29 07:59 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>; andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org

On Mon, Jan 28, 2019 at 10:32:16PM +0100, Peter Eisentraut wrote:
> My approach is to make RelationGetIndexAttrBitmap() not need a snapshot.
>  The whole code was overly complicated anyway, calling BuildIndexInfo()
> and then throwing the result away.  We can do it directly more
> efficiently and avoid all the business about eval_const_expressions().
> Moreover, this fixes the problem in a central place and does not require
> bespoke separate fixes in the publisher and subscriber code.  External
> logical decoding or logical replication implementations could also be
> affected and would benefit from this fix.

I have spent some time for the last couple of days looking at this
patch, and that's a neat approach.

+        * those might run constants evaluation, which needs a snapshot, which
"constants evaluation" sounds like weird English.  "constant
evaluation" or "evaluation of constants would be better"?

Thanks for adding a test case as well, Peter.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2019-01-30 11:22  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 30+ messages in thread

From: Peter Eisentraut @ 2019-01-30 11:22 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>; andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org

On 29/01/2019 08:59, Michael Paquier wrote:
> On Mon, Jan 28, 2019 at 10:32:16PM +0100, Peter Eisentraut wrote:
>> My approach is to make RelationGetIndexAttrBitmap() not need a snapshot.
>>  The whole code was overly complicated anyway, calling BuildIndexInfo()
>> and then throwing the result away.  We can do it directly more
>> efficiently and avoid all the business about eval_const_expressions().
>> Moreover, this fixes the problem in a central place and does not require
>> bespoke separate fixes in the publisher and subscriber code.  External
>> logical decoding or logical replication implementations could also be
>> affected and would benefit from this fix.
> 
> I have spent some time for the last couple of days looking at this
> patch, and that's a neat approach.
> 
> +        * those might run constants evaluation, which needs a snapshot, which
> "constants evaluation" sounds like weird English.  "constant
> evaluation" or "evaluation of constants would be better"?

Committed and backpatched with your and Noah's changes.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 30+ messages in thread

* Re: BUG #15114: logical decoding Segmentation fault
@ 2019-01-31 00:36  Michael Paquier <michael@paquier.xyz>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 30+ messages in thread

From: Michael Paquier @ 2019-01-31 00:36 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>; andres@anarazel.de; petr.jelinek@2ndquadrant.com; pet.slavov@gmail.com; alvherre@alvh.no-ip.org; petr@2ndquadrant.com; pgsql-bugs@lists.postgresql.org

On Wed, Jan 30, 2019 at 12:22:15PM +0100, Peter Eisentraut wrote:
> Committed and backpatched with your and Noah's changes.

Thanks, Peter.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 30+ messages in thread


end of thread, other threads:[~2019-01-31 00:36 UTC | newest]

Thread overview: 30+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 09:24 BUG #15114: logical decoding Segmentation fault PG Bug reporting form <noreply@postgresql.org>
2018-03-15 14:56 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-15 22:55   ` Петър Славов <pet.slavov@gmail.com>
2018-03-16 00:15     ` Andres Freund <andres@anarazel.de>
2018-03-26 15:52     ` Andres Freund <andres@anarazel.de>
2018-03-26 16:08       ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-26 16:19         ` Andres Freund <andres@anarazel.de>
2018-04-16 17:59         ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-04-26 22:26           ` Петър Славов <pet.slavov@gmail.com>
2018-04-27 01:22             ` Michael Paquier <michael@paquier.xyz>
2018-10-04 08:03               ` Петър Славов <pet.slavov@gmail.com>
2018-10-28 22:59                 ` Petr Jelinek <petr.jelinek@2ndquadrant.com>
2018-10-29 01:54                   ` Michael Paquier <michael@paquier.xyz>
2018-10-29 08:44                     ` Петър Славов <pet.slavov@gmail.com>
2018-10-29 15:03                     ` Petr Jelinek <petr.jelinek@2ndquadrant.com>
2018-10-30 06:28                       ` Michael Paquier <michael@paquier.xyz>
2018-10-30 07:45                         ` Petr Jelinek <petr.jelinek@2ndquadrant.com>
2018-10-30 23:07                           ` Michael Paquier <michael@paquier.xyz>
2018-10-30 23:09                             ` Andres Freund <andres@anarazel.de>
2018-10-31 07:29                               ` Michael Paquier <michael@paquier.xyz>
2018-11-19 09:49                                 ` Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
2019-01-28 21:32                                   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-01-29 01:53                                     ` Noah Misch <noah@leadboat.com>
2019-01-29 07:59                                     ` Michael Paquier <michael@paquier.xyz>
2019-01-30 11:22                                       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-01-31 00:36                                         ` Michael Paquier <michael@paquier.xyz>
2018-03-26 20:59       ` Петър Славов <pet.slavov@gmail.com>
2018-03-26 21:04         ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-26 21:06         ` Andres Freund <andres@anarazel.de>
2018-03-26 21:19           ` Петър Славов <pet.slavov@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox