From b453d90d8ea64a109063eca9e0608d04eb2bf47f Mon Sep 17 00:00:00 2001 From: foyzur Date: Wed, 29 Mar 2017 12:06:37 -0700 Subject: [PATCH] Relocating memory usage dump from ExecutorEnd to MemoryAccounting_Reset() as we no longer call ExecutorEnd upon abort. This ensures that we dump memory usage (if configured) once per command before resetting memory accounting. (#2113) --- src/backend/executor/execMain.c | 4 ---- src/backend/utils/mmgr/memaccounting.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 71f5cf6423..7162efd06b 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1111,10 +1111,6 @@ ExecutorEnd(QueryDesc *queryDesc) } END_MEMORY_ACCOUNT(); - if (gp_dump_memory_usage) - { - MemoryAccounting_SaveToFile(currentSliceId); - } ReportOOMConsumption(); } diff --git a/src/backend/utils/mmgr/memaccounting.c b/src/backend/utils/mmgr/memaccounting.c index e5a11c91df..51b1e578f4 100644 --- a/src/backend/utils/mmgr/memaccounting.c +++ b/src/backend/utils/mmgr/memaccounting.c @@ -202,6 +202,11 @@ MemoryAccounting_Reset() */ if (MemoryAccounting_IsInitialized()) { + if (gp_dump_memory_usage) + { + MemoryAccounting_SaveToFile(currentSliceId); + } + /* No one should create child context under MemoryAccountMemoryContext */ Assert(MemoryAccountMemoryContext->firstchild == NULL); -- GitLab