EnableLogicalDecoding() sets xlog_logical_info to true, emits a procsignal barrier, sets logical_decoding_enabled to true, and then writes a WAL record. If the activating backend is interrupted between these steps, a PG_ENSURE_ERROR_CLEANUP() callback runs to undo the partial activation. The previous callback asserted that logical_decoding_enabled was still false and then cleared xlog_logical_info. Both actions were unsafe when a second backend was concurrently activating: the peer backend might have already observed xlog_logical_info as true, set logical_decoding_enabled to true, and written the activation WAL record before our callback fired, causing the first backend to hit the assertion failure. Fix this by having the abort callback call RequestDisableLogicalDecoding(), allowing the checkpointer to undo the partial activation in the same manner as a normal deactivation. This simplifies the logic by unifying the activation abort and deactivation paths. While this approach now wakes up the checkpointer when an activation is interrupted, this should not be a serious issue in practice since such interruptions are rare. Add a test case to 051_effective_wal_level.pl. Reported-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/788B5B8A-BC22-48D8-818E-7B00416CF84E@gmail.com |
||
|---|---|---|
| .github | ||
| config | ||
| contrib | ||
| doc | ||
| src | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| aclocal.m4 | ||
| configure | ||
| configure.ac | ||
| COPYRIGHT | ||
| GNUmakefile.in | ||
| HISTORY | ||
| Makefile | ||
| meson.build | ||
| meson_options.txt | ||
| README.md | ||
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.