Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d08bl-0008JB-Ls for pgsql-admin@arkaria.postgresql.org; Mon, 17 Apr 2017 15:30:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d08bl-00080i-2V for pgsql-admin@arkaria.postgresql.org; Mon, 17 Apr 2017 15:30:29 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d08Zz-0004ht-LU for pgsql-admin@postgresql.org; Mon, 17 Apr 2017 15:28:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d08Zx-00025Z-9X for pgsql-admin@postgresql.org; Mon, 17 Apr 2017 15:28:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v3HFSV8r017214; Mon, 17 Apr 2017 11:28:31 -0400 From: Tom Lane To: Christian Ullrich cc: pgsql-admin@postgresql.org Subject: Re: Why does the WAL writer sit on completed segments (on Windows)? In-reply-to: References: Comments: In-reply-to Christian Ullrich message dated "Mon, 17 Apr 2017 17:00:35 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17212.1492442911.1@sss.pgh.pa.us> Date: Mon, 17 Apr 2017 11:28:31 -0400 Message-ID: <17213.1492442911@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Christian Ullrich writes: > The reason, as Process Monitor shows, is that the WAL writer process > keeps the file open for about one second after the > archive_status\*.ready file has been created. The archiver runs the > archive_command "too early", resulting in the sharing [1] violation seen > above. I'm not sure why that happens, but even if we changed the logic inside walwriter to avoid it, you'd still need to adapt your archiving script to deal with the case. The reason is that the walwriter isn't necessarily the only process writing WAL --- regular backends do it too, depending on timing. In such a case a backend would be holding an open-file reference until the next time it tries to write WAL, which might be awhile. It's not really practical to change that behavior; we certainly wouldn't want to open and close WAL files for every write. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin