mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-20 16:33:23 +02:00
Instead of serializing the transaction to disk after reaching the logical_decoding_work_mem limit in memory, we consume the changes we have in memory and invoke stream API methods added by commit45fdc9738b
. However, sometimes if we have incomplete toast or speculative insert we spill to the disk because we can't generate the complete tuple and stream. And, as soon as we get the complete tuple we stream the transaction including the serialized changes. We can do this incremental processing thanks to having assignments (associating subxact with toplevel xacts) in WAL right away, and thanks to logging the invalidation messages at each command end. These features are added by commits0bead9af48
andc55040ccd0
respectively. Now that we can stream in-progress transactions, the concurrent aborts may cause failures when the output plugin consults catalogs (both system and user-defined). We handle such failures by returning ERRCODE_TRANSACTION_ROLLBACK sqlerrcode from system table scan APIs to the backend or WALSender decoding a specific uncommitted transaction. The decoding logic on the receipt of such a sqlerrcode aborts the decoding of the current transaction and continue with the decoding of other transactions. We have ReorderBufferTXN pointer in each ReorderBufferChange by which we know which xact it belongs to. The output plugin can use this to decide which changes to discard in case of stream_abort_cb (e.g. when a subxact gets discarded). We also provide a new option via SQL APIs to fetch the changes being streamed. Author: Dilip Kumar, Tomas Vondra, Amit Kapila, Nikhil Sontakke Reviewed-by: Amit Kapila, Kuntal Ghosh, Ajin Cherian Tested-by: Neha Sharma, Mahendra Singh Thalor and Ajin Cherian Discussion: https://postgr.es/m/688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com
35 lines
1.2 KiB
Makefile
35 lines
1.2 KiB
Makefile
# contrib/test_decoding/Makefile
|
|
|
|
MODULES = test_decoding
|
|
PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
|
|
|
|
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
|
|
decoding_into_rel binary prepared replorigin time messages \
|
|
spill slot truncate stream
|
|
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
|
|
oldest_xmin snapshot_transfer subxact_without_top
|
|
|
|
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf
|
|
ISOLATION_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf
|
|
|
|
# Disabled because these tests require "wal_level=logical", which
|
|
# typical installcheck users do not have (e.g. buildfarm clients).
|
|
NO_INSTALLCHECK = 1
|
|
|
|
ifdef USE_PGXS
|
|
PG_CONFIG = pg_config
|
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
|
include $(PGXS)
|
|
else
|
|
subdir = contrib/test_decoding
|
|
top_builddir = ../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
include $(top_srcdir)/contrib/contrib-global.mk
|
|
endif
|
|
|
|
# But it can nonetheless be very helpful to run tests on preexisting
|
|
# installation, allow to do so, but only if requested explicitly.
|
|
installcheck-force:
|
|
$(pg_regress_installcheck) $(REGRESS)
|
|
$(pg_isolation_regress_installcheck) $(ISOLATION)
|