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

Commitd374e06

Browse files
committed
Hide backend debug output in initdb by default. To that end, the bootstrap
backend gets on -o option like the regular backend.
1 parentf5cda6d commitd374e06

File tree

2 files changed

+52
-30
lines changed

2 files changed

+52
-30
lines changed

‎src/backend/bootstrap/bootstrap.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.114 2001/08/10 18:57:33 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.115 2001/08/25 00:31:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -187,10 +187,11 @@ usage(void)
187187
{
188188
fprintf(stderr,
189189
gettext("Usage:\n"
190-
" postgres -boot [-d] [-D datadir] [-F] [-x num] dbname\n"
190+
" postgres -boot [-d] [-D datadir] [-F] [-o file] [-x num] dbname\n"
191191
" -d debug mode\n"
192192
" -D datadir data directory\n"
193193
" -F turn off fsync\n"
194+
" -o file send debug output to file\n"
194195
" -x num internal use\n"));
195196

196197
proc_exit(1);
@@ -248,7 +249,7 @@ BootstrapMain(int argc, char *argv[])
248249
* variable */
249250
}
250251

251-
while ((flag=getopt(argc,argv,"B:dD:Fpx:"))!=EOF)
252+
while ((flag=getopt(argc,argv,"B:dD:Fo:px:"))!=EOF)
252253
{
253254
switch (flag)
254255
{
@@ -262,6 +263,9 @@ BootstrapMain(int argc, char *argv[])
262263
case'F':
263264
SetConfigOption("fsync","false",PGC_POSTMASTER, true);
264265
break;
266+
case'o':
267+
StrNCpy(OutputFileName,optarg,MAXPGPATH);
268+
break;
265269
case'x':
266270
xlogop=atoi(optarg);
267271
break;

‎src/bin/initdb/initdb.sh

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Portions Copyright (c) 1996-2001, 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.132 2001/08/10 18:57:38 tgl Exp $
30+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.133 2001/08/25 00:31:17 petere Exp $
3131
#
3232
#-------------------------------------------------------------------------
3333

@@ -343,14 +343,16 @@ POSTGRESQL_CONF_SAMPLE="$datadir"/postgresql.conf.sample
343343

344344
if ["$show_setting"= yes ]|| ["$debug"= yes ]
345345
then
346+
(
346347
echo
347-
echo"Initdb variables:"
348+
echo"initdb variables:"
348349
forvarin PGDATA datadir PGPATH MULTIBYTE MULTIBYTEID \
349350
POSTGRES_SUPERUSERNAME POSTGRES_SUPERUSERID POSTGRES_BKI \
350351
POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \
351352
PG_HBA_SAMPLE PG_IDENT_SAMPLE;do
352353
eval"echo ' '$var=\$$var"
353354
done
355+
)1>&2
354356
fi
355357

356358
if ["$show_setting"= yes ];then
@@ -386,7 +388,7 @@ done
386388
trap'echo "Caught signal." ; exit_nicely' 1 2 3 15
387389

388390
# Let's go
389-
echo"This database system will be initialized withusername\"$POSTGRES_SUPERUSERNAME\"."
391+
echo"This database system will be initialized withuser name\"$POSTGRES_SUPERUSERNAME\"."
390392
echo"This user will own all the data files and must also own the server process."
391393
echo
392394

@@ -411,28 +413,32 @@ then
411413
exit 1
412414
else
413415
if [!-d"$PGDATA" ];then
414-
echo"Creating directory$PGDATA"
416+
$ECHO_N"creating directory$PGDATA..."$ECHO_C
415417
mkdir -p"$PGDATA">/dev/null2>&1|| mkdir"$PGDATA"|| exit_nicely
416418
made_new_pgdata=yes
417419
else
418-
echo"Fixing permissions on existing directory$PGDATA"
420+
$ECHO_N"Fixing permissions on existing directory$PGDATA..."$ECHO_C
419421
chmod go-rwx"$PGDATA"|| exit_nicely
420422
fi
423+
echo"ok"
421424

422425
if [!-d"$PGDATA"/base ]
423426
then
424-
echo"Creating directory$PGDATA/base"
427+
$ECHO_N"creating directory$PGDATA/base..."$ECHO_C
425428
mkdir"$PGDATA"/base|| exit_nicely
429+
echo"ok"
426430
fi
427431
if [!-d"$PGDATA"/global ]
428432
then
429-
echo"Creating directory$PGDATA/global"
433+
$ECHO_N"creating directory$PGDATA/global..."$ECHO_C
430434
mkdir"$PGDATA"/global|| exit_nicely
435+
echo"ok"
431436
fi
432437
if [!-d"$PGDATA"/pg_xlog ]
433438
then
434-
echo"Creating directory$PGDATA/pg_xlog"
439+
$ECHO_N"creating directory$PGDATA/pg_xlog..."$ECHO_C
435440
mkdir"$PGDATA"/pg_xlog|| exit_nicely
441+
echo"ok"
436442
fi
437443
fi
438444

@@ -441,32 +447,39 @@ fi
441447
#
442448
# RUN BKI SCRIPT IN BOOTSTRAP MODE TO CREATE TEMPLATE1
443449

444-
rm -rf"$PGDATA"/base/1|| exit_nicely
445-
mkdir"$PGDATA"/base/1|| exit_nicely
450+
# common backend options
451+
PGSQL_OPT="-F -D$PGDATA"
446452

447453
if ["$debug"= yes ]
448454
then
449455
BACKEND_TALK_ARG="-d"
456+
else
457+
PGSQL_OPT="$PGSQL_OPT -o /dev/null"
450458
fi
451459

452-
FIRSTRUN="-boot -x1 -F -D$PGDATA$BACKEND_TALK_ARG"
453460

454-
echo"Creating template1 database in$PGDATA/base/1"
455-
["$debug"= yes ]&&echo"Running:$PGPATH/postgres$FIRSTRUN template1"
461+
$ECHO_N"creating template1 database in$PGDATA/base/1..."$ECHO_C
462+
463+
rm -rf"$PGDATA"/base/1|| exit_nicely
464+
mkdir"$PGDATA"/base/1|| exit_nicely
456465

457466
cat"$POSTGRES_BKI" \
458467
| sed -e"s/POSTGRES/$POSTGRES_SUPERUSERNAME/g" \
459468
-e"s/PGUID/$POSTGRES_SUPERUSERID/g" \
460469
-e"s/ENCODING/$MULTIBYTEID/g" \
461-
|"$PGPATH"/postgres$FIRSTRUN template1 \
470+
|"$PGPATH"/postgres-boot -x1$PGSQL_OPT$BACKEND_TALK_ARG template1 \
462471
|| exit_nicely
463472

464473
echo$short_version>"$PGDATA"/base/1/PG_VERSION|| exit_nicely
465474

475+
echo"ok"
476+
466477
##########################################################################
467478
#
468479
# CREATE CONFIG FILES
469480

481+
$ECHO_N"creating configuration files..."$ECHO_C
482+
470483
echo$short_version>"$PGDATA/PG_VERSION"|| exit_nicely
471484

472485
cp"$PG_HBA_SAMPLE""$PGDATA"/pg_hba.conf|| exit_nicely
@@ -475,6 +488,8 @@ cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely
475488
chmod 0600"$PGDATA"/pg_hba.conf"$PGDATA"/pg_ident.conf \
476489
"$PGDATA"/postgresql.conf
477490

491+
echo"ok"
492+
478493
##########################################################################
479494
#
480495
# CREATE VIEWS and other things
@@ -484,14 +499,9 @@ chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
484499
# To break an SQL command across lines in this script, backslash-escape all
485500
# internal newlines in the command.
486501

487-
if ["$debug"= yes ]
488-
then
489-
PGSQL_OPT="-O -F -D$PGDATA"
490-
else
491-
PGSQL_OPT="-o /dev/null -O -F -D$PGDATA"
492-
fi
502+
PGSQL_OPT="$PGSQL_OPT -O"
493503

494-
echo"Initializing pg_shadow."
504+
$ECHO_N"initializing pg_shadow..."$ECHO_C
495505

496506
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
497507
-- Create a trigger so that direct updates to pg_shadow will be written
@@ -505,6 +515,7 @@ EOF
505515
if ["$?"-ne 0 ];then
506516
exit_nicely
507517
fi
518+
echo"ok"
508519

509520
# set up password
510521
if ["$PwPrompt" ];then
@@ -522,21 +533,23 @@ if [ "$PwPrompt" ]; then
522533
echo"Passwords didn't match."1>&2
523534
exit_nicely
524535
fi
536+
$ECHO_N"setting password..."$ECHO_C
525537
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
526538
ALTER USER "$POSTGRES_SUPERUSERNAME" WITH PASSWORD '$FirstPw';
527539
EOF
528540
if ["$?"-ne 0 ];then
529541
exit_nicely
530542
fi
531543
if [!-f$PGDATA/global/pg_pwd ];then
544+
echo
532545
echo"The password file wasn't generated. Please report this problem."1>&2
533546
exit_nicely
534547
fi
535-
echo"Setting password"
548+
echo"ok"
536549
fi
537550

538551

539-
echo"Enabling unlimited rowwidth for system tables."
552+
$ECHO_N"enabling unlimited rowsize for system tables..."$ECHO_C
540553

541554
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
542555
ALTER TABLE pg_attrdef CREATE TOAST TABLE;
@@ -549,9 +562,10 @@ EOF
549562
if ["$?"-ne 0 ];then
550563
exit_nicely
551564
fi
565+
echo"ok"
552566

553567

554-
echo"Creating system views."
568+
$ECHO_N"creating system views..."$ECHO_C
555569

556570
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
557571
@@ -795,8 +809,9 @@ EOF
795809
if ["$?"-ne 0 ];then
796810
exit_nicely
797811
fi
812+
echo"ok"
798813

799-
echo"Loading pg_description."
814+
$ECHO_N"loading pg_description..."$ECHO_C
800815
(
801816
cat<<EOF
802817
CREATE TEMP TABLE tmp_pg_description (\
@@ -815,17 +830,19 @@ EOF
815830
EOF
816831
) \
817832
|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
833+
echo"ok"
818834

819-
echo"Vacuuming database."
835+
$ECHO_N"vacuuming database template1..."$ECHO_C
820836

821837
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
822838
VACUUM FULL ANALYZE;
823839
EOF
824840
if ["$?"-ne 0 ];then
825841
exit_nicely
826842
fi
843+
echo"ok"
827844

828-
echo"Copying template1 to template0."
845+
$ECHO_N"copying template1 to template0..."$ECHO_C
829846

830847
"$PGPATH"/postgres$PGSQL_OPT template1>/dev/null<<EOF
831848
CREATE DATABASE template0;
@@ -845,6 +862,7 @@ EOF
845862
if ["$?"-ne 0 ];then
846863
exit_nicely
847864
fi
865+
echo"ok"
848866

849867

850868
##########################################################################

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp