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

Commit187ca5e

Browse files
committed
Revert "pg_ctl: Add idempotent option"
This reverts commit8730618. Thebehavior in certain cases is still being debated, and it's too late tosolve this before beta.
1 parentdb9f0e1 commit187ca5e

File tree

3 files changed

+9
-45
lines changed

3 files changed

+9
-45
lines changed

‎contrib/start-scripts/linux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ case $1 in
8989
;;
9090
stop)
9191
echo -n"Stopping PostgreSQL:"
92-
su -$PGUSER -c"$PGCTL stop -I -D '$PGDATA' -s -m fast"
92+
su -$PGUSER -c"$PGCTL stop -D '$PGDATA' -s -m fast"
9393
echo"ok"
9494
;;
9595
restart)
9696
echo -n"Restarting PostgreSQL:"
97-
su -$PGUSER -c"$PGCTL stop -I -D '$PGDATA' -s -m fast -w"
97+
su -$PGUSER -c"$PGCTL stop -D '$PGDATA' -s -m fast -w"
9898
test x"$OOM_SCORE_ADJ"!= x&&echo"$OOM_SCORE_ADJ"> /proc/self/oom_score_adj
9999
test x"$OOM_ADJ"!= x&&echo"$OOM_ADJ"> /proc/self/oom_adj
100100
su -$PGUSER -c"$DAEMON -D '$PGDATA' &">>$PGLOG2>&1

‎doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ PostgreSQL documentation
3939
<arg choice="opt"><option>-o</option> <replaceable>options</replaceable></arg>
4040
<arg choice="opt"><option>-p</option> <replaceable>path</replaceable></arg>
4141
<arg choice="opt"><option>-c</option></arg>
42-
<arg choice="opt"><option>-I</option></arg>
4342
</cmdsynopsis>
4443

4544
<cmdsynopsis>
@@ -56,7 +55,6 @@ PostgreSQL documentation
5655
<arg choice="plain"><option>i[mmediate]</option></arg>
5756
</group>
5857
</arg>
59-
<arg choice="opt"><option>-I</option></arg>
6058
</cmdsynopsis>
6159

6260
<cmdsynopsis>
@@ -272,25 +270,6 @@ PostgreSQL documentation
272270
</listitem>
273271
</varlistentry>
274272

275-
<varlistentry>
276-
<term><option>-I</option></term>
277-
<term><option>--idempotent</option></term>
278-
<listitem>
279-
<para>
280-
When used with the <literal>start</literal> or <literal>stop</literal>
281-
actions, return exit code 0 if the server is already running or
282-
stopped, respectively. Otherwise, an error is raised and a nonzero
283-
exit code is returned in these cases.
284-
</para>
285-
286-
<para>
287-
This option is useful for System-V-style init scripts, which require
288-
the <literal>start</literal> and <literal>stop</literal> actions to be
289-
idempotent.
290-
</para>
291-
</listitem>
292-
</varlistentry>
293-
294273
<varlistentry>
295274
<term><option>-l <replaceable class="parameter">filename</replaceable></option></term>
296275
<term><option>--log <replaceable class="parameter">filename</replaceable></option></term>

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ static char *pg_config = NULL;
8585
staticchar*pgdata_opt=NULL;
8686
staticchar*post_opts=NULL;
8787
staticconstchar*progname;
88-
staticboolidempotent= false;
8988
staticchar*log_file=NULL;
9089
staticchar*exec_path=NULL;
9190
staticchar*register_servicename="PostgreSQL";/* FIXME: + version ID? */
@@ -774,15 +773,9 @@ do_start(void)
774773
{
775774
old_pid=get_pgpid();
776775
if (old_pid!=0)
777-
{
778-
if (idempotent)
779-
exit(0);
780-
else
781-
{
782-
write_stderr(_("%s: another server might be running\n"),progname);
783-
exit(1);
784-
}
785-
}
776+
write_stderr(_("%s: another server might be running; "
777+
"trying to start server anyway\n"),
778+
progname);
786779
}
787780

788781
read_post_opts();
@@ -866,8 +859,6 @@ do_stop(void)
866859

867860
if (pid==0)/* no pid file */
868861
{
869-
if (idempotent)
870-
exit(0);
871862
write_stderr(_("%s: PID file \"%s\" does not exist\n"),progname,pid_file);
872863
write_stderr(_("Is server running?\n"));
873864
exit(1);
@@ -1771,9 +1762,9 @@ do_help(void)
17711762
printf(_("%s is a utility to initialize, start, stop, or control a PostgreSQL server.\n\n"),progname);
17721763
printf(_("Usage:\n"));
17731764
printf(_(" %s init[db] [-D DATADIR] [-s] [-o \"OPTIONS\"]\n"),progname);
1774-
printf(_(" %s start [-w] [-t SECS] [-D DATADIR] [-s] [-I] [-l FILENAME] [-o \"OPTIONS\"]\n"),progname);
1775-
printf(_(" %s stop [-W] [-t SECS] [-D DATADIR] [-s] [-I] [-m SHUTDOWN-MODE]\n"),progname);
1776-
printf(_(" %s restart [-w] [-t SECS] [-D DATADIR] [-s][-m SHUTDOWN-MODE]\n"
1765+
printf(_(" %s start [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"),progname);
1766+
printf(_(" %s stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"),progname);
1767+
printf(_(" %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"
17771768
" [-o \"OPTIONS\"]\n"),progname);
17781769
printf(_(" %s reload [-D DATADIR] [-s]\n"),progname);
17791770
printf(_(" %s status [-D DATADIR]\n"),progname);
@@ -1806,8 +1797,6 @@ do_help(void)
18061797
printf(_(" -o OPTIONS command line options to pass to postgres\n"
18071798
" (PostgreSQL server executable) or initdb\n"));
18081799
printf(_(" -p PATH-TO-POSTGRES normally not necessary\n"));
1809-
printf(_("\nOptions for start or stop:\n"));
1810-
printf(_(" -I, --idempotent don't error if server already running or stopped\n"));
18111800
printf(_("\nOptions for stop, restart, or promote:\n"));
18121801
printf(_(" -m, --mode=MODE MODE can be \"smart\", \"fast\", or \"immediate\"\n"));
18131802

@@ -1986,7 +1975,6 @@ main(int argc, char **argv)
19861975
{"silent",no_argument,NULL,'s'},
19871976
{"timeout",required_argument,NULL,'t'},
19881977
{"core-files",no_argument,NULL,'c'},
1989-
{"idempotent",no_argument,NULL,'I'},
19901978
{NULL,0,NULL,0}
19911979
};
19921980

@@ -2052,7 +2040,7 @@ main(int argc, char **argv)
20522040
/* process command-line options */
20532041
while (optind<argc)
20542042
{
2055-
while ((c=getopt_long(argc,argv,"cD:Il:m:N:o:p:P:sS:t:U:wW",long_options,&option_index))!=-1)
2043+
while ((c=getopt_long(argc,argv,"cD:l:m:N:o:p:P:sS:t:U:wW",long_options,&option_index))!=-1)
20562044
{
20572045
switch (c)
20582046
{
@@ -2078,9 +2066,6 @@ main(int argc, char **argv)
20782066
pgdata_D);
20792067
break;
20802068
}
2081-
case'I':
2082-
idempotent= true;
2083-
break;
20842069
case'l':
20852070
log_file=pg_strdup(optarg);
20862071
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp