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 1qt78x-00AtoN-Dr for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Oct 2023 14:03:27 +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 1qt78v-004JBq-8F for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Oct 2023 14:03:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qt78u-004JBZ-VA for pgsql-hackers@lists.postgresql.org; Wed, 18 Oct 2023 14:03:25 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qt78r-001N7P-4k for pgsql-hackers@postgresql.org; Wed, 18 Oct 2023 14:03:25 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3af603da0f0so4499788b6e.3 for ; Wed, 18 Oct 2023 07:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697637800; x=1698242600; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ARHhcON0F2+rbvdzKC8XlhK3EFP688OSOQuiA9V+VO4=; b=TZKnjPbroSXY9aKjez5L3PVSbBTG9CyfFKrnrlo7xIYcNbRgNkYYWqDdgMgCcYPZbC C10uCYojMhBkFfxPZji8rAkDPRkTsq3piuOWv6ZbUJkUYTsW/6ZFbq47Za34Q9/0cZgs HrSzCNxtYw6byAr0sRAc6wNRXJHT+uMghUfZXw3oBujNJ/B1keRXqopldDfsEv8IaPPX BFyLiMZKBD0lbiiVStbqTsd05ASz/DsbiC1EIfEIF54oUj+InoCN0ngcNgDAcknoLUXX RBbUqFjRh7/9RSUPlS046d1YTzrpllML2UcsHc/FbjnrjM3smaXLEopR9RgnSpIcbpnX FtoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697637800; x=1698242600; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ARHhcON0F2+rbvdzKC8XlhK3EFP688OSOQuiA9V+VO4=; b=qeS4IrGVgNDlNaF1Cpb1g0+Ibb0XXi5LlypYZFznuzKSY8BXPfeo066U2v/0G3ZJXM IvdjmB25RCTWEbkdJSWofWkA5427b6OMTy5FnFkqoBZ3BtukbbBAoGplb8IxXUoIJ4K0 bZtTaBCgir5Ac8VPwjCi3aevuY3OxkJdDTzDtx4fzCV/8mX5CZqKC3Fln9sqQSTr3qYe 6qwelce8uDDXJamc4Xgq6dxTrXrFrEKusg5mMOlfGgv2QNx79ehTZSVj47sHuRyjjSy7 DhvbWA5nNeRDlcvRBpeZ6uomLBWIxI80HurQfGfSk7M+jXK5Yxo+g5Kfh+ZysBjqcPTh 59EQ== X-Gm-Message-State: AOJu0YziKPcFVwfYVtZBbCJgfUJ6FGtwpz1rW3elYZPjSwhkK0E8MMqz qGu7Rr306sbMJp613jog4tcdhpRStkF7DJWt7Ks= X-Google-Smtp-Source: AGHT+IFkRbI67WHyirCoPKh9JOcGTGGbzB6Fc4AYWc6tbzWy2+c7fwDY3Jz9EX/gTXNaiS4Qrckt5PW1BqEQp2w+IdI= X-Received: by 2002:a05:6808:1413:b0:3a7:aabc:738f with SMTP id w19-20020a056808141300b003a7aabc738fmr6377323oiv.39.1697637800243; Wed, 18 Oct 2023 07:03:20 -0700 (PDT) MIME-Version: 1.0 References: <4f3038c7-2b37-2625-c4c6-ebf7cbcb076d@dunslane.net> <05341dc0-a5c3-f631-35e3-54235cfed774@dunslane.net> In-Reply-To: <05341dc0-a5c3-f631-35e3-54235cfed774@dunslane.net> From: Robert Haas Date: Wed, 18 Oct 2023 10:03:06 -0400 Message-ID: Subject: Re: Query execution in Perl TAP tests needs work To: Andrew Dunstan Cc: Thomas Munro , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Sep 2, 2023 at 2:42=E2=80=AFPM Andrew Dunstan = wrote: > I confess I'm a little reluctant to impose this burden on buildfarm owner= s. We should think about some sort of fallback in case this isn't supported= on some platform, either due to technological barriers or buildfarm owner = reluctance. How much burden is it? Would anyone actually mind? I definitely don't want to put ourselves in a situation where we add a bunch of annoying dependencies that are required to be able to run the tests, not just because it will inconvenience buildfarm owners, but also because it will potentially inconvenience developers, and in particular, me. At the same time, fallbacks can be a problem too, because then you can end up with things that work one way on one developer's machine (or BF machine) and another way on another developer's machine (or BF machine) and it's not obvious that the reason for the difference is that one machine is using a fallback and the other is not. I feel like this tends to create so much aggravation in practice that it's best not to have fallbacks in this kind of situation - my vote is that we either stick with the current method and live with the performance characteristics thereof, or we put in place something that is faster and better and that new thing becomes a hard dependency for anyone who wants to be able to run the TAP tests. In terms of what that faster and better thing might be, AFAICS, there are two main options. First, we could proceed with the approach you've tried here, namely requiring everybody to get Platypus::FFI. I find that it's included in MacPorts on my machine, which is at least somewhat of a good sign that perhaps this is fairly widely available. That might need more investigation, though. Second, we could write a pure-Perl implementation, as you proposed earlier. That would be more work to write and maintain, but would avoid needing FFI. Personally, I feel like either an FFI-based approach or a pure-Perl approach would be pretty reasonable, as long as Platypus::FFI is widely available/usable. If we go with pure Perl, the hard part might be managing the authentication methods, but as Thomas pointed out to me yesterday, we now have UNIX sockets on Windows, and thus everywhere, so maybe we could get to a point where the pure-Perl implementation wouldn't need to do any non-trivial authentication. Another thing, also already mentioned, that we can do is cache psql connections instead of continuously respawing psql. That doesn't require any fundamentally new mechanism, and in some sense it's independent of the approaches above, because they could be implemented without caching connections, but they would benefit from caching connections, as the currently psql-based approach also does. I think it would be good to introduce new syntax for this, e.g.: $conn_primary =3D $node_primary->connect(); $conn_primary->simple_query('whatever'); $conn_primary->simple_query('whatever 2'); $conn_primary->disconnect(); Something like this would require a fairly large amount of mechanical work to implement across all of our TAP test cases, but I think it would be effort well spent. If we try to introduce connection caching "transparently," I think it will turn into another foot-gun that people keep getting wrong because they don't realize there is magic under the hood, or forget how it works. --=20 Robert Haas EDB: http://www.enterprisedb.com