=== Applying patches on top of PostgreSQL commit ID 972c14fb9134fdfd76ea6ebcf98a55a945bbc988 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Wed Apr 15 08:26:26 UTC 2026 On branch cf/5276 nothing to commit, working tree clean === using 'git am' to apply patch ./v3-0001-InstallXLogFileSegment-vs-concurrent-WAL-flush.patch === Applying: InstallXLogFileSegment() vs concurrent WAL flush Using index info to reconstruct a base tree... M src/backend/access/transam/xlog.c M src/backend/storage/file/fd.c Falling back to patching base and 3-way merge... Auto-merging src/backend/storage/file/fd.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 InstallXLogFileSegment() vs concurrent WAL flush 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 ./v3-0001-InstallXLogFileSegment-vs-concurrent-WAL-flush.patch === patching file src/backend/access/transam/xlog.c Hunk #1 succeeded at 468 (offset 9 lines). Hunk #2 succeeded at 3278 (offset 47 lines). Hunk #3 succeeded at 3651 (offset 64 lines). Hunk #4 succeeded at 3692 (offset 64 lines). Hunk #5 FAILED at 4946. Hunk #6 FAILED at 4993. Hunk #7 succeeded at 5468 (offset 421 lines). 2 out of 7 hunks FAILED -- saving rejects to file src/backend/access/transam/xlog.c.rej patching file src/backend/storage/file/fd.c Hunk #1 succeeded at 774 (offset 2 lines). Unstaged changes after reset: M src/backend/access/transam/xlog.c M src/backend/storage/file/fd.c Removing src/backend/access/transam/xlog.c.rej === using 'git apply' to apply patch ./v3-0001-InstallXLogFileSegment-vs-concurrent-WAL-flush.patch === Applied patch to 'src/backend/access/transam/xlog.c' with conflicts. Applied patch to 'src/backend/storage/file/fd.c' cleanly. U src/backend/access/transam/xlog.c diff --cc src/backend/access/transam/xlog.c index f85b5286086,a28a9a5dbea..00000000000 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@@ -5330,24 -4929,24 +5363,29 @@@ XLOGShmemRequest(void *arg /* and the buffers themselves */ size = add_size(size, mul_size(XLOG_BLCKSZ, XLOGbuffers)); - /* - * Note: we don't count ControlFileData, it comes out of the "slop factor" - * added by CreateSharedMemoryAndSemaphores. This lets us use this - * routine again below to compute the actual allocation size. - */ - - return size; + ShmemRequestStruct(.name = "XLOG Ctl", + .size = size, + .ptr = (void **) &XLogCtl, + ); + ShmemRequestStruct(.name = "Control File", + .size = sizeof(ControlFileData), + .ptr = (void **) &ControlFile, + ); } -void -XLOGShmemInit(void) +/* + * XLOGShmemInit - initialize the XLogCtl shared memory area. + */ +static void +XLOGShmemInit(void *arg) { - bool foundCFile, - foundXLog; char *allocptr; int i; ++<<<<<<< ours ++======= + ControlFileData *localControlFile; + XLogSegNo lastKnownInstalledSegno = 0; ++>>>>>>> theirs #ifdef WAL_DEBUG @@@ -5371,11 -4990,16 +5409,22 @@@ * Already have read control file locally, unless in bootstrap mode. Move * contents into shared memory. */ - if (localControlFile) + if (LocalControlFile) { ++<<<<<<< ours + memcpy(ControlFile, LocalControlFile, sizeof(ControlFileData)); + pfree(LocalControlFile); + LocalControlFile = NULL; ++======= + memcpy(ControlFile, localControlFile, sizeof(ControlFileData)); + pfree(localControlFile); + /* + * A decent approximation for the last known installed WAL segment + * number can be the segment in which the checkpoint record resides, + * specially in cases where we have had a clean shutdown. + */ + XLByteToSeg(ControlFile->checkPoint, lastKnownInstalledSegno, wal_segment_size); ++>>>>>>> theirs } /* @@@ -5435,17 -5054,9 +5484,18 @@@ pg_atomic_init_u64(&XLogCtl->logWriteResult, InvalidXLogRecPtr); pg_atomic_init_u64(&XLogCtl->logFlushResult, InvalidXLogRecPtr); pg_atomic_init_u64(&XLogCtl->unloggedLSN, InvalidXLogRecPtr); + pg_atomic_init_u64(&XLogCtl->last_known_installed_segno, lastKnownInstalledSegno); } +/* + * XLOGShmemAttach - re-establish WALInsertLocks pointer after attaching. + */ +static void +XLOGShmemAttach(void *arg) +{ + WALInsertLocks = XLogCtl->Insert.WALInsertLocks; +} + /* * This func must be called ONCE on system install. It creates pg_control * and the initial XLOG segment.