mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
aio: Add WARNING result status
If an IO succeeds, but issues a warning, e.g. due to a page verification failure with zero_damaged_pages, we want to issue that warning in the context of the issuer of the IO, not the process that executes the completion (always the case for worker). It's already possible for a completion callback to report a custom error message, we just didn't have a result status that allowed a user of AIO to know that a warning should be emitted even though the IO request succeeded. All that's needed for that is a dedicated PGAIO_RS_ value. Previously there were not enough bits in PgAioResult.id for the new value. Increase. While at that, add defines for the amount of bits and static asserts to check that the widths are appropriate. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20250329212929.a6.nmisch@google.com
This commit is contained in:
@@ -839,6 +839,8 @@ pgaio_result_status_string(PgAioResultStatus rs)
|
||||
return "UNKNOWN";
|
||||
case PGAIO_RS_OK:
|
||||
return "OK";
|
||||
case PGAIO_RS_WARNING:
|
||||
return "WARNING";
|
||||
case PGAIO_RS_PARTIAL:
|
||||
return "PARTIAL";
|
||||
case PGAIO_RS_ERROR:
|
||||
|
||||
@@ -83,6 +83,7 @@ pgaio_io_register_callbacks(PgAioHandle *ioh, PgAioHandleCallbackID cb_id,
|
||||
{
|
||||
const PgAioHandleCallbacksEntry *ce = &aio_handle_cbs[cb_id];
|
||||
|
||||
Assert(cb_id <= PGAIO_HCB_MAX);
|
||||
if (cb_id >= lengthof(aio_handle_cbs))
|
||||
elog(ERROR, "callback %d is out of range", cb_id);
|
||||
if (aio_handle_cbs[cb_id].cb->complete_shared == NULL &&
|
||||
|
||||
Reference in New Issue
Block a user