On Fri, Oct 23, 2026 at 06:47:24PM +0300, Heikki Linnakangas wrote:
> Looks good to me.

Apologies for not following closely what you have been doing lately in
this area, David.  I should have followed, but well..

+void
+backup_control_file(uint8 *controlFile)
+{
+    ControlFileData controlData;
+
+    LWLockAcquire(ControlFileLock, LW_SHARED);
+    memcpy(&controlData, ControlFile, sizeof(ControlFileData));
+    LWLockRelease(ControlFileLock);
[...]
                 /* ... and pg_control after everything else. */
-                if (lstat(XLOG_CONTROL_FILE, &statbuf) != 0)
-                    ereport(ERROR,
-                            (errcode_for_file_access(),
-                             errmsg("could not stat file \"%s\": %m",
-                                    XLOG_CONTROL_FILE)));
-                sendFile(sink, XLOG_CONTROL_FILE, XLOG_CONTROL_FILE, &statbuf,
-                         false, InvalidOid, InvalidOid,
-                         InvalidRelFileNumber, 0, &manifest, 0, NULL, 0);
+                backup_control_file(controlFile);
+                sendFileWithContent(sink, XLOG_CONTROL_FILE,
+                                    (char *) controlFile, PG_CONTROL_FILE_SIZE,
+                                    &manifest);

Yep, that's clearly something that should be backpatched, at quick
glance.  Heikki, are you planning to take care of this part?
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to