Adjust datatype of ReplicationState.acquired_by.
authorTom Lane <[email protected]>
Thu, 14 Apr 2016 16:18:09 +0000 (12:18 -0400)
committerTom Lane <[email protected]>
Thu, 14 Apr 2016 16:18:09 +0000 (12:18 -0400)
It was declared as "pid_t", which would be fine except that none of
the places that printed it in error messages took any thought for the
possibility that it's not equivalent to "int".  This leads to warnings
on some buildfarm members, and could possibly lead to actually wrong
error messages on those platforms.  There doesn't seem to be any very
good reason not to just make it "int"; it's only ever assigned from
MyProcPid, which is int.  If we want to cope with PIDs that are wider
than int, this is not the place to start.

Also, fix the comment, which seems to perhaps be a leftover from a time
when the field was only a bool?

Per buildfarm.  Back-patch to 9.5 which has same issue.

src/backend/replication/logical/origin.c

index 6f96ce7255e3b2f9afc75080b4b67741a8a93b0e..ca90e9ea3769a000d67d3e12e7c99f074f4a27f5 100644 (file)
@@ -120,9 +120,9 @@ typedef struct ReplicationState
    XLogRecPtr  local_lsn;
 
    /*
-    * Slot is setup in backend?
+    * PID of backend that's acquired slot, or 0 if none.
     */
-   pid_t       acquired_by;
+   int         acquired_by;
 
    /*
     * Lock protecting remote_lsn and local_lsn.