git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e7261c4)
Determine max_connections first, then see how large shared_buffers can
2003年10月13日 21:06:44 +0000 (21:06 +0000)
2003年10月13日 21:06:44 +0000 (21:06 +0000)
be made, to avoid corner cases where max_connections ends up unreasonably
small because shared_buffers is hogging too much shmem space. Per pghackers
discussion about a week ago. Also, fix the copy-newlines problem in a
more robust way, by using COPY FROM filename instead of COPY FROM STDIN;
per a suggestion from Peter.


diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh
index dfce575fb39b37d0f519a011fb23fb0124de5809..ed396c4bc28d3b94d44cf7f157bcd7b703bf0be5 100644 (file)
--- a/src/bin/initdb/initdb.sh
+++ b/src/bin/initdb/initdb.sh
@@ -27,7 +27,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.203 2003年09月27日 16:27:57 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.204 2003年10月13日 21:06:44 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -550,29 +550,32 @@ echo "$short_version" > "$PGDATA/PG_VERSION" || exit_nicely
#
# DETERMINE PLATFORM-SPECIFIC CONFIG SETTINGS
#
-# Use reasonable values if kernel will let us, else scale back
+# Use reasonable values if kernel will let us, else scale back. Probe for
+# max_connections first since it is subject to more constraints than
+# shared_buffers.
# common backend options
PGSQL_OPT="-F -D$PGDATA"
cp /dev/null "$PGDATA"/postgresql.conf || exit_nicely
-$ECHO_N "selecting default shared_buffers... "$ECHO_C
+$ECHO_N "selecting default max_connections... "$ECHO_C
-for nbuffers in 1000 900 800 700 600 500 400 300 200 100 50
+for nconns in 100 50 40 30 20 10
do
- TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=5"
+ nbuffers=`expr $nconns '*' 5`
+ TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=$nconns"
if "$PGPATH"/postgres -boot -x0 $TEST_OPT template1 </dev/null >/dev/null 2>&1
then
break
fi
done
-echo "$nbuffers"
+echo "$nconns"
-$ECHO_N "selecting default max_connections... "$ECHO_C
+$ECHO_N "selecting default shared_buffers... "$ECHO_C
-for nconns in 100 50 40 30 20 10
+for nbuffers in 1000 900 800 700 600 500 400 300 200 100 50
do
TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=$nconns"
if "$PGPATH"/postgres -boot -x0 $TEST_OPT template1 </dev/null >/dev/null 2>&1
@@ -581,7 +584,7 @@ do
fi
done
-echo "$nconns"
+echo "$nbuffers"
##########################################################################
#
@@ -1088,12 +1091,9 @@ $ECHO_N "creating information schema... "$ECHO_C
echo "UPDATE information_schema.sql_implementation_info SET character_value = '$combined_version' WHERE implementation_info_name = 'DBMS VERSION';"
- echo "COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name, is_supported, comments) FROM STDIN;"
- cat "$datadir"/sql_features.txt
- echo "\."
-) |
-tr -d '\r' | # make newlines consistent for Win32
-"$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
+ echo "COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name, is_supported, comments) FROM '$datadir/sql_features.txt';"
+) \
+ | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
echo "ok"
$ECHO_N "vacuuming database template1... "$ECHO_C
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /