From d10cc26904174ec6b85ae3a284218a24e1582885 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 26 Mar 2025 14:33:09 -0400 Subject: [PATCH v2.13 06/28] 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. --- src/include/storage/aio_types.h | 9 +++++---- src/backend/storage/aio/aio.c | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/include/storage/aio_types.h b/src/include/storage/aio_types.h index debe8163d4e..9db5d776b61 100644 --- a/src/include/storage/aio_types.h +++ b/src/include/storage/aio_types.h @@ -79,8 +79,9 @@ typedef enum PgAioResultStatus { PGAIO_RS_UNKNOWN, /* not yet completed / uninitialized */ PGAIO_RS_OK, - PGAIO_RS_PARTIAL, /* did not fully succeed, but no error */ - PGAIO_RS_ERROR, + PGAIO_RS_PARTIAL, /* did not fully succeed, no warning/error */ + PGAIO_RS_WARNING, /* [partially] succeeded, with a warning */ + PGAIO_RS_ERROR, /* failed entirely */ } PgAioResultStatus; @@ -96,10 +97,10 @@ typedef struct PgAioResult uint32 id:8; /* of type PgAioResultStatus, see above */ - uint32 status:2; + uint32 status:3; /* meaning defined by callback->error */ - uint32 error_data:22; + uint32 error_data:21; int32 result; } PgAioResult; diff --git a/src/backend/storage/aio/aio.c b/src/backend/storage/aio/aio.c index 91e76113412..e3ed087e8a2 100644 --- a/src/backend/storage/aio/aio.c +++ b/src/backend/storage/aio/aio.c @@ -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: -- 2.48.1.76.g4e746b1a31.dirty