From 02844012b304ba80d1c48d51f6fe10bb622490cc Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 17 Mar 2025 18:51:33 -0400 Subject: aio: Basic subsystem initialization This commit just does the minimal wiring up of the AIO subsystem, added in the next commit, to the rest of the system. The next commit contains more details about motivation and architecture. This commit is kept separate to make it easier to review, separating the changes across the tree, from the implementation of the new subsystem. We discussed squashing this commit with the main commit before merging AIO, but there has been a mild preference for keeping it separate. Reviewed-by: Heikki Linnakangas Reviewed-by: Noah Misch Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt --- src/backend/postmaster/autovacuum.c | 2 ++ src/backend/postmaster/bgwriter.c | 2 ++ src/backend/postmaster/checkpointer.c | 2 ++ src/backend/postmaster/pgarch.c | 2 ++ src/backend/postmaster/walsummarizer.c | 2 ++ src/backend/postmaster/walwriter.c | 2 ++ 6 files changed, 12 insertions(+) (limited to 'src/backend/postmaster') diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 71c34027c88..2513a8ef8a6 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -88,6 +88,7 @@ #include "postmaster/autovacuum.h" #include "postmaster/interrupt.h" #include "postmaster/postmaster.h" +#include "storage/aio_subsys.h" #include "storage/bufmgr.h" #include "storage/ipc.h" #include "storage/latch.h" @@ -465,6 +466,7 @@ AutoVacLauncherMain(const void *startup_data, size_t startup_data_len) */ LWLockReleaseAll(); pgstat_report_wait_end(); + pgaio_error_cleanup(); UnlockBuffers(); /* this is probably dead code, but let's be safe: */ if (AuxProcessResourceOwner) diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index a688cc5d2a1..72f5acceec7 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -38,6 +38,7 @@ #include "postmaster/auxprocess.h" #include "postmaster/bgwriter.h" #include "postmaster/interrupt.h" +#include "storage/aio_subsys.h" #include "storage/buf_internals.h" #include "storage/bufmgr.h" #include "storage/condition_variable.h" @@ -168,6 +169,7 @@ BackgroundWriterMain(const void *startup_data, size_t startup_data_len) */ LWLockReleaseAll(); ConditionVariableCancelSleep(); + pgaio_error_cleanup(); UnlockBuffers(); ReleaseAuxProcessResources(false); AtEOXact_Buffers(false); diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index 0e228d143a0..fda91ffd1ce 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -49,6 +49,7 @@ #include "postmaster/bgwriter.h" #include "postmaster/interrupt.h" #include "replication/syncrep.h" +#include "storage/aio_subsys.h" #include "storage/bufmgr.h" #include "storage/condition_variable.h" #include "storage/fd.h" @@ -276,6 +277,7 @@ CheckpointerMain(const void *startup_data, size_t startup_data_len) LWLockReleaseAll(); ConditionVariableCancelSleep(); pgstat_report_wait_end(); + pgaio_error_cleanup(); UnlockBuffers(); ReleaseAuxProcessResources(false); AtEOXact_Buffers(false); diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index dbe4e1d426b..7e622ae4bd2 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -40,6 +40,7 @@ #include "postmaster/interrupt.h" #include "postmaster/pgarch.h" #include "storage/condition_variable.h" +#include "storage/aio_subsys.h" #include "storage/fd.h" #include "storage/ipc.h" #include "storage/latch.h" @@ -568,6 +569,7 @@ pgarch_archiveXlog(char *xlog) LWLockReleaseAll(); ConditionVariableCancelSleep(); pgstat_report_wait_end(); + pgaio_error_cleanup(); ReleaseAuxProcessResources(false); AtEOXact_Files(false); AtEOXact_HashTables(false); diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c index ccba0f84e6e..0fec4f1f871 100644 --- a/src/backend/postmaster/walsummarizer.c +++ b/src/backend/postmaster/walsummarizer.c @@ -38,6 +38,7 @@ #include "postmaster/interrupt.h" #include "postmaster/walsummarizer.h" #include "replication/walreceiver.h" +#include "storage/aio_subsys.h" #include "storage/fd.h" #include "storage/ipc.h" #include "storage/latch.h" @@ -289,6 +290,7 @@ WalSummarizerMain(const void *startup_data, size_t startup_data_len) LWLockReleaseAll(); ConditionVariableCancelSleep(); pgstat_report_wait_end(); + pgaio_error_cleanup(); ReleaseAuxProcessResources(false); AtEOXact_Files(false); AtEOXact_HashTables(false); diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index 0380601bcbb..fd92c8b7a33 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -51,6 +51,7 @@ #include "postmaster/auxprocess.h" #include "postmaster/interrupt.h" #include "postmaster/walwriter.h" +#include "storage/aio_subsys.h" #include "storage/bufmgr.h" #include "storage/condition_variable.h" #include "storage/fd.h" @@ -164,6 +165,7 @@ WalWriterMain(const void *startup_data, size_t startup_data_len) LWLockReleaseAll(); ConditionVariableCancelSleep(); pgstat_report_wait_end(); + pgaio_error_cleanup(); UnlockBuffers(); ReleaseAuxProcessResources(false); AtEOXact_Buffers(false); -- cgit v1.2.3