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 1kdfhv-0003F3-CW for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Nov 2020 20:30:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdfhu-0000se-Ao for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Nov 2020 20:30:06 +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 1kdfhu-0000sX-1M for pgsql-hackers@lists.postgresql.org; Fri, 13 Nov 2020 20:30:06 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kdfhs-0008SI-02 for pgsql-hackers@postgresql.org; Fri, 13 Nov 2020 20:30:05 +0000 Received: by mail-lj1-x22d.google.com with SMTP id w15so7139407lji.10 for ; Fri, 13 Nov 2020 12:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=r6ahM0Vwp4otwCWnhK2717/u2QVDVHrJ2jOUtarCihI=; b=UEPaFirQQXB2b7oVvFSzylLt1bkvKT2zgK4xANmKeoHnpDgBBtoIF7dMawLMqpwWrS s7Tj0zQerSzRNRSAsw3ADGYU2qRPV8D3bGTTlUnzd7Vj7V+XptpRpimoqj1UxSu1a76S aQc/S2ReTOA5Qu05gjfKgf2wpBRmU+m8SdvaZ5FwZ3zPDVjNX5x1MbcvzfuCs6KgMvgq YZWG+7Z3qLW2gwyO2ygEuCYprfGg3sGxI4oyyjVuHEyMX1iW/FP45vZwnl6WE8UsdfQQ Rs46ZKzoJm2fo65LTzTM4mIpwwJucy/0vCGiJhK0XVCOYQV1LELG5zUtP5Wchpqb0weD j3Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=r6ahM0Vwp4otwCWnhK2717/u2QVDVHrJ2jOUtarCihI=; b=APHm4+0RSVQuGllvGUz1oRHGzBpNtl1PZFt4zuATWe6UmJpwKIJTH+j0NPdq2AXlml A6s0jdrJ+q9mKVwUhzu2Dm7IDNhaVbZyafsGfwzH+1q6Se6qCMLKqMuQjaxhGEDHChE1 QZX6C6xk8kIalKYYAW6jV4WRAqMSP6nt53RA3RfdAvL9DmRYgbrMGYI2ZELlK0RgFoAf J2TuFxTg/ixZj6gQ8lj8y4LBIFRMF9A79OIi+YnOKauA2zIE/ZAzk1zmVmXH5XsCQzJx pMsOKrUPsZ7UGLnv55Hh0Wfm+iD0wfU3Cky7CwOd2GcfeFzSMY+M05UQnEMpZwEPzMNb xOQA== X-Gm-Message-State: AOAM530gexEw9V+Pa8At3+HoUwEkXzfleYopkdbnvjdNf4XN3pF8nt4a QZSRmOgD/aNsKRu0oGF8gME= X-Google-Smtp-Source: ABdhPJxBo2zEYbY3hF8FiujCnfSE1PMpWigvSS5MbRVZOK62oCRBk43v4J17BhJryXzAdKJyvwsBrw== X-Received: by 2002:a2e:988:: with SMTP id 130mr1785618ljj.409.1605299402397; Fri, 13 Nov 2020 12:30:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.6.8]) by smtp.gmail.com with ESMTPSA id a16sm1467292lfg.16.2020.11.13.12.30.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Nov 2020 12:30:01 -0800 (PST) Subject: Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction To: Tom Lane Cc: Justin Pryzby , Fabien COELHO , pgsql-hackers@postgresql.org, Alvaro Herrera , David Steele , "Bossart, Nathan" , Thomas Munro References: <24244.1585415634@sss.pgh.pa.us> <20200328183904.GI20103@telsasoft.com> <28906.1585422475@sss.pgh.pa.us> <27064.1585499825@sss.pgh.pa.us> <20200329171415.GL20103@telsasoft.com> <29512.1585502524@sss.pgh.pa.us> <20200329201215.GM20103@telsasoft.com> <4028.1585579463@sss.pgh.pa.us> <20200331080643.GE14618@telsasoft.com> <11882.1585672910@sss.pgh.pa.us> <83048c77-2531-48cb-aa2b-aa01cc5af519@gmail.com> <396837.1605298573@sss.pgh.pa.us> From: Alexander Lakhin Message-ID: Date: Fri, 13 Nov 2020 23:30:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <396837.1605298573@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 13.11.2020 23:16, Tom Lane wrote: > Alexander Lakhin writes: >> Shouldn't pg_ls_dir_files() retry stat() on ERROR_ACCESS_DENIED just >> like the pgwin32_open() does to ignore files in "delete pending" state? > That would soon lead us to changing every stat() caller in the system > to have Windows-specific looping logic. No thanks. If we need to do > this, let's put in a Windows wrapper layer comparable to pgwin32_open() > for open(). Maybe pgwin32_safestat() should perform this... For now it checks GetLastError() for ERROR_DELETE_PENDING, but as we've found out previously this error code in fact is not returned by the OS. And if the fix is not going to be quick, probably it should be discussed in another thread... Best regards, Alexander