Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qc8Zr-00DyLT-5C for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Sep 2023 18:09:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qc8Zp-00GShU-Gk for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Sep 2023 18:09:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qc8Zp-00GShH-69 for pgsql-hackers@lists.postgresql.org; Fri, 01 Sep 2023 18:09:00 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qc8Zk-002OHH-1M for pgsql-hackers@postgresql.org; Fri, 01 Sep 2023 18:09:00 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-57124ee486dso1327616eaf.3 for ; Fri, 01 Sep 2023 11:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693591734; x=1694196534; darn=postgresql.org; h=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=QHL58/waZ8Fh7jzuX89lgSfFLj9+Qv575K7SRpWgIPU=; b=PeZkffxPWVv0BAOO3umUvPznCd2LPlwZ9+EOwsI+99HfNNyo0sjnKnfwwNqIka2ekU qHxDYjUmTuu2dixeNh7lcmrzhLTK7sj6p2Y077D4o7g/CY+uFZvLqHtFSqzmrpfOkejW HdbQzRzSLfc2tGGQQRi0AZkqPMWRyrlLZXuMC4EODrR6WEpUUVPNtqEKSNPX2tmOj00H jDZhy0+bK0lL47dldOAXyYKASVvId3XxawUUb2ObwLuNONszt7GZ3XYxX+9+KXXT0m9l uP+QY7I43fLq2/5F+VpHMTz7ENZDcOpNhmdH44mFt+BJpOBWU5MCkZrcyAE7ZDo4PKAD Sqqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693591734; x=1694196534; h=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=QHL58/waZ8Fh7jzuX89lgSfFLj9+Qv575K7SRpWgIPU=; b=aV4h4tHSaQKZ7/3WfIAiIZEc2pcjLukMZu/5cOWALMCoa5FfEjZJXv6qZvRBH/f+94 pzbAqQw9q7iah6Ncpiq66WtFW4omytZbnt5Zbuiy1WlfBaG8a5DMsaLwjijrwm8HtZDf i0DCqYRuM6k2TG8HsgiXO+lOobyVMNlnUoDxiXgYaBvBJfWY14MEw1Qbhefut8xQvn9H Hvdg40aAraZwQGw52nD0fB9oLR6xpd76PVBKx1Qk0HwaTbi/c9lEhha8vfk1B4tZG4qL eK3KjpF3eGuxJP4WYsCmq7nLYCL490xrwZfeN9ADNoHMyU25mf/fi3A7vp3fQ112tBFW rq6Q== X-Gm-Message-State: AOJu0YwGpxMo+L6eZo2rg6y9zOXT4E1moXUI19ufAEO/z/XrupvjXNwD o371yjZ9lAQDSRujrmqSH84= X-Google-Smtp-Source: AGHT+IHmdg5PwsssU/HMHCmQRNd4zSdZTTFRWlZEf2AERlxxcaFMiAg0AVoO24czhpPLfTMdRI/TEg== X-Received: by 2002:a4a:2753:0:b0:571:1fad:ebdd with SMTP id w19-20020a4a2753000000b005711fadebddmr3426466oow.1.1693591734036; Fri, 01 Sep 2023 11:08:54 -0700 (PDT) Received: from nathanxps13 ([2600:1700:48f8:340f:6862:ed15:920:90f8]) by smtp.gmail.com with ESMTPSA id z199-20020a4a49d0000000b00565ebacf9cfsm2185353ooa.33.2023.09.01.11.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 11:08:53 -0700 (PDT) Date: Fri, 1 Sep 2023 11:08:51 -0700 From: Nathan Bossart To: Justin Pryzby Cc: Michael Paquier , Thomas Munro , David Steele , Fujii Masao , Bruce Momjian , Paul Guo , Tom Lane , Michael Brown , pgsql-hackers@postgresql.org Subject: Re: should frontend tools use syncfs() ? Message-ID: <20230901180851.GC3180181@nathanxps13> References: <20210930004340.GM831@telsasoft.com> <20220413115412.GM26620@telsasoft.com> <20230729214010.GA189456@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thanks for taking a look. On Fri, Sep 01, 2023 at 12:58:10PM -0500, Justin Pryzby wrote: >> + if (!user_opts.sync_method) >> + user_opts.sync_method = pg_strdup("fsync"); > > why pstrdup? I believe I was just following the precedent set by some of the other options. >> +parse_sync_method(const char *optarg, SyncMethod *sync_method) >> +{ >> + if (strcmp(optarg, "fsync") == 0) >> + *sync_method = SYNC_METHOD_FSYNC; >> +#ifdef HAVE_SYNCFS >> + else if (strcmp(optarg, "syncfs") == 0) >> + *sync_method = SYNC_METHOD_SYNCFS; >> +#endif >> + else >> + { >> + pg_log_error("unrecognized sync method: %s", optarg); >> + return false; >> + } > > This should probably give a distinct error when syncfs is not supported > than when it's truely recognized. Later versions of the patch should have this. > The patch should handle pg_dumpall, too. It looks like pg_dumpall only ever fsyncs a single file, so I don't think it is really needed there. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com