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 1qYGRS-001C5f-2Z for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 01:44:22 +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 1qYGRP-00D3x2-13 for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 01:44:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYGRO-00D3wr-Kt for pgsql-hackers@lists.postgresql.org; Tue, 22 Aug 2023 01:44:18 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qYGRH-000Fhj-1Y for pgsql-hackers@postgresql.org; Tue, 22 Aug 2023 01:44:17 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1c504386374so2879613fac.3 for ; Mon, 21 Aug 2023 18:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692668650; x=1693273450; 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=lefoNu2UeHCfUWtYWgYxCWWpkvfDYOtSALQZtRV/Uks=; b=dk0uHESkjECpLSRRqV0epROHXdLDT+MF3dEVZ4oLWvdlY8tzQPWROImmH655wFpljM /3qwVI+coO5J5gtzyODJ536Z4T4Fwa92e/W/N2IAFfycmHwpv51815nKeubF/AQN60hx 0F7p0ntV0Cj2LXQCaF25Edf/G4RDSeSi7uKwEI7eIxD6F8koYlNh6yLyRMPZsI3zPFwB LnDzbMx+tMHeApVnKVloWZGE671AUW2Nlg6SKxzUzu175eTJ6MlI425KbyCa8FhMaEkw teBesuMxtaytNApztJ7naEQurhM0+6JsOBaz6BURo5fj8y6kCFo95ZBJ5uLqroPS82p5 lq7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692668650; x=1693273450; 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=lefoNu2UeHCfUWtYWgYxCWWpkvfDYOtSALQZtRV/Uks=; b=Fxz9OM47D6pwgZeCP5qWOL1aisJk3mZ2Yt+7N2t/byZt6/YakmKqW4trbFfgn32gcn 4fiG1VgSlQKLERPzmYo/T4C0a1Xnkq/ENFbxqqT7iM1Pioq2CQQegnDvaZAbqzGahTWg phFju3jHxCM2hUkpqXsgxPpk4taA4yW+X+5mkK3AD3QukTttVFHzyjcEIxw3Z1HYxGky 9ofkv8IStIrX9Cmt4WRFrfhnF6DoGU/W0YZd3PkD+6SNnRBj5UeH8lEAmBy14jTgv+5B gra7dR9K8MjQEU/NR0blpnnRskktozkBi1hok7hIaUvq7wlhfS7Snd5pyUL+RIUOch00 g/ww== X-Gm-Message-State: AOJu0YzWSxxAUhkHbFOrK8wZCtEZJV06sX1V58AoLIJL5coFkUI/w9YK QGIztAt0GK4lPcicINDsQIw= X-Google-Smtp-Source: AGHT+IHXzdPoTdaii1xVvs5tBpif14wMYcMbpzEsb0nHUpu/XxHryOocboOfvNgYweV5Jij0YG38Hw== X-Received: by 2002:a05:6871:5227:b0:1bb:b4a2:958f with SMTP id ht39-20020a056871522700b001bbb4a2958fmr12041623oac.53.1692668650263; Mon, 21 Aug 2023 18:44:10 -0700 (PDT) Received: from nathanxps13 ([2600:1700:48f8:340f:2424:9658:77a9:73f4]) by smtp.gmail.com with ESMTPSA id dt26-20020a0568705a9a00b001c52b2bdb51sm4972586oab.37.2023.08.21.18.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 18:44:09 -0700 (PDT) Date: Mon, 21 Aug 2023 18:44:07 -0700 From: Nathan Bossart To: Michael Paquier Cc: Justin Pryzby , Thomas Munro , David Steele , Fujii Masao , Bruce Momjian , Tom Lane , Michael Brown , pgsql-hackers@postgresql.org Subject: Re: should frontend tools use syncfs() ? Message-ID: <20230822014407.GA449131@nathanxps13> References: <20230729214010.GA189456@nathanxps13> <20230731175138.GA432880@nathanxps13> <20230731183946.GB537853@nathanxps13> <20230801163707.GA862840@nathanxps13> <20230808200606.GA1384393@nathanxps13> <20230816151705.GB2651383@nathanxps13> <20230818160111.GA189711@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 On Tue, Aug 22, 2023 at 08:56:26AM +0900, Michael Paquier wrote: > --- a/src/include/storage/fd.h > +++ b/src/include/storage/fd.h > @@ -43,15 +43,11 @@ > #ifndef FD_H > #define FD_H > > +#ifndef FRONTEND > + > #include > #include > > Ugh. So you need this part because pg_rewind's filemap.c includes > fd.h, and pg_rewind also needs file_utils.h. This is not the fault of > your patch, but this does not make the situation better, either.. It > looks like we need to think harder about this layer. An improvement > would be to split file_utils.c so as its frontend-only code is moved > to OBJS_FRONTEND in a new file with a new header? It should be OK to > keep DataDirSyncMethod in file_utils.h as long as the split is clean. I'm hoping there's a simpler path forward here. pg_rewind only needs the following lines from fd.h: /* Filename components */ #define PG_TEMP_FILES_DIR "pgsql_tmp" #define PG_TEMP_FILE_PREFIX "pgsql_tmp" Maybe we could move these to file_utils.h instead. WDYT? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com