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 1jRJdN-0003WF-NH for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2020 17:58:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRJdM-0003Ds-KW for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2020 17:58:04 +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 1jRJdM-0003Dl-Dm for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2020 17:58:04 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jRJdG-0001vy-7h for pgsql-hackers@postgresql.org; Wed, 22 Apr 2020 17:58:03 +0000 Received: by mail-qt1-x842.google.com with SMTP id w29so2436494qtv.3 for ; Wed, 22 Apr 2020 10:57:58 -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=0NdyBgYkJCzyAIT3yQ2zXfmSN0ItTQpBcoWt35GXgSY=; b=MPrS/xR7jrTK6CJMz2y9c5E/exCgerj1saifYHhW7ux11QGU8V5LGWiC4T25ziybDW AWfTRQnXK6p42xBkEqYZnJgt+O3ul4ojunj2vM2hnRbrEFNpq74uROmlSzSElHKAQ7d5 M4Y0+mEoh1aldAI+9MH53WsbJ0Tr3mCj22CJ3eeeRwmWVFKZEN1h3IO1kdgHm5lpHISt AJtJfYrz1EV2ju5AEo4pWXwT/4OBGUnV6sC29F9STVe+UZIeFfiEUTZV4CroMmmGvk+Q nRTpniuH5pW19akcKVr0saw8uEimuuRNROWdizWBaDjbCgzyyKSel1KUhp0BMq/UHvqy KtFg== 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=0NdyBgYkJCzyAIT3yQ2zXfmSN0ItTQpBcoWt35GXgSY=; b=UPo2jQd5JCZ+5dVcgwrFEAsFDZl9quSH0EZKdWZLlYAPPBlT1VWcHOYbQNa+5lSa5Y Ua2QyL0YTYoaymrWojwQhuZwm6K590YxIeTsAepKOfIN7paHPuOGCE5J9KGNmnShZJu6 XyXfiDqtGQDJoLNqZmHliz2Nu62j+7Edr0GwVkSUVnnidx6uPHliu+g25UtvXrMq5HYs 02YEHGlmC851k/Dj9t7uJJ9T58aWOWZ0fMtbA2oFxbK2LsXHarjVnw7CTpy2K4eWIuz7 uqdbXAkLJxdhjAMhNQbU+v1kAHn1V7hVmzAULvrHMW61F0V/9aeN2NsrgX46n8SXI1N5 6D8g== X-Gm-Message-State: AGi0PubwqpjRmStmzskT0ZzYuvdSzrUwfN6ds7Wi3+szrSBv8VLLnBiY 889kSZjrvOObGuo2QPvtuv2pMV58Hs88yA== X-Google-Smtp-Source: APiQypLTQGTJ8iTGMhYSz0iXpSp85pV1XVzjRMerY6kNwJ5XXQy4BdRWT9Q+X7ACqxF4Sd0JCuiTmw== X-Received: by 2002:ac8:7581:: with SMTP id s1mr14069547qtq.77.1587578277382; Wed, 22 Apr 2020 10:57:57 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id o33sm4590978qtj.62.2020.04.22.10.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 10:57:56 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 5600930142C; Wed, 22 Apr 2020 13:57:54 -0400 (-04) Date: Wed, 22 Apr 2020 13:57:54 -0400 From: Alvaro Herrera To: Antonin Houska Cc: Andres Freund , Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: 2pc leaks fds Message-ID: <20200422175754.GA19858@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200421235422.GA28667@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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__} and then invoke it something like xlogreader = XLogReaderAllocate(wal_segment_size, NULL, XLOGREADER_FUNCS(.readpage = &read_local_xlog_page, .opensegment = &wal_segment_open), .closesegment = &wal_segment_close), NULL); (with suitable definitions for XLogSegmentOpenCB etc) so that the support functions are all available at the xlogreader level, instead of "open" being buried at the read-page level. Any additional support functions can be added easily. This would give xlogreader a simpler interface. If people like this, I could make this change for pg13 and avoid changing the API again in pg14. Thougths? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services