postgresql/contrib/test_decoding
Michael Paquier 173b56f1ef Add flush option to pg_logical_emit_message()
Since its introduction, LogLogicalMessage() (via the SQL interface
pg_logical_emit_message()) has never included a call to XLogFlush(),
causing it to potentially lose messages on a crash when used in
non-transactional mode.  This has come up to me as a problem while
playing with ideas to design a test suite for what has become
039_end_of_wal.pl introduced in bae868caf2 by Thomas Munro, because
there are no direct ways to force a WAL flush via SQL.

The default is false, to not flush messages and influence existing
use-cases where this function could be used.  If set to true, the
message emitted is flushed before returning back to the caller, making
the message durable on crash.  This new option has no effect when using
pg_logical_emit_message() in transactional mode, as the record's flush
is guaranteed by the WAL record generated by the transaction committed.

Two queries of test_decoding are tweaked to cover the new code path for
the flush.

Bump catalog version.

Author: Michael Paquier
Reviewed-by: Andres Freund, Amit Kapila, Fujii Masao, Tung Nguyen, Tomas
Vondra
Discussion: https://postgr.es/m/ZNsdThSe2qgsfs7R@paquier.xyz
2023-10-18 11:24:59 +09:00
..
expected Add flush option to pg_logical_emit_message() 2023-10-18 11:24:59 +09:00
specs Remove incidental md5() function uses from several tests 2023-07-04 14:31:57 +02:00
sql Add flush option to pg_logical_emit_message() 2023-10-18 11:24:59 +09:00
t Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore Improve isolation tests infrastructure. 2017-03-14 15:56:17 -07:00
Makefile Fix catalog lookup with the wrong snapshot during logical decoding. 2022-08-11 10:09:24 +05:30
logical.conf Stabilize streaming tests in test_decoding. 2022-04-20 08:59:55 +05:30
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
test_decoding.c Add BEGIN/COMMIT for transactional messages during decoding. 2023-07-11 08:31:11 +05:30