@@ -771,13 +771,11 @@ static const char *xlogSourceNames[] = {"any", "archive", "pg_wal", "stream"};
771771
772772/*
773773 * openLogFile is -1 or a kernel FD for an open log file segment.
774- * When it's open, openLogOff is the current seek offset in the file.
775- * openLogSegNo identifies the segment. These variables are only
776- * used to write the XLOG, and so will normally refer to the active segment.
774+ * openLogSegNo identifies the segment. These variables are only used to
775+ * write the XLOG, and so will normally refer to the active segment.
777776 */
778777static int openLogFile = -1 ;
779778static XLogSegNo openLogSegNo = 0 ;
780- static uint32 openLogOff = 0 ;
781779
782780/*
783781 * These variables are used similarly to the ones above, but for reading
@@ -2447,7 +2445,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
24472445 /* create/use new log file */
24482446 use_existent = true;
24492447 openLogFile = XLogFileInit (openLogSegNo , & use_existent , true);
2450- openLogOff = 0 ;
24512448 }
24522449
24532450 /* Make sure we have the current logfile open */
@@ -2456,7 +2453,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
24562453 XLByteToPrevSeg (LogwrtResult .Write , openLogSegNo ,
24572454 wal_segment_size );
24582455 openLogFile = XLogFileOpen (openLogSegNo );
2459- openLogOff = 0 ;
24602456 }
24612457
24622458 /* Add current page to the set of pending pages-to-dump */
@@ -2508,15 +2504,13 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
25082504 errmsg ("could not write to log file %s "
25092505 "at offset %u, length %zu: %m" ,
25102506 XLogFileNameP (ThisTimeLineID , openLogSegNo ),
2511- openLogOff , nbytes )));
2507+ startoffset , nbytes )));
25122508 }
25132509 nleft -= written ;
25142510 from += written ;
25152511 startoffset += written ;
25162512 } while (nleft > 0 );
25172513
2518- /* Update state for write */
2519- openLogOff += nbytes ;
25202514 npages = 0 ;
25212515
25222516 /*
@@ -2602,7 +2596,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
26022596 XLByteToPrevSeg (LogwrtResult .Write , openLogSegNo ,
26032597 wal_segment_size );
26042598 openLogFile = XLogFileOpen (openLogSegNo );
2605- openLogOff = 0 ;
26062599 }
26072600
26082601 issue_xlog_fsync (openLogFile , openLogSegNo );
0 commit comments