public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 8/8] default to --with-lz4
2+ messages / 2 participants
[nested] [flat]

* [PATCH 8/8] default to --with-lz4
@ 2021-03-10 09:14  Dilip Kumar <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dilip Kumar @ 2021-03-10 09:14 UTC (permalink / raw)

this is meant to excercize the new feature in the CIs, and not meant to be merged
---
 configure    | 6 ++++--
 configure.ac | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 387c553d5a..66b9edcc7b 100755
--- a/configure
+++ b/configure
@@ -1575,7 +1575,7 @@ Optional Packages:
   --with-system-tzdata=DIR
                           use system time zone data in DIR
   --without-zlib          do not use Zlib
-  --with-lz4              build with LZ4 support
+  --without-lz4           build without LZ4 support
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-ssl=LIB          use LIB for SSL/TLS support (openssl)
   --with-openssl          obsolete spelling of --with-ssl=openssl
@@ -8598,7 +8598,9 @@ $as_echo "#define USE_LZ4 1" >>confdefs.h
   esac
 
 else
-  with_lz4=no
+  with_lz4=yes
+
+$as_echo "#define USE_LZ4 1" >>confdefs.h
 
 fi
 
diff --git a/configure.ac b/configure.ac
index 4cd683afb3..7907aded9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -990,8 +990,8 @@ AC_SUBST(with_zlib)
 # LZ4
 #
 AC_MSG_CHECKING([whether to build with LZ4 support])
-PGAC_ARG_BOOL(with, lz4, no, [build with LZ4 support],
-              [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build with LZ4 support. (--with-lz4)])])
+PGAC_ARG_BOOL(with, lz4, yes, [build without LZ4 support],
+              [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build without LZ4 support. (--without-lz4)])])
 AC_MSG_RESULT([$with_lz4])
 AC_SUBST(with_lz4)
 
-- 
2.17.0


--cvVnyQ+4j833TQvp--





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Detach shared memory in Postmaster child if not needed
@ 2024-07-29 09:57  Rui Zhao <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Rui Zhao @ 2024-07-29 09:57 UTC (permalink / raw)
  To: pgsql-hackers; +Cc: hlinnaka <[email protected]>; robertmhaas <[email protected]>; tgl <[email protected]>

Prior to PG16, postmaster children would manually detach from shared memory
if it was not needed. However, this behavior was removed in fork mode in
commit aafc05d.
Detaching shared memory when it is no longer needed is beneficial, as 
postmaster children (like syslogger) don't wish to take any risk of
accidentally corrupting shared memory. Additionally, any panic in these
processes will not reset shared memory.
The attached patch addresses this issue by detaching shared memory after
fork_process().
Best regard,
Rui Zhao


Attachments:

  [application/octet-stream] 0001-Detach-shared-memory-in-Postmaster-child-if-not-needed.patch (997B, ../../[email protected]/3-0001-Detach-shared-memory-in-Postmaster-child-if-not-needed.patch)
  download | inline diff:
From 1b1c07f6681bf261f1c19ad8e7ad84f008a1adea Mon Sep 17 00:00:00 2001
From: "Rui Zhao" <[email protected]>
Date: Mon, 29 Jul 2024 16:55:04 +0800
Subject: [PATCH] Detach shared memory in Postmaster child if not needed

---
 src/backend/postmaster/launch_backend.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/backend/postmaster/launch_backend.c b/src/backend/postmaster/launch_backend.c
index fafe5feecc..9b018ef500 100644
--- a/src/backend/postmaster/launch_backend.c
+++ b/src/backend/postmaster/launch_backend.c
@@ -249,6 +249,13 @@ postmaster_child_launch(BackendType child_type,
 		/* Detangle from postmaster */
 		InitPostmasterChild();
 
+		/* Detach shared memory if not needed. */
+		if (!child_process_kinds[child_type].shmem_attach)
+		{
+			dsm_detach_all();
+			PGSharedMemoryDetach();
+		}
+
 		/*
 		 * Enter the Main function with TopMemoryContext.  The startup data is
 		 * allocated in PostmasterContext, so we cannot release it here yet.
-- 
2.39.3



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-07-29 09:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 09:14 [PATCH 8/8] default to --with-lz4 Dilip Kumar <[email protected]>
2024-07-29 09:57 Detach shared memory in Postmaster child if not needed Rui Zhao <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox