Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8729958

Browse files
committed
Determine max_connections first, then see how large shared_buffers can
be made, to avoid corner cases where max_connections ends up unreasonablysmall because shared_buffers is hogging too much shmem space. Per pghackersdiscussion about a week ago. Also, fix the copy-newlines problem in amore robust way, by using COPY FROM filename instead of COPY FROM STDIN;per a suggestion from Peter.
1 parente7261c4 commit8729958

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

‎src/bin/initdb/initdb.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
2828
# Portions Copyright (c) 1994, Regents of the University of California
2929
#
30-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.203 2003/09/27 16:27:57 momjian Exp $
30+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.204 2003/10/13 21:06:44 tgl Exp $
3131
#
3232
#-------------------------------------------------------------------------
3333

@@ -550,29 +550,32 @@ echo "$short_version" > "$PGDATA/PG_VERSION" || exit_nicely
550550
#
551551
# DETERMINE PLATFORM-SPECIFIC CONFIG SETTINGS
552552
#
553-
# Use reasonable values if kernel will let us, else scale back
553+
# Use reasonable values if kernel will let us, else scale back. Probe for
554+
# max_connections first since it is subject to more constraints than
555+
# shared_buffers.
554556

555557
# common backend options
556558
PGSQL_OPT="-F -D$PGDATA"
557559

558560
cp /dev/null"$PGDATA"/postgresql.conf|| exit_nicely
559561

560-
$ECHO_N"selecting defaultshared_buffers..."$ECHO_C
562+
$ECHO_N"selecting defaultmax_connections..."$ECHO_C
561563

562-
fornbuffersin1000 900 800 700 600 500 400 300 200 100 50
564+
fornconnsin100 50 40 30 20 10
563565
do
564-
TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=5"
566+
nbuffers=`expr$nconns'*' 5`
567+
TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=$nconns"
565568
if"$PGPATH"/postgres -boot -x0$TEST_OPT template1</dev/null>/dev/null2>&1
566569
then
567570
break
568571
fi
569572
done
570573

571-
echo"$nbuffers"
574+
echo"$nconns"
572575

573-
$ECHO_N"selecting defaultmax_connections..."$ECHO_C
576+
$ECHO_N"selecting defaultshared_buffers..."$ECHO_C
574577

575-
fornconnsin100 50 40 30 20 10
578+
fornbuffersin1000 900 800 700 600 500 400 300 200 100 50
576579
do
577580
TEST_OPT="$PGSQL_OPT -c shared_buffers=$nbuffers -c max_connections=$nconns"
578581
if"$PGPATH"/postgres -boot -x0$TEST_OPT template1</dev/null>/dev/null2>&1
@@ -581,7 +584,7 @@ do
581584
fi
582585
done
583586

584-
echo"$nconns"
587+
echo"$nbuffers"
585588

586589
##########################################################################
587590
#
@@ -1088,12 +1091,9 @@ $ECHO_N "creating information schema... "$ECHO_C
10881091

10891092
echo"UPDATE information_schema.sql_implementation_info SET character_value = '$combined_version' WHERE implementation_info_name = 'DBMS VERSION';"
10901093

1091-
echo"COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name, is_supported, comments) FROM STDIN;"
1092-
cat"$datadir"/sql_features.txt
1093-
echo"\."
1094-
)|
1095-
tr -d'\r'|# make newlines consistent for Win32
1096-
"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
1094+
echo"COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name, is_supported, comments) FROM '$datadir/sql_features.txt';"
1095+
) \
1096+
|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
10971097
echo"ok"
10981098

10991099
$ECHO_N"vacuuming database template1..."$ECHO_C

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp