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 <[email protected]>
Reported-by: Nikita Kalinin <[email protected]>
Suggested-by: Zhijie Hou <[email protected]>
Reviewed-by: Antonin Houska <[email protected]> (older version)
Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> (older version)
Discussion: https://postgr.es/m/[email protected]

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(-)

Reply via email to