Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpAXs-0007zo-KI for pgsql-general@arkaria.postgresql.org; Fri, 04 Jun 2021 14:11:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lpAXr-0002vh-B2 for pgsql-general@arkaria.postgresql.org; Fri, 04 Jun 2021 14:11:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpAXr-0002n8-1G for pgsql-general@lists.postgresql.org; Fri, 04 Jun 2021 14:11:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpAXl-0007sr-KA for pgsql-general@lists.postgresql.org; Fri, 04 Jun 2021 14:11:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 154EBK15144410; Fri, 4 Jun 2021 10:11:20 -0400 From: Tom Lane To: Atul Kumar cc: Jehan-Guillaume de Rorthais , pgsql-general Subject: Re: strange behavior of WAL files In-reply-to: References: <20210604125656.47938b0c@firost> Comments: In-reply-to Atul Kumar message dated "Fri, 04 Jun 2021 18:24:13 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <144408.1622815880.1@sss.pgh.pa.us> Date: Fri, 04 Jun 2021 10:11:20 -0400 Message-ID: <144409.1622815880@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Atul Kumar writes: > once old WAL files of pg_xlog directory are archived in > '/nfslogs/wal/' directory then these WAL files are getting generated > with the same name in pg_xlog directory. Are you sure you are describing the behavior accurately? What I would expect to happen, once an old WAL file has been archived and the server knows its contents are no longer needed, is for the WAL file to be "recycled" by renaming it to have a name that's in-the- future in the WAL name series, whereupon it will wait its turn to be reused by future WAL writes. On most filesystems the rename as such doesn't change the file's mod time, so you'll see files that seem to be in-the-future according to their names, but have old timestamps. (There's a limit on how many future WAL files we'll tee up this way, so it's possible that an old one would just get deleted instead. But the steady-state behavior is to just rotate them around.) regards, tom lane