Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08ccd56

Browse files
committed
aio, bufmgr: Comment fixes/improvements
Some of these comments have been wrong for a while (12f3867), some Irecently introduced (da72269,55b454d). This includes an update to acomment in FlushBuffer(), which will be copied in a future commit.These changes seem big enough to be worth doing in separate commits.Suggested-by: Noah Misch <noah@leadboat.com>Discussion:https://postgr.es/m/20250319212530.80.nmisch@google.com
1 parent50cb750 commit08ccd56

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4401,7 +4401,7 @@ maybe_adjust_io_workers(void)
44014401
++io_worker_count;
44024402
}
44034403
else
4404-
break;/*XXXtry againsoon? */
4404+
break;/* try againnext time */
44054405
}
44064406

44074407
/* Too many running? */

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,9 +3929,10 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln, IOObject io_object,
39293929
XLogFlush(recptr);
39303930

39313931
/*
3932-
* Now it's safe to write buffer to disk. Note that no one else should
3933-
* have been able to write it while we were busy with log flushing because
3934-
* only one process at a time can set the BM_IO_IN_PROGRESS bit.
3932+
* Now it's safe to write the buffer to disk. Note that no one else should
3933+
* have been able to write it, while we were busy with log flushing,
3934+
* because we got the exclusive right to perform I/O by setting the
3935+
* BM_IO_IN_PROGRESS bit.
39353936
*/
39363937
bufBlock=BufHdrGetBlock(buf);
39373938

@@ -5499,9 +5500,6 @@ IsBufferCleanupOK(Buffer buffer)
54995500
/*
55005501
*Functions for buffer I/O handling
55015502
*
5502-
*Note: We assume that nested buffer I/O never occurs.
5503-
*i.e at most one BM_IO_IN_PROGRESS bit is set per proc.
5504-
*
55055503
*Also note that these are used only for shared buffers, not local ones.
55065504
*/
55075505

‎src/include/storage/aio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ typedef enum PgAioHandleFlags
8080
/*
8181
* The IO operations supported by the AIO subsystem.
8282
*
83-
* This could be in aio_internal.h, as it is notpubicly referenced, but
83+
* This could be in aio_internal.h, as it is notpublicly referenced, but
8484
* PgAioOpData currently *does* need to be public, therefore keeping this
8585
* public seems to make sense.
8686
*/

‎src/include/storage/aio_internal.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
* linearly through all states.
3535
*
3636
* State changes should all go through pgaio_io_update_state().
37+
*
38+
* Note that the externally visible functions to start IO
39+
* (e.g. FileStartReadV(), via pgaio_io_start_readv()) move an IO from
40+
* PGAIO_HS_HANDED_OUT to at least PGAIO_HS_STAGED and at most
41+
* PGAIO_HS_COMPLETED_LOCAL (at which point the handle will be reused).
3742
*/
3843
typedefenumPgAioHandleState
3944
{
@@ -285,6 +290,9 @@ typedef struct IoMethodOps
285290
/*
286291
* Start executing passed in IOs.
287292
*
293+
* Shall advance state to at least PGAIO_HS_SUBMITTED. (By the time this
294+
* returns, other backends might have advanced the state further.)
295+
*
288296
* Will not be called if ->needs_synchronous_execution() returned true.
289297
*
290298
* num_staged_ios is <= PGAIO_SUBMIT_BATCH_SIZE.
@@ -293,12 +301,24 @@ typedef struct IoMethodOps
293301
*/
294302
int(*submit) (uint16num_staged_ios,PgAioHandle**staged_ios);
295303

296-
/*
304+
/* ---
297305
* Wait for the IO to complete. Optional.
298306
*
307+
* On return, state shall be on of
308+
* - PGAIO_HS_COMPLETED_IO
309+
* - PGAIO_HS_COMPLETED_SHARED
310+
* - PGAIO_HS_COMPLETED_LOCAL
311+
*
312+
* The callback must not block if the handle is already in one of those
313+
* states, or has been reused (see pgaio_io_was_recycled()). If, on
314+
* return, the state is PGAIO_HS_COMPLETED_IO, state will reach
315+
* PGAIO_HS_COMPLETED_SHARED without further intervention by the IO
316+
* method.
317+
*
299318
* If not provided, it needs to be guaranteed that the IO method calls
300319
* pgaio_io_process_completion() without further interaction by the
301320
* issuing backend.
321+
* ---
302322
*/
303323
void(*wait_one) (PgAioHandle*ioh,
304324
uint64ref_generation);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp