On 2026-Feb-25, Maxim Orlov wrote:

> Something of this kind?

Looks vaguely reasonable, without looking too much into the details.
I would prefer to have the callback do the errmsg() directly, so that
SlruReportIOError() can do something like

        case SLRU_OPEN_FAILED:
            ereport(ERROR,
                    (errcode_for_file_access(),
                     SlruCtl->errmsg_for_io_error(whatever),
                     errdetail("Could not open file \"%s\": %m.", path)));
            break;

and the callback is something like

static int
xact_errmsg_for_io_error(const void *opaque_data)
{
   TransactionId xid;

   xid = opaque_data ? (*(TransactionId *) opaque_data) : InvalidTransactionId;
   return errmsg("could not access status of transaction %u", xid);
}

We have various errdetail() routines of this kind.

Alternatively, maybe we could report in errmsg() the file operation that
failed, and the XID details etc as part of an error_context_stack
callback.  The error reporting style we're using here is perhaps not
well adapted to the times.

> Should we start a new thread?

I think so, yeah.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"¿Qué importan los años?  Lo que realmente importa es comprobar que
a fin de cuentas la mejor edad de la vida es estar vivo"  (Mafalda)


Reply via email to