Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j6IUU-000086-RE for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2020 18:30:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6IUS-0004jO-Nx for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2020 18:30:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6IUS-0004jG-9z for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2020 18:30:00 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j6IUO-0004Cx-De for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2020 18:29:59 +0000 Received: by mail-pf1-x443.google.com with SMTP id x185so5778210pfc.5 for ; Mon, 24 Feb 2020 10:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AYVmn2LAjzBgRvOkFFxGYL+TUrY60LelkOcm2oE1hpg=; b=SWpc8ecM92I28xwFZHdZncJ/TNnIv8EDbH79Rm8rrEUVvVXZ0Z/S8ATboPd1LTtUbL 1ZkCy/1g85krr1ByfbyTMm0klqqEBllKwZDDdKYQ/1hNuoKWv3tzl3ZdTyVQcG1Ts7Mi ejuXeeNBgUW+mMLZhPEwXa0+bAwJfEtPF79sWFFjSCbiwnWvvCwGSXAIerYD0Xg4yS4f GcDyyL01WEU5YkQRsMeObzZAod0o/EH0zg1GvEwl0FkgVKod2UK+1e14rRq6Xoxoy/Fv LnlUHmBSL944YQdM1Zj8UDSUEB2uk5AuBsFOUU9r+FbgagAminSqwa5faUDSbvRMcVu5 n2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AYVmn2LAjzBgRvOkFFxGYL+TUrY60LelkOcm2oE1hpg=; b=Ti+u4ZJZyIxV84S+N5QE1laHdVfAQfyONRTVdBwhDuxJqJ6TPxJ9eZucPNBzTM4YeC 7/8D8a//RC5yvK68vp0kvZvLC6hq3+BWVg/8hl7Ak4OgehKTVpyv2MLe5XxETiRzHUDi ifhYO2E+WT3EFXgeuf07uV76v4/gaQ8zPG8ozBIQMCRIBCXnu2YGF51AGMPTY2Jj03qc wQ89ZH6voEgFg8inMyP5RsQru+eER4+KXOW7FcYqjZX3Uj7kDEASSt0WQjVEKv4r7eV4 oGu07X68+S8fIEz1plcKjYXtdhWS5ZutcJs+7mXBK8dXsBRpe8sV2No561SIzS92O5Gh PvwA== X-Gm-Message-State: APjAAAVwkHU5AwpmK+cg6irR7fdxr3tR5I0Yq2Q5GbYFx1M7Yg8B2he2 qeFW1C+FyFAwIie8N8V/ciBgHWbu9UWjYZyxEEKPP97EhVKhp5ubm1GuVnCQ+VYCUSNE4bERv6n pi+0w0kwCrqX1kSVi4F/ttlr7RqtIKGA6pmJn/CS4q7Pgxap2matqVJkn/wINhLvxNJKLNNkuPz YFcFKn6wZ9T/1AkEVZGXkuY76q+049OYRKALqombhsVVXoqg== X-Google-Smtp-Source: APXvYqyVTffN2XpV5BNIMLk2YqD+0293ZRzGj4x9DrzgAkN/JhHkeM6xyQT9pque3dB7yLyZh/lQ+w== X-Received: by 2002:a63:8149:: with SMTP id t70mr55319218pgd.215.1582568993466; Mon, 24 Feb 2020 10:29:53 -0800 (PST) Received: from [192.168.0.29] (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id c26sm13572439pfi.46.2020.02.24.10.29.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Feb 2020 10:29:52 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: pgsql: Add kqueue(2) support to the WaitEventSet API. From: Mark Dilger In-Reply-To: <18091.1582259407@sss.pgh.pa.us> Date: Mon, 24 Feb 2020 10:29:51 -0800 Cc: Thomas Munro , =?utf-8?Q?R=C3=A9mi_Zara?= , Michael Paquier , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <13F92C31-0E60-45C9-9031-3B1ECFDD5261@enterprisedb.com> References: <20200220072435.GM2288@paquier.xyz> <08364CCB-07F5-423E-8CE0-ABF0195C4CA2@mac.com> <17106.1582224047@sss.pgh.pa.us> <19710.1582227844@sss.pgh.pa.us> <20263.1582228617@sss.pgh.pa.us> <26174.1582236314@sss.pgh.pa.us> <6610.1582242943@sss.pgh.pa.us> <18091.1582259407@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3608.60.0.2.5) X-CLOUD-SEC-AV-Info: edb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Feb 20, 2020, at 8:30 PM, Tom Lane wrote: >=20 > This idea doesn't fix every possible problem. For instance, if you > have a plperlu function that wants to open a bunch of files, I don't > see any easy way to ensure we release VFDs to make that possible. > But it's sure an improvement on the status quo. I understand that you were using plperlu just as an example, but it got = me thinking. Could we ship a wrapper using perl's tie() mechanism to = call a new spi function to report when a file handle is opened and when = it is closed? Most plperlu functions would not participate, since = developers will not necessarily know to use the wrapper, but at least = they could learn about the wrapper and use it as a work-around if this = becomes a problem for them. Perhaps the same spi function could be used = by other procedural languages. I can't see this solution working unless the backend can cleanup = properly under exceptional conditions, and decrement the counter of used = file handles appropriately. But that's the same requirement that = postgres_fdw would also have, right? Would the same mechanism work for = both? I imagine something like ::IO::File and = ::File::Temp which could be thin wrappers around IO::File = and File::Temp that automatically do the tie()ing for you. (Replace = with whichever name seems best.) Is this too convoluted to be worth the bother? =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company