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 1jRKit-00062B-Ib for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2020 19:07:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRKis-0001Ue-GA for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2020 19:07:50 +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 1jRKis-0001UX-1y for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2020 19:07:50 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jRKik-0003KG-He for pgsql-hackers@postgresql.org; Wed, 22 Apr 2020 19:07:49 +0000 Received: by mail-qt1-x843.google.com with SMTP id 92so2674809qtg.0 for ; Wed, 22 Apr 2020 12:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=JNdiAGfxvt3AgOBehPOMpfG7AgUBsdAdNz6Fax7Jw5c=; b=OJWTM3fgDixX76X857S2WgEhOzl2BpIhiCb4rEvhSKwBgCDtUSjLepujbnN0gMSuDM dLdWb3ogN/E1SSXi1a03c58bKTbX8xCiGczkLskTnOOMCokYlUtaQsF212AsFrbRrVPp OazPsWzVvtcOZ2JZ3KbfI9bJk/BLH+t8K/bUu+MKFIrjHyzivBLcR3d+maLJOR2PUBTg dgLZCmn7qLVNwkE3HM1Np2l7dUnj/7pcsWmkolNdsEatfwDiQUzIRpRGav/aSRVT1vIO Y2NLSQq1S7yuJ/g4cYSy3nvrhh5TkGYDQvJkyCZQQkRIYqcA7NINCA5yo8lXGLwSYGW5 oR4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=JNdiAGfxvt3AgOBehPOMpfG7AgUBsdAdNz6Fax7Jw5c=; b=uinh2r8KEEDyfoEPduYQmT/0FTJ7ZoDwh/ihv3QEySqQLnqbXFweH1NRfNLXODMLmB z4u7vaxxbpa3npHihdj0H3nOoxr068O9JSQtgGs47iw14oF+itqqST8UZDzXsqWcFeEd uXiyuJVIiw94dzcEugexQp7tmOvW67U777E4cfh0gWL1xTIu7G2zHGJnRMRAMVM+GRud kLXFES9wrfDFp12wR3+v0XOXyYsoKTzXJcrv7Jx+Y1vG1m2VrZlOY3biBnH3BNxrOyQm qcV6NNbLlvVPJHiFtrzuEOq0N5Tp5djdXxX1fgstiTLJwjunGTrmJynxy5eoS3zG7I0E 4/mw== X-Gm-Message-State: AGi0Pubo9FIPk3rPvK9+nwlpYBWiaLBvXbGnGq8bmjql1MH7ryw7j2yY 6Y8uLWy5M/7lJRk07HjY6lpd5Q== X-Google-Smtp-Source: APiQypJbJabRUUdd49jwJJa5Yg6fm9akvLeOexjalHdsgyQUpGQios18PyekcsK1tBzPyZQP9AQvjA== X-Received: by 2002:ac8:16e4:: with SMTP id y33mr149132qtk.4.1587582460976; Wed, 22 Apr 2020 12:07:40 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id x8sm78569qti.51.2020.04.22.12.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 12:07:40 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 67FDD30142C; Wed, 22 Apr 2020 15:07:38 -0400 (-04) Date: Wed, 22 Apr 2020 15:07:38 -0400 From: Alvaro Herrera To: Andres Freund Cc: Antonin Houska , Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: 2pc leaks fds Message-ID: <20200422190738.GA22207@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200422183031.rpz7mziiyd5zvjad@alap3.anarazel.de> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Apr-22, Andres Freund wrote: > On 2020-04-22 13:57:54 -0400, Alvaro Herrera wrote: > > Concretely, I propose to have a new struct like > > > > typedef struct xlogReaderFuncs > > { > > XLogPageReadCB read_page; > > XLogSegmentOpenCB open_segment; > > XLogSegmentCloseCB open_segment; > > } xlogReaderFuncs; > > > > #define XLOGREADER_FUNCS(...) &(xlogReaderFuncs){__VA_ARGS__} > > Not sure I quite see the point of that helper macro... Avoid the ugly cast -- same discussion we had for ARCHIVE_OPTS in pg_dump code in commit f831d4accda0. > ISTM that we should: > - have the three callbacks you mention above > - change WALSegmentOpen to also get the XLogReaderState > - add private state to WALOpenSegment, so it can be used even when not > accessing data in files / when one needs more information to close the > file. > - disambiguate between WALOpenSegment (struct describing an open > segment) and WALSegmentOpen (callback to open a segment) (note that > the read page callback uses a *CB naming, why not follow?) Sounds good. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services