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 1pK6Ei-0001ir-09 for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jan 2023 23:28:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pK6Eg-0007Zr-EG for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jan 2023 23:28:22 +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 1pK6Eg-0007ZA-27 for pgsql-hackers@lists.postgresql.org; Mon, 23 Jan 2023 23:28:22 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pK6Eb-0007OL-NS for pgsql-hackers@lists.postgresql.org; Mon, 23 Jan 2023 23:28:19 +0000 Received: by mail-io1-xd2d.google.com with SMTP id r71so6355958iod.2 for ; Mon, 23 Jan 2023 15:28:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=NgjVJ9pBuwj6P1hueYOWnXIApici7+GHakxV4hvR5YI=; b=fZfvVWzsdn7N6+wS7VOmx5htK2jFntRge2K627fDtwDsA7MRPxhyMnZ7SXKPhdq/Rx mym96oS+FglgZ7kK9mPeQSCwMfFbuNccjCkDXSmMM7rmr/JclVOyfVRuBZQ5X+iVTBTm 8+Re1U32cnHk1OF8U0m49hTDxAEPHO7VcSKGDz3OIskYOfvDZsb1zqCTNf15ODeIlnge F7f6FWFj7He64IgseENMmJeRtS4+sx7pQ6dVUloplfnFEVqZNUCBMrTr+TGzYSQXmuAE /4l6mV/nVil5+N8jfzLm12i1zSBc6QCMOl0S8dM1VAexJs8ImAtraKnSXl4BZhnBi/+g eT3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NgjVJ9pBuwj6P1hueYOWnXIApici7+GHakxV4hvR5YI=; b=x0pI/RUfa94dtpGrHHJXm536xZA6EIGYwEwIS+8/IyuH/mkAG+snAa0cvyq7V7m/mf M2i3u04u8LJUzGhJvS+i9sbFzYRncLvXDFFAzQ8GXyrWNsEKQHrvivkcm8xKzZT+f2Te Evdrv8YILEb8d/6Ubt/WsxSCVUeT8bNmvAS0jK6T671bKMlw4qES6A61ASmXD7n0YDFE yk2rubHd0H7jEQK8IysbzZDjYY3NkGCxV/yiqUchKaYX6hNYbbgBPDGbayHV75g2alyJ 7f5fgrhRI6NnXmV80ckmQ1GyFlm/oCcrypYgiUo0q/zl3T+r+exPiJbWa1woCTiTgk/I G7BA== X-Gm-Message-State: AFqh2kp2RchN7P6Kxb/NpG4Ae8+uyYBghubtaXzRqUmOwEbL03/AmzgJ 8L3bb1q0G0QODECRdPw5nO1Z8g== X-Google-Smtp-Source: AMrXdXvySUyIZkuQv7DV9RT9eqAANdlItSnBqiQ8hnxvKPSxICRZO041EcgHerfR/3aL/Lsb9WaBsw== X-Received: by 2002:a5e:dc04:0:b0:704:d99a:89a1 with SMTP id b4-20020a5edc04000000b00704d99a89a1mr17572690iok.13.1674516496681; Mon, 23 Jan 2023 15:28:16 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w14-20020a056638378e00b00375e136bf95sm154881jal.127.2023.01.23.15.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 15:28:15 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id F182D800983; Mon, 23 Jan 2023 17:28:14 -0600 (CST) Date: Mon, 23 Jan 2023 17:28:14 -0600 From: Justin Pryzby To: Andres Freund Cc: Thomas Munro , vignesh C , pgsql-hackers@lists.postgresql.org, Andrew Dunstan , Tom Lane Subject: Re: Cygwin cleanup Message-ID: <20230123232814.GA13860@telsasoft.com> References: <20221021034040.GT16921@telsasoft.com> <20221109010437.GK3775@telsasoft.com> <20230103142537.GM1153@telsasoft.com> <20230112043949.GQ9837@telsasoft.com> <20230113024354.3q4aigbf4fyh2igg@awork3.anarazel.de> <20230113041755.GV9837@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230113041755.GV9837@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 12, 2023 at 10:17:55PM -0600, Justin Pryzby wrote: > On Thu, Jan 12, 2023 at 06:43:54PM -0800, Andres Freund wrote: > > > It looks like logical decoding may be the "most wrong" place that > > > wal_sync_method is being used, so maybe my change is reasonable to > > > consider, and not just a workaround. > > > > I don't follow. What does using fsync_fname() vs fsync_fname_ext() have to do > > with pg_fsync() using wal_sync_method? fsync_fname() is just a wrapper around > > fsync_fname_ext(). Both end up in pg_fsync(). > > My patch used fsync_fname_ext() which would cause an ERROR rather than a > PANIC when failing to fsync the logical decoding pathname. > > > Are you actually proposing that we don't PANIC after an fsync for the category > > of files that you list here, even with data_sync_retry set? > > Yes, but I'm referring only to my change to SnapBuildSerialize(). > > The rest of the verbage was me trying to figure out the > history/evolution of pg_fsync usage. Also note the existing comment (originating from Thomas' "fsync-gate" commit, which introduced data_sync_retry): + * It's safe to just ERROR on fsync() here because we'll retry the whole + * operation including the writes. Also, it seems to work fine if one calls pg_fsync() again, rather than calling fsync_fname(), which re-opens the file. It also seems to work fine if one omits the initial call to fsync_fname("pg_logical/snapshots", true); Since SnapBuildSerialize() isn't atomic (the system could crash at any point), I'm not seeing why these wouldn't be adequately safe. But also hoping Thomas will comment on that. -- Justin