pgsql: Disallow direct use of the pgrepack logical decoding plugin
pgsql: Disallow direct use of the pgrepack logical decoding plugin
От:
Álvaro Herrera <alvherre@kurilemu.de>
Дата:
Disallow direct use of the pgrepack logical decoding plugin Nothing is to be gained from using pgrepack outside of REPACK (CONCURRENTLY), and it leads to assertion failures in assertion-enabled builds, and to crashes due to bogus memory lifetime in production builds. Reject attempts to do that with a clean error report. Clean up the nearby code a tad while at it. The only functional changes in that are that the output_writer_private context is allocated and partially filled by the pgrepack output plugin; and that ->relid therein is now always present (rather than only in assertion-enabled builds). Other than that it's just minor code rearrangement and added comments. Author: Álvaro Herrera Reported-by: Nikita Kalinin Suggested-by: Zhijie Hou Reviewed-by: Antonin Houska (older version) Reviewed-by: Srinath Reddy Sadipiralla (older version) Discussion: https://postgr.es/m/19500-38a02529a69353a5@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/cd7b204b2df99516a48a738e662d8512e706b519 Modified Files -------------- contrib/test_decoding/expected/repack.out | 11 +++ contrib/test_decoding/sql/repack.sql | 7 ++ src/backend/commands/repack_worker.c | 102 ++++++++++++---------------- src/backend/replication/pgrepack/pgrepack.c | 20 +++++- src/include/commands/repack_internal.h | 2 - 5 files changed, 79 insertions(+), 63 deletions(-)