1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

aio: Fix assertion, clarify README

The assertion wouldn't have triggered for a long while yet, but this won't
accidentally fail to detect the issue if/when it occurs.

Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAEze2Wj-43JV4YufW23gm=Uwr7Lkj+p0yKctKHxNm1rwFC+_DQ@mail.gmail.com
Backpatch-through: 18
This commit is contained in:
Andres Freund
2025-07-22 08:30:52 -04:00
parent ce6513e96a
commit d3f97fd1dd
2 changed files with 4 additions and 3 deletions

View File

@ -94,7 +94,7 @@ pgaio_io_register_callbacks(ioh, PGAIO_HCB_SHARED_BUFFER_READV, 0);
* *
* In this example we're reading only a single buffer, hence the 1. * In this example we're reading only a single buffer, hence the 1.
*/ */
pgaio_io_set_handle_data_32(ioh, (uint32 *) buffer, 1); pgaio_io_set_handle_data_32(ioh, (uint32 *) &buffer, 1);
/* /*
* Pass the AIO handle to lower-level function. When operating on the level of * Pass the AIO handle to lower-level function. When operating on the level of
@ -119,8 +119,9 @@ pgaio_io_set_handle_data_32(ioh, (uint32 *) buffer, 1);
* e.g. due to reaching a limit on the number of unsubmitted IOs, and even * e.g. due to reaching a limit on the number of unsubmitted IOs, and even
* complete before smgrstartreadv() returns. * complete before smgrstartreadv() returns.
*/ */
void *page = BufferGetBlock(buffer);
smgrstartreadv(ioh, operation->smgr, forknum, blkno, smgrstartreadv(ioh, operation->smgr, forknum, blkno,
BufferGetBlock(buffer), 1); &page, 1);
/* /*
* To benefit from AIO, it is beneficial to perform other work, including * To benefit from AIO, it is beneficial to perform other work, including

View File

@ -201,7 +201,7 @@ typedef enum PgAioHandleCallbackID
} PgAioHandleCallbackID; } PgAioHandleCallbackID;
#define PGAIO_HCB_MAX PGAIO_HCB_LOCAL_BUFFER_READV #define PGAIO_HCB_MAX PGAIO_HCB_LOCAL_BUFFER_READV
StaticAssertDecl(PGAIO_HCB_MAX <= (1 << PGAIO_RESULT_ID_BITS), StaticAssertDecl(PGAIO_HCB_MAX < (1 << PGAIO_RESULT_ID_BITS),
"PGAIO_HCB_MAX is too big for PGAIO_RESULT_ID_BITS"); "PGAIO_HCB_MAX is too big for PGAIO_RESULT_ID_BITS");