postgresql/src/backend
Noah Misch 675b771ca5 Don't ERROR on PreallocXlogFiles() race condition.
Before a restartpoint finishes PreallocXlogFiles(), a startup process
KeepFileRestoredFromArchive() call can unlink the preallocated segment.
If a CHECKPOINT sql command had elicited the restartpoint experiencing
the race condition, that sql command failed.  Moreover, the restartpoint
omitted its log_checkpoints message and some inessential resource
reclamation.  Prevent the ERROR by skipping open() of the segment.
Since these consequences are so minor, no back-patch.

This commit has been applied as of 2b3e4672f7 in v15 and newer
versions.  This is required on stable branches of v13 and v14 to fix a
regression reported by Noah Misch, introduced by 1f95181b44, causing
spurious failures in archive recovery (neither streaming nor archive
recovery) with concurrent restartpoints.  The backpatched versions of
the patches have been aligned on these branches by me, Noah Misch is the
author.  Tests have been conducted by the both of us.

Reported-by: Arun Thirupathi
Author: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20210202151416.GB3304930@rfd.leadboat.com
Discussion: https://postgr.es/m/20250306193013.36.nmisch@google.com
Backpatch-through: 13
2025-04-06 15:26:23 +09:00
..
access Don't ERROR on PreallocXlogFiles() race condition. 2025-04-06 15:26:23 +09:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog Fix broken handling of domains in atthasmissing logic. 2025-03-03 12:43:29 -05:00
commands Need to do CommandCounterIncrement after StoreAttrMissingVal. 2025-04-02 11:13:01 -04:00
executor Remove HeapBitmapScan's skip_fetch optimization 2025-04-02 14:50:44 -04:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:23 -07:00
jit Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:10 -05:00
lib Accommodate very large dshash tables. 2024-12-17 15:24:45 -06:00
libpq Fix HBA option count 2025-01-12 23:44:39 +01:00
main Fix elog(FATAL) before PostmasterMain() or just after fork(). 2024-12-10 13:52:02 -08:00
nodes Build whole-row Vars the same way during parsing and planning. 2025-03-12 11:47:19 -04:00
optimizer Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 2025-04-02 11:58:37 +13:00
parser Fix parse_cte.c's failure to examine sub-WITHs in DML statements. 2025-04-05 15:01:33 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2025-02-17 17:51:30 +01:00
port Check for STATUS_DELETE_PENDING on Windows. 2024-11-08 09:34:00 +10:30
postmaster Don't ask for bug reports about pthread_is_threaded_np() != 0. 2025-01-23 14:23:39 -05:00
regex Fix recently-exposed portability issue in regex optimization. 2024-11-17 14:14:06 -05:00
replication Don't ERROR on PreallocXlogFiles() race condition. 2025-04-06 15:26:23 +09:00
rewrite Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. 2025-03-13 12:13:07 -04:00
snowball Avoid null pointer dereference crash after OOM in Snowball stemmers. 2025-02-18 21:24:12 -05:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:18:42 +13:00
storage Revert "Add HINT for restartpoint race with KeepFileRestoredFromArchive()." 2025-04-06 15:14:52 +09:00
tcop Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. 2025-03-13 12:13:07 -04:00
tsearch Clear errno before calling strtol() in spell.c. 2025-03-08 11:24:57 -05:00
utils Remove unnecessary type violation in tsvectorrecv(). 2025-04-02 16:18:08 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Translation updates 2021-09-20 16:23:13 +02:00