From 9f2108b0dc5176604b8fe189b572233f49815954 Mon Sep 17 00:00:00 2001 From: David-Angel <37879322+David-Angel@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:26:13 -0600 Subject: [PATCH] Update config.go Another solution to the huge_pages issue here: https://github.com/CrunchyData/postgres-operator/issues/3477 A better solution would be to use what gets passed in for huge_pages and turn it off by default. --- internal/postgres/config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/postgres/config.go b/internal/postgres/config.go index 9045bfcc74..14bcce4729 100644 --- a/internal/postgres/config.go +++ b/internal/postgres/config.go @@ -322,6 +322,21 @@ func startupCommand( // - https://git.postgresql.org/gitweb/?p=postgresql.git;f=src/backend/access/transam/xlog.c;hb=REL_12_0#l5318 // TODO(cbandy): Remove this after 5.0 is EOL. `rm -f "${postgres_data_directory}/recovery.signal"`, + + // # # # # # # # # # # # # # # # # # # # # # # # # # + // # The "initdb" tool uses settings defined in the shared "postgresql.conf.sample" file preventing "huge_pages" from getting configured properly. + // # Remove the "huge_pages" configuration from "postgresql.conf.sample" as it may or may not exist. + // # Add "huge_pages" to the bottom of the page turned off. + // # This will not prevent "huge_pages" from being passed in and configured as it only changes what "initdb" is doing. + `echo "initdb fix for huge_pages."`, + `CSAMPLE="$(find /usr/ -type d -name 'pgsql-*')/share/postgresql.conf.sample"`, + `echo "$CSAMPLE"`, + `echo "before..."`, + `cat "$CSAMPLE" | grep huge`, + `awk -i inplace '($1 ~ /huge_pages/ || $1 ~ /#huge_pages/ || $2 ~ /huge_pagescat $CSAMPLE | grep huge/ || $2 ~ /#huge_pages/) { next } { print } END { print "huge_pages = off" }' ${CSAMPLE}`, + `echo "after..."`, + `cat "$CSAMPLE" | grep huge`, + // # # # # # # # # # # # # # # # # # # # # # # # # # }, "\n") return append([]string{"bash", "-ceu", "--", script, "startup"}, args...)