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 1kPRRP-0007Dz-6P for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2020 14:26:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kPRRO-0005we-45 for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2020 14:26:14 +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 1kPRRN-0005wX-T7 for pgsql-hackers@lists.postgresql.org; Mon, 05 Oct 2020 14:26:13 +0000 Received: from [64.147.123.20] (helo=wout4-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPRRI-0004Sz-PZ for pgsql-hackers@lists.postgresql.org; Mon, 05 Oct 2020 14:26:12 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id CDDFAF58; Mon, 5 Oct 2020 10:25:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 05 Oct 2020 10:25:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=aDVVJoufaPPz2z6GO 1FB2OS8yk1bv9xNzgL1hE8q8UY=; b=fAQsTUFUMu30KbXXd/qy6TYQrvtmpJFn6 gGCMPsPPmWB1HkBrqVUWRCnrSFbGvxZWZxh14AE0YaA7Q3WKkIB/mfJn8SFe50Kx fFV0kgCaeD/8LO2/RIVP7+edqEmwMEE5x0gO+BRmF7e70w+T0RxPqX/fe6AiPFID 3WuZsyuXtOb/h2gB9mIyM6E9RDSTAWzRISjk868Mn4LdxuyLPpQ5aT52R7gFckST lkI+/8gg8Fw6ChL/tc0jZZH92tbbdsFNOTxfp7y0gGwn8pE1xteR0Y8xXBRLToAC o9eIJdnpEdp4uLw2aurW+hQzRmcSqaHCZ16kIqKDxHKPwGqrLYm/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrgedvgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtuggjfgesthdtredttdervdenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepkeejhfehgedufffhleejtdejffekvdduheefvedvffekueel vdffffduveevleetnecukfhppeduledtrdelhedrudelrddugeeknecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.148]) by mail.messagingengine.com (Postfix) with ESMTPA id 91D7A3064686; Mon, 5 Oct 2020 10:25:54 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E071A2A0C97; Mon, 5 Oct 2020 11:25:51 -0300 (-03) Date: Mon, 5 Oct 2020 11:25:51 -0300 From: =?iso-8859-1?Q?=C1lvaro?= Herrera To: Heikki Linnakangas Cc: Daniel Gustafsson , Justin Pryzby , Robert Haas , Magnus Hagander , Michael Paquier , Andres Freund , Tomas Vondra , pgsql-hackers@lists.postgresql.org Subject: Re: Online checksums patch - once again Message-ID: <20201005142551.GA9146@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.20 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Oct-05, Heikki Linnakangas wrote: > The code in sendFile() in basebackup.c seems suspicious in that regard. It > calls DataChecksumsNeedVerify() once before starting to read the file. Isn't > it possible for the checksums flag to change while it's reading the file and > sending it to the client? I hope there are CHECK_FOR_INTERRUPTS() calls > buried somewhere in the loop, because it could take minutes to send the > whole file. > > I would feel better if the state transition of the "checksums" flag could > only happen in a few safe places, or there were some other safeguards for > this. I think that's what Andres was trying to say earlier in the thread on > ProcSignalBarriers. I'm not sure what the interface to that should be. It > could be something like HOLD/RESUME_INTERRUPTS(), where normally all > procsignals are handled on CHECK_FOR_INTERRUPTS(), but you could "hold off" > some if needed. Or something else. Or maybe we can just use > HOLD/RESUME_INTERRUPTS() for this. It's more coarse-grained than necessary, > but probably doesn't matter in practice. I hope you're not suggesting that interrupts would be held for the whole transmission of a file, which you say could take minutes. If we do have an interrupt holdoff, then it has to be pretty short; users (and systemd) despair if service shutdown is delayed more than a few seconds.