diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-11-01 13:47:20 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-11-01 13:47:20 +0200 |
commit | a9c546a5a3783810a1b665f246fc6d0a596d0606 (patch) | |
tree | 24dd96745733f9a63f0a68d7c19773e64fa6a81d /src/backend/postmaster/checkpointer.c | |
parent | e819bbb7c82ac048ffd865ba3f2d2c4933923c77 (diff) |
Use ProcNumbers instead of direct Latch pointers to address other procs
This is in preparation for replacing Latches with a new abstraction.
That's still work in progress, but this seems a little tidier anyway,
so let's get this refactoring out of the way already.
Discussion: https://www.postgresql.org/message-id/391abe21-413e-4d91-a650-b663af49500c%40iki.fi
Diffstat (limited to 'src/backend/postmaster/checkpointer.c')
-rw-r--r-- | src/backend/postmaster/checkpointer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index 9087e3f8db1..982572a75db 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -324,10 +324,10 @@ CheckpointerMain(char *startup_data, size_t startup_data_len) UpdateSharedMemoryConfig(); /* - * Advertise our latch that backends can use to wake us up while we're - * sleeping. + * Advertise our proc number that backends can use to wake us up while + * we're sleeping. */ - ProcGlobal->checkpointerLatch = &MyProc->procLatch; + ProcGlobal->checkpointerProc = MyProcNumber; /* * Loop forever @@ -1139,8 +1139,14 @@ ForwardSyncRequest(const FileTag *ftag, SyncRequestType type) LWLockRelease(CheckpointerCommLock); /* ... but not till after we release the lock */ - if (too_full && ProcGlobal->checkpointerLatch) - SetLatch(ProcGlobal->checkpointerLatch); + if (too_full) + { + volatile PROC_HDR *procglobal = ProcGlobal; + ProcNumber checkpointerProc = procglobal->checkpointerProc; + + if (checkpointerProc != INVALID_PROC_NUMBER) + SetLatch(&GetPGProcByNumber(checkpointerProc)->procLatch); + } return true; } |