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 1lADyD-0007Lm-9b for pgsql-general@arkaria.postgresql.org; Thu, 11 Feb 2021 15:33:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lADyB-0004aA-RI for pgsql-general@arkaria.postgresql.org; Thu, 11 Feb 2021 15:33:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lADyB-0004a3-J9 for pgsql-general@lists.postgresql.org; Thu, 11 Feb 2021 15:33:27 +0000 Received: from mail.am-soft.de ([83.218.36.120]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lADy8-0004aD-Gi for pgsql-general@postgresql.org; Thu, 11 Feb 2021 15:33:26 +0000 Received: from mail.am-soft.de (localhost [127.0.0.1]) by mail.am-soft.de (Postfix) with ESMTP id 88CDE36104F9; Thu, 11 Feb 2021 16:33:21 +0100 (CET) Received: from Bit02EX.bitstoregruppe.local (exchange01.bitstore.group [116.202.141.225]) by mail.am-soft.de (Postfix) with ESMTPA id 7C70036104F7 for ; Thu, 11 Feb 2021 16:33:21 +0100 (CET) Received: from tschoening-nb.fritz.box (77.78.163.99) by Bit02EX.bitstoregruppe.local (192.168.254.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 11 Feb 2021 16:32:25 +0100 Date: Thu, 11 Feb 2021 16:33:11 +0100 From: =?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?= Organization: AM-SoFT IT-Service - Bitstore Hameln GmbH i.G. Message-ID: <201359951.20210211163311@am-soft.de> To: Subject: Re: PostgreSQL occasionally unable to rename WAL files (NTFS) In-Reply-To: <095ccf8d-7f58-d928-427c-b17ace23cae6@burgess.co.nz> References: <095ccf8d-7f58-d928-427c-b17ace23cae6@burgess.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [77.78.163.99] X-ClientProxiedBy: Bit02EX.bitstoregruppe.local (192.168.254.21) To Bit02EX.bitstoregruppe.local (192.168.254.21) X-C2ProcessedOrg: e1a4acb5-ea26-4a8f-9559-e23e579650e8 X-AV-Checked: ClamAV using ClamSMTP List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Guten Tag Guy Burgess, am Donnerstag, 11. Februar 2021 um 01:21 schrieben Sie: > What appears to be happening is the affected WAL files (which is > usually only 2 or 3 WAL files at a time) are somehow "losing" their > NTFS permissions, so the PG process can't rename them - though of > course the PG process created them. Even running icacls as admin > gives "Access is denied" on those files. A further oddity is the > affected files do end up disappearing after a while. If you see that somewhat frequently, use Process Monitor and Process Explorer to see who accesses those files how. ProcExp easily allows you to find all open handles per file. If it's not AV, it might be something like Windows Search Indexer as well, if that is enabled by default in Server 2019 at all. Though, even with my Windows 10 and Search Indexer enabled I didn't run into such problems yet. And especially when rewriting large parts of my databases with lots of created WAL files, I see the Indexer working on those files, but NOT conflicting with Postgres yet. The behaviour you describe happens exactly when two processes e.g. concurrently hold HANDLEs on the same file and one of those deletes the file then. Windows keeps file names until all open HANDLEs are closed and depending on how those HANDLEs have been opened by the first app, concurrent deletion is perferctly fine for Windows. Though, a such deleted file can't be opened easily anymore and looks like it has lost permissions only. But that's not the case, it's deleted already. It might be that this happens for Postgres to itself somehow when some other app has an open HANDLE. I don't think that some other app is deleting that file by purpose instead, reading it for some reason seems more likely to me. > dwShareMode > FILE_SHARE_DELETE > Enables subsequent open operations on a file or device to request > delete access. Otherwise, other processes cannot open the file or > device if they request delete access. https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-creat= efilew Mit freundlichen Gr=C3=BC=C3=9Fen Thorsten Sch=C3=B6ning --=20 Thorsten Sch=C3=B6ning AM-SoFT IT-Service - Bitstore Hameln GmbH i.G.=C2=A0ist ein Mitglied der Bi= tstore Gruppe - Ihr Full-Service-Dienstleister f=C3=BCr IT und TK E-Mail: Thorsten.Schoening@AM-SoFT.de Web: http://www.AM-SoFT.de/ Telefon: 05151- 9468- 0 Telefon: 05151- 9468-55 Fax: 05151- 9468-88 Mobil: 0178-8 9468-04 AM-SoFT IT-Service - Bitstore Hameln GmbH i.G., Brandenburger Str. 7c, 3178= 9 Hameln AG Hannover HRB neu - Gesch=C3=A4ftsf=C3=BChrer: Janine Galonska F=C3=BCr R=C3=BCckfragen stehe ich Ihnen sehr gerne zur Verf=C3=BCgung. Mit freundlichen Gr=C3=BC=C3=9Fen Thorsten Sch=C3=B6ning Tel: 05151 9468 0 Fax: 05151 9468 88 Mobil:=20 Webseite: https://www.am-soft.de=20 AM-Soft IT-Service - Bitstore Hameln GmbH i.G.=C2=A0ist ein Mitglied der Bi= tstore Gruppe - Ihr Full-Service-Dienstleister f=C3=BCr IT und TK AM-Soft IT-Service - Bitstore Hameln GmbH i.G. Brandenburger Str. 7c 31789 Hameln Tel: 05151 9468 0 Bitstore IT-Consulting GmbH Zentrale - Berlin Lichtenberg Frankfurter Allee 285 10317 Berlin Tel: 030 453 087 80 CBS IT-Service - Bitstore Kaulsdorf UG Tel: 030 453 087 880 1 B=C3=BCro Dallgow-D=C3=B6beritz Tel: 03322 507 020 B=C3=BCro Kloster Lehnin Tel: 033207 566 530 PCE IT-Service=C2=A0- Bitstore Darmstadt UG Darmstadt Tel: 06151 392 973 0 B=C3=BCro Neuruppin Tel: 033932 606 090 ACI EDV Systemhaus Dresden GmbH Dresden Tel: 0351 254 410 Das Systemhaus - Bitstore Magdeburg GmbH Magdeburg Tel: 0391 636 651 0 Allerdata.IT - Bitstore Wittenberg GmbH Wittenberg Tel: 03491=C2=A0876 735 7 B=C3=BCro Liebenwalde Tel: 033054 810 00 HSA - das B=C3=BCro - Bitstore Altenburg UG Altenburg Tel: 0344 784 390 97 Bitstore IT =E2=80=93 Consulting GmbH NL Piesteritz=20 Piesteritz Tel: 03491 644 868 6 Solltec IT-Services - Bitstore Braunschweig UG Braunschweig Tel: 0531 206 068 0 MF Computer Service - Bitstore G=C3=BCtersloh GmbH G=C3=BCtersloh Tel: 05245=C2=A0920 809 3 Firmensitz: MF Computer Service - Bitstore G=C3=BCtersloh GmbH, Gildestra= =C3=9Fe 25, 33442 Herzebrock-Clarholz Gesch=C3=A4ftsf=C3=BChrer Janine Galonska