mirror of
https://github.com/postgres/postgres.git
synced 2025-12-04 12:02:48 +03:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user