[BUGS] pg_logical_slot_peek_changes crashes postgres when called from insidepl/pgsql

Поиск
Список
Период
Сортировка
От Ben Chobot
Тема [BUGS] pg_logical_slot_peek_changes crashes postgres when called from insidepl/pgsql
Дата
Msg-id 73FBA179-C68C-4540-9473-71E865408B15@silentmedia.com
обсуждение исходный текст
Ответы Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql
Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql
Список pgsql-bugs
I'm probably doing something dumb, but even something dumb at this high level probably shouldn't result in a crash. I've tried with multiple decoders and get the same result. I also have a stack trace from 9.5.5, if that helps: https://paste.depesz.com/s/Bu

postgres@c61-pg509:~$ psql
psql (9.5.9)
Type "help" for help.

postgres=# select version();
                                                version
--------------------------------------------------------------------------------------------------------
 PostgreSQL 9.5.9 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit
(1 row)

postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
    slot_name    | xlog_position
-----------------+---------------
 regression_slot | 541/180342D0
(1 row)

postgres=# SELECT * FROM pg_replication_slots;
    slot_name    |    plugin     | slot_type | datoid | database | active | active_pid | xmin | catalog_xmin | restart_lsn
-----------------+---------------+-----------+--------+----------+--------+------------+------+--------------+--------------
 regression_slot | test_decoding | logical   |  12379 | postgres | f      |            |      |    287608852 | 541/18034298
(1 row)

postgres=# CREATE TABLE public.foo(i int);
CREATE TABLE

postgres=# insert into public.foo(i) values(1);
INSERT 0 1
postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL);
   location   |    xid    |                  data
--------------+-----------+----------------------------------------
 541/18034360 | 287608852 | BEGIN 287608852
 541/180438D0 | 287608852 | COMMIT 287608852
 541/180438D0 | 287608853 | BEGIN 287608853
 541/180438D0 | 287608853 | table public.foo: INSERT: i[integer]:1
 541/18043940 | 287608853 | COMMIT 287608853
(5 rows)

postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, 1);
   location   |    xid    |       data
--------------+-----------+------------------
 541/18034360 | 287608852 | BEGIN 287608852
 541/180438D0 | 287608852 | COMMIT 287608852
(2 rows)

postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, 1) limit 1;
   location   |    xid    |      data
--------------+-----------+-----------------
 541/18034360 | 287608852 | BEGIN 287608852
(1 row)

postgres=# CREATE OR REPLACE FUNCTION logical_replication_slot_lsn_delta(slot text) RETURNS pg_lsn AS
postgres-# $$
postgres$# BEGIN
postgres$#     return location from pg_logical_slot_peek_changes(slot,null,1) limit 1;
postgres$# END
postgres$# $$ language plpgsql;
CREATE FUNCTION
postgres=# select logical_replication_slot_lsn_delta('regression_slot');   # crash!
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
->


#...and to cleanup
postgres@c61-pg509:~$ psql
psql (9.5.9)
Type "help" for help.

postgres=# select pg_drop_replication_slot('regression_slot');
 pg_drop_replication_slot
--------------------------

(1 row)

postgres=# drop table public.foo;
DROP TABLE



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [BUGS] Re: [PATCH] BUG #13416: Postgres >= 9.3 doesn't useoptimized shared memory on Solaris anymore
Следующее
От: Paul Mendoza
Дата:
Сообщение: [BUGS] Postgresql 9.6.5 not working in Windows Docker containers (bothNanoserver and WindowsServerCore base images)