Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1USH-0005jh-Fx for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2019 11:11:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1URI-0003vq-00 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2019 11:10:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1URH-0003vO-Ol for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2019 11:10:19 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1URF-00021O-7p for pgsql-hackers@postgresql.org; Wed, 06 Mar 2019 11:10:19 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id E695E4C032 for ; Wed, 6 Mar 2019 12:10:15 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 6NnNPG_YwA2f for ; Wed, 6 Mar 2019 12:10:09 +0100 (CET) From: Antonin Houska To: pgsql-hackers@postgresql.org Subject: openLogOff is not needed anymore MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30412.1551870730.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Wed, 06 Mar 2019 12:12:10 +0100 Message-ID: <30413.1551870730@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ... obviously due to commit c24dcd0. The following patch removes it. diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transa= m/xlog.c index ecd12fc53a..0fdd82a287 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -771,13 +771,11 @@ static const char *xlogSourceNames[] =3D {"any", "ar= chive", "pg_wal", "stream"}; = /* * openLogFile is -1 or a kernel FD for an open log file segment. - * When it's open, openLogOff is the current seek offset in the file. - * openLogSegNo identifies the segment. These variables are only - * used to write the XLOG, and so will normally refer to the active segme= nt. + * openLogSegNo identifies the segment. These variables are only used to + * write the XLOG, and so will normally refer to the active segment. */ static int openLogFile =3D -1; static XLogSegNo openLogSegNo =3D 0; -static uint32 openLogOff =3D 0; = /* * These variables are used similarly to the ones above, but for reading @@ -2447,7 +2445,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) /* create/use new log file */ use_existent =3D true; openLogFile =3D XLogFileInit(openLogSegNo, &use_existent, true); - openLogOff =3D 0; } = /* Make sure we have the current logfile open */ @@ -2456,7 +2453,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) XLByteToPrevSeg(LogwrtResult.Write, openLogSegNo, wal_segment_size); openLogFile =3D XLogFileOpen(openLogSegNo); - openLogOff =3D 0; } = /* Add current page to the set of pending pages-to-dump */ @@ -2508,15 +2504,13 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) errmsg("could not write to log file %s " "at offset %u, length %zu: %m", XLogFileNameP(ThisTimeLineID, openLogSegNo), - openLogOff, nbytes))); + startoffset, nbytes))); } nleft -=3D written; from +=3D written; startoffset +=3D written; } while (nleft > 0); = - /* Update state for write */ - openLogOff +=3D nbytes; npages =3D 0; = /* @@ -2602,7 +2596,6 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) XLByteToPrevSeg(LogwrtResult.Write, openLogSegNo, wal_segment_size); openLogFile =3D XLogFileOpen(openLogSegNo); - openLogOff =3D 0; } = issue_xlog_fsync(openLogFile, openLogSegNo); -- = Antonin Houska https://www.cybertec-postgresql.com