You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by dj...@apache.org on 2026/06/25 07:15:34 UTC

(cloudberry) 05/12: Re-enable pgstat temp file reporting and fix SIGSEGV in ReportTemporaryFileUsage

This is an automated email from the ASF dual-hosted git repository.

tuhaihe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 649b46491c1e53153a5193ed13817bdd02156847
Author: liushengsong <ls...@gmail.com>
AuthorDate: Mon Jun 22 10:13:41 2026 +0800

    Re-enable pgstat temp file reporting and fix SIGSEGV in ReportTemporaryFileUsage
    
    Re-enable temporary file size reporting to pgstat and the associated
    Assert in FileClose. Fix a SIGSEGV in ReportTemporaryFileUsage that
    occurred during process exit when the resource owner was already
    released.
---
 src/backend/storage/file/fd.c       | 12 ++++++++----
 src/backend/utils/activity/pgstat.c |  3 +--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index ebbecff523f..407bb90cec2 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -1576,10 +1576,14 @@ FileAccess(File file)
 static void
 ReportTemporaryFileUsage(const char *path, off_t size)
 {
-	/* MERGE16_FIXME: Now the pgstat has not worked, so disable the report first */
-	return;
-	
-	pgstat_report_tempfile(size);
+	/*
+	 * pgstat_report_tempfile() accesses shared memory via dshash, which
+	 * may already be detached during process exit cleanup.  Calling it
+	 * from PathNameDeleteTemporaryDir's walkdir causes SIGSEGV in
+	 * dshash_find().  Guard with IsUnderPostmaster and proc_exit_inprogress.
+	 */
+	if (!proc_exit_inprogress)
+		pgstat_report_tempfile(size);
 
 	if (log_temp_files >= 0)
 	{
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index a43dcb75398..beaeb669266 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -1301,8 +1301,7 @@ pgstat_get_kind_info(PgStat_Kind kind)
 void
 pgstat_assert_is_up(void)
 {
-	/* MERGE16_FIXME: Now the pgstat has not worked, so disable the assert first */
-//	Assert(pgstat_is_initialized && !pgstat_is_shutdown);
+	Assert(pgstat_is_initialized && !pgstat_is_shutdown);
 }
 #endif
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org