=== Applying patches on top of PostgreSQL commit ID 98c41fed6fce927539400bc02974b9cb3184befc === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Tue Oct 6 20:30:32 UTC 2026 On branch cf/6040 nothing to commit, working tree clean === using 'git am' to apply patch ./v1-0001-Inherit-pg_control-snapshot-into-EXEC_BACKEND-sub.patch === Applying: Inherit pg_control snapshot into EXEC_BACKEND sub-processes Using index info to reconstruct a base tree... M src/backend/access/transam/xlog.c M src/backend/postmaster/postmaster.c M src/backend/tcop/postgres.c M src/include/access/xlog.h Falling back to patching base and 3-way merge... Auto-merging src/include/access/xlog.h Auto-merging src/backend/tcop/postgres.c Auto-merging src/backend/postmaster/postmaster.c Auto-merging src/backend/access/transam/xlog.c CONFLICT (content): Merge conflict in src/backend/access/transam/xlog.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Inherit pg_control snapshot into EXEC_BACKEND sub-processes When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v1-0001-Inherit-pg_control-snapshot-into-EXEC_BACKEND-sub.patch === patching file src/backend/access/transam/xlog.c Hunk #1 succeeded at 778 with fuzz 1 (offset 54 lines). Hunk #2 FAILED at 4407. Hunk #3 succeeded at 4700 (offset 60 lines). Hunk #4 succeeded at 5498 (offset 221 lines). Hunk #5 succeeded at 5851 (offset 223 lines). 1 out of 5 hunks FAILED -- saving rejects to file src/backend/access/transam/xlog.c.rej patching file src/backend/postmaster/launch_backend.c patching file src/backend/postmaster/postmaster.c Hunk #2 succeeded at 3260 (offset -5 lines). patching file src/backend/tcop/postgres.c Hunk #1 succeeded at 4266 (offset 91 lines). patching file src/include/access/xlog.h Hunk #1 succeeded at 277 (offset 16 lines). Unstaged changes after reset: M src/backend/access/transam/xlog.c M src/backend/postmaster/launch_backend.c M src/backend/postmaster/postmaster.c M src/backend/tcop/postgres.c M src/include/access/xlog.h Removing src/backend/access/transam/xlog.c.rej === using 'git apply' to apply patch ./v1-0001-Inherit-pg_control-snapshot-into-EXEC_BACKEND-sub.patch === Applied patch to 'src/backend/access/transam/xlog.c' with conflicts. Applied patch to 'src/backend/postmaster/launch_backend.c' cleanly. Applied patch to 'src/backend/postmaster/postmaster.c' cleanly. Applied patch to 'src/backend/tcop/postgres.c' cleanly. Applied patch to 'src/include/access/xlog.h' cleanly. U src/backend/access/transam/xlog.c diff --cc src/backend/access/transam/xlog.c index 25fe4f503b3,fa953f5a43a..00000000000 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@@ -774,11 -722,9 +774,11 @@@ static void ValidateXLOGDirectoryStruct static void CleanupBackupHistory(void); static void UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force); static bool PerformRecoveryXLogAction(void); +static void CheckReplayedDataChecksumState(uint32 replayed_state); +static void AdoptReplayedDataChecksumState(uint32 new_version, XLogRecPtr lsn); static void InitControlFile(uint64 sysidentifier, uint32 data_checksum_version); static void WriteControlFile(void); - static void ReadControlFile(void); + static void ReadControlFile(ControlFileData *source); static void UpdateControlFile(void); static char *str_time(pg_time_t tnow, char *buf, size_t bufsize); @@@ -4467,42 -4407,56 +4467,70 @@@ WriteControlFile(void } static void - ReadControlFile(void) + ReadControlFile(ControlFileData *source) { pg_crc32c crc; - int fd; char wal_segsz_str[20]; ++<<<<<<< ours + ssize_t r; ++======= ++>>>>>>> theirs /* - * Read data... + * If a source snapshot was provided, use it instead of reading from disk. + * This path is used under EXEC_BACKEND to inherit pg_control from the + * postmaster via BackendParameters, matching fork semantics and avoiding + * torn reads of the on-disk file. */ - fd = BasicOpenFile(XLOG_CONTROL_FILE, - O_RDWR | PG_BINARY); - if (fd < 0) - ereport(PANIC, - (errcode_for_file_access(), - errmsg("could not open file \"%s\": %m", - XLOG_CONTROL_FILE))); - - pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_READ); - r = read(fd, ControlFile, sizeof(ControlFileData)); - if (r != sizeof(ControlFileData)) + if (source) { - if (r < 0) + memcpy(ControlFile, source, sizeof(ControlFileData)); + } + else + { + int fd; + int r; + + /* + * Read data... + */ + fd = BasicOpenFile(XLOG_CONTROL_FILE, + O_RDWR | PG_BINARY); + if (fd < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not read file \"%s\": %m", + errmsg("could not open file \"%s\": %m", XLOG_CONTROL_FILE))); ++<<<<<<< ours + else + ereport(PANIC, + (errcode(ERRCODE_DATA_CORRUPTED), + errmsg("could not read file \"%s\": read %zd of %zu", + XLOG_CONTROL_FILE, r, sizeof(ControlFileData)))); + } + pgstat_report_wait_end(); ++======= ++>>>>>>> theirs - close(fd); + pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_READ); + r = read(fd, ControlFile, sizeof(ControlFileData)); + if (r != sizeof(ControlFileData)) + { + if (r < 0) + ereport(PANIC, + (errcode_for_file_access(), + errmsg("could not read file \"%s\": %m", + XLOG_CONTROL_FILE))); + else + ereport(PANIC, + (errcode(ERRCODE_DATA_CORRUPTED), + errmsg("could not read file \"%s\": read %d of %zu", + XLOG_CONTROL_FILE, r, sizeof(ControlFileData)))); + } + pgstat_report_wait_end(); + + close(fd); + } /* * Check for expected pg_control format version. If this is wrong, the