Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events
Date: 2025-08-07 16:35:29
Message-ID: 87ldnvgkdq.fsf@wibble.ilmari.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> writes:

> From 50257bf32eb2b0972e5139ac4a79367372c77385 Mon Sep 17 00:00:00 2001
> From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
> Date: Wed, 5 Mar 2025 15:04:34 -0800
> Subject: [PATCH v3 5/5] oauth: Add unit tests for multiplexer handling

I haven't read the meat of the patch, but I have some comments on the
tests:

> +IPC::Run::run ['oauth_tests'],
> + '>', IPC::Run::new_chunker, sub { print {$out} $_[0] },
> + '2>', IPC::Run::new_chunker, sub { print {$err} $_[0] }
> + or die "oauth_tests returned $?";

We've recently switched to using fat commas (=>) between options and
their arguments, and that includes the file redirections in IPC::Run.
Although not semantically meaningful, I'd also be tempted to put parens
around the argument list for each redirect, so it's clear that they go
together.

Also, indirect object syntax (print {$fh} ...) is ugly and
old-fashioned, it's nicer to call it as a method on the filehandle.

So I'd write the above as:

IPC::Run::run ['oauth_tests'],
'>' => (IPC::Run::new_chunker, sub { $out->print($_[0]) }),
'2>' => (IPC::Run::new_chunker, sub { $err->print($_[0]) })
or die "oauth_tests returned $?";

As for the C TAP tests, there's already a bunch of TAP-outputting
infrastructure in pg_regress.c. Would it make sense to factor that out
into a common library?

- ilmari

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-08-07 16:36:24 Re: VM corruption on standby
Previous Message Andrey Borodin 2025-08-07 16:00:35 Re: VM corruption on standby