diff options
| author | Nathan Bossart | 2023-11-15 19:42:30 +0000 |
|---|---|---|
| committer | Nathan Bossart | 2023-11-15 19:42:30 +0000 |
| commit | 6a72c42fd5af7ada49584694f543eb06dddb4a87 (patch) | |
| tree | c2f566a161756b8aca8a58d58d4b0a0b6ee08da7 /src/backend/postmaster | |
| parent | 83267b15bf0dffa6e1096608bda95b8488048bb9 (diff) | |
Retire MemoryContextResetAndDeleteChildren() macro.
As of commit eaa5808e8e, MemoryContextResetAndDeleteChildren() is
just a backwards compatibility macro for MemoryContextReset(). Now
that some time has passed, this macro seems more likely to create
confusion.
This commit removes the macro and replaces all remaining uses with
calls to MemoryContextReset(). Any third-party code that use this
macro will need to be adjusted to call MemoryContextReset()
instead. Since the two have behaved the same way since v9.5, such
adjustments won't produce any behavior changes for all
currently-supported versions of PostgreSQL.
Reviewed-by: Amul Sul, Tom Lane, Alvaro Herrera, Dagfinn Ilmari Mannsåker
Discussion: https://postgr.es/m/20231113185950.GA1668018%40nathanxps13
Diffstat (limited to 'src/backend/postmaster')
| -rw-r--r-- | src/backend/postmaster/autovacuum.c | 10 | ||||
| -rw-r--r-- | src/backend/postmaster/bgwriter.c | 2 | ||||
| -rw-r--r-- | src/backend/postmaster/checkpointer.c | 2 | ||||
| -rw-r--r-- | src/backend/postmaster/walwriter.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3a6f24a0237..86a3b3d8be2 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -555,7 +555,7 @@ AutoVacLauncherMain(int argc, char *argv[]) FlushErrorState(); /* Flush any leaked data in the top-level context */ - MemoryContextResetAndDeleteChildren(AutovacMemCxt); + MemoryContextReset(AutovacMemCxt); /* don't leave dangling pointers to freed memory */ DatabaseListCxt = NULL; @@ -2521,7 +2521,7 @@ do_autovacuum(void) /* clean up memory before each iteration */ - MemoryContextResetAndDeleteChildren(PortalContext); + MemoryContextReset(PortalContext); /* * Save the relation name for a possible error message, to avoid a @@ -2576,7 +2576,7 @@ do_autovacuum(void) /* this resets ProcGlobal->statusFlags[i] too */ AbortOutOfAnyTransaction(); FlushErrorState(); - MemoryContextResetAndDeleteChildren(PortalContext); + MemoryContextReset(PortalContext); /* restart our transaction for the following operations */ StartTransactionCommand(); @@ -2718,7 +2718,7 @@ perform_work_item(AutoVacuumWorkItem *workitem) autovac_report_workitem(workitem, cur_nspname, cur_relname); /* clean up memory before each work item */ - MemoryContextResetAndDeleteChildren(PortalContext); + MemoryContextReset(PortalContext); /* * We will abort the current work item if something errors out, and @@ -2770,7 +2770,7 @@ perform_work_item(AutoVacuumWorkItem *workitem) /* this resets ProcGlobal->statusFlags[i] too */ AbortOutOfAnyTransaction(); FlushErrorState(); - MemoryContextResetAndDeleteChildren(PortalContext); + MemoryContextReset(PortalContext); /* restart our transaction for the following operations */ StartTransactionCommand(); diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index f2e4f23d9fc..d02dc17b9c1 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -182,7 +182,7 @@ BackgroundWriterMain(void) FlushErrorState(); /* Flush any leaked data in the top-level context */ - MemoryContextResetAndDeleteChildren(bgwriter_context); + MemoryContextReset(bgwriter_context); /* re-initialize to avoid repeated errors causing problems */ WritebackContextInit(&wb_context, &bgwriter_flush_after); diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index a3c1aba24ea..42c807d3528 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -290,7 +290,7 @@ CheckpointerMain(void) FlushErrorState(); /* Flush any leaked data in the top-level context */ - MemoryContextResetAndDeleteChildren(checkpointer_context); + MemoryContextReset(checkpointer_context); /* Now we can allow interrupts again */ RESUME_INTERRUPTS(); diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index 266fbc23399..48bc92205b5 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -178,7 +178,7 @@ WalWriterMain(void) FlushErrorState(); /* Flush any leaked data in the top-level context */ - MemoryContextResetAndDeleteChildren(walwriter_context); + MemoryContextReset(walwriter_context); /* Now we can allow interrupts again */ RESUME_INTERRUPTS(); |
