Re: [PATCH] aio: Refactor to deduplicate shared and local completion callbacks

From: Andres Freund <andres(at)anarazel(dot)de>
To: zengman <zengman(at)halodbtech(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] aio: Refactor to deduplicate shared and local completion callbacks
Date: 2026-01-02 14:25:15
Message-ID: ifyd6ociunkbso6cz7esn66uio2j7lwvlop6ew4vbme25mxz4f@azgegp6id73t
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-01-02 20:51:14 +0800, zengman wrote:
> I've observed that the functions `pgaio_io_call_complete_shared()` and`
> pgaio_io_call_complete_local()` contain nearly identical code, with only
> minor differences in initialization and callback selection. This code
> duplication was previously noted with an XXX comment.

> I propose extracting the common logic into a new internal function
> `pgaio_io_call_complete_internal()`, which uses a boolean parameter to
> distinguish between the two code paths. What do you think of this approach?

It doesn't really seem to improve things sufficiently for my taste. If you
don't remove comments that are actually important, like "Note that we don't
save the result", the code doesn't even get shorter. And it's not like the
function afterwards is more generic, since it encodes all the knowledge about
the different callback kinds.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srirama Kucherlapati 2026-01-02 14:43:00 RE: AIX support
Previous Message Jim Vanns 2026-01-02 14:14:03 Re: [PATCH] Add support for SAOP in the optimizer for partial index paths