1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-26 23:43:30 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@@ -413,7 +413,7 @@ StartAutoVacLauncher(void)
{
case -1:
ereport(LOG,
(errmsg("could not fork autovacuum launcher process: %m")));
(errmsg("could not fork autovacuum launcher process: %m")));
return 0;
#ifndef EXEC_BACKEND
@@ -1803,9 +1803,9 @@ autovac_balance_cost(void)
* zero is not a valid value.
*/
int vac_cost_limit = (autovacuum_vac_cost_limit > 0 ?
autovacuum_vac_cost_limit : VacuumCostLimit);
autovacuum_vac_cost_limit : VacuumCostLimit);
int vac_cost_delay = (autovacuum_vac_cost_delay >= 0 ?
autovacuum_vac_cost_delay : VacuumCostDelay);
autovacuum_vac_cost_delay : VacuumCostDelay);
double cost_total;
double cost_avail;
dlist_iter iter;
@@ -2674,7 +2674,7 @@ perform_work_item(AutoVacuumWorkItem *workitem)
case AVW_BRINSummarizeRange:
DirectFunctionCall2(brin_summarize_range,
ObjectIdGetDatum(workitem->avw_relation),
Int64GetDatum((int64) workitem->avw_blockNumber));
Int64GetDatum((int64) workitem->avw_blockNumber));
break;
default:
elog(WARNING, "unrecognized work item found: type %d",

View File

@@ -853,7 +853,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
if (!IsUnderPostmaster)
ereport(DEBUG1,
(errmsg("registering background worker \"%s\"", worker->bgw_name)));
(errmsg("registering background worker \"%s\"", worker->bgw_name)));
if (!process_shared_preload_libraries_in_progress &&
strcmp(worker->bgw_library_name, "postgres") != 0)

View File

@@ -462,7 +462,7 @@ CheckpointerMain(void)
elapsed_secs < CheckPointWarning)
ereport(LOG,
(errmsg_plural("checkpoints are occurring too frequently (%d second apart)",
"checkpoints are occurring too frequently (%d seconds apart)",
"checkpoints are occurring too frequently (%d seconds apart)",
elapsed_secs,
elapsed_secs),
errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
@@ -1280,8 +1280,8 @@ CompactCheckpointerRequestQueue(void)
CheckpointerShmem->requests[preserve_count++] = CheckpointerShmem->requests[n];
}
ereport(DEBUG1,
(errmsg("compacted fsync request queue from %d entries to %d entries",
CheckpointerShmem->num_requests, preserve_count)));
(errmsg("compacted fsync request queue from %d entries to %d entries",
CheckpointerShmem->num_requests, preserve_count)));
CheckpointerShmem->num_requests = preserve_count;
/* Cleanup. */

View File

@@ -388,7 +388,7 @@ pgarch_MainLoop(void)
int rc;
rc = WaitLatch(MyLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
timeout * 1000L,
WAIT_EVENT_ARCHIVER_MAIN);
if (rc & WL_TIMEOUT)
@@ -593,16 +593,16 @@ pgarch_archiveXlog(char *xlog)
{
#if defined(WIN32)
ereport(lev,
(errmsg("archive command was terminated by exception 0x%X",
WTERMSIG(rc)),
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
(errmsg("archive command was terminated by exception 0x%X",
WTERMSIG(rc)),
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
ereport(lev,
(errmsg("archive command was terminated by signal %d: %s",
WTERMSIG(rc),
WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
#else
@@ -616,10 +616,10 @@ pgarch_archiveXlog(char *xlog)
else
{
ereport(lev,
(errmsg("archive command exited with unrecognized status %d",
rc),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
(errmsg("archive command exited with unrecognized status %d",
rc),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
}
snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog);

View File

@@ -375,7 +375,7 @@ pgstat_init(void)
* compile-time cross-check that we didn't.
*/
StaticAssertStmt(sizeof(PgStat_Msg) <= PGSTAT_MAX_MSG_SIZE,
"maximum stats message size exceeds PGSTAT_MAX_MSG_SIZE");
"maximum stats message size exceeds PGSTAT_MAX_MSG_SIZE");
/*
* Create the UDP socket for sending and receiving statistic messages
@@ -415,7 +415,7 @@ pgstat_init(void)
if (++tries > 1)
ereport(LOG,
(errmsg("trying another address for the statistics collector")));
(errmsg("trying another address for the statistics collector")));
/*
* Create the socket.
@@ -424,7 +424,7 @@ pgstat_init(void)
{
ereport(LOG,
(errcode_for_socket_access(),
errmsg("could not create socket for statistics collector: %m")));
errmsg("could not create socket for statistics collector: %m")));
continue;
}
@@ -436,7 +436,7 @@ pgstat_init(void)
{
ereport(LOG,
(errcode_for_socket_access(),
errmsg("could not bind socket for statistics collector: %m")));
errmsg("could not bind socket for statistics collector: %m")));
closesocket(pgStatSock);
pgStatSock = PGINVALID_SOCKET;
continue;
@@ -463,7 +463,7 @@ pgstat_init(void)
{
ereport(LOG,
(errcode_for_socket_access(),
errmsg("could not connect socket for statistics collector: %m")));
errmsg("could not connect socket for statistics collector: %m")));
closesocket(pgStatSock);
pgStatSock = PGINVALID_SOCKET;
continue;
@@ -612,7 +612,7 @@ retry2:
startup_failed:
ereport(LOG,
(errmsg("disabling statistics collector for lack of working socket")));
(errmsg("disabling statistics collector for lack of working socket")));
if (addrs)
pg_freeaddrinfo_all(hints.ai_family, addrs);
@@ -2615,11 +2615,11 @@ BackendStatusShmemSize(void)
mul_size(NAMEDATALEN, NumBackendStatSlots));
/* BackendActivityBuffer: */
size = add_size(size,
mul_size(pgstat_track_activity_query_size, NumBackendStatSlots));
mul_size(pgstat_track_activity_query_size, NumBackendStatSlots));
#ifdef USE_SSL
/* BackendSslStatusBuffer: */
size = add_size(size,
mul_size(sizeof(PgBackendSSLStatus), NumBackendStatSlots));
mul_size(sizeof(PgBackendSSLStatus), NumBackendStatSlots));
#endif
return size;
}
@@ -3234,13 +3234,13 @@ pgstat_read_current_status(void)
localtable = (LocalPgBackendStatus *)
MemoryContextAlloc(pgStatLocalContext,
sizeof(LocalPgBackendStatus) * NumBackendStatSlots);
sizeof(LocalPgBackendStatus) * NumBackendStatSlots);
localappname = (char *)
MemoryContextAlloc(pgStatLocalContext,
NAMEDATALEN * NumBackendStatSlots);
localactivity = (char *)
MemoryContextAlloc(pgStatLocalContext,
pgstat_track_activity_query_size * NumBackendStatSlots);
pgstat_track_activity_query_size * NumBackendStatSlots);
#ifdef USE_SSL
localsslstatus = (PgBackendSSLStatus *)
MemoryContextAlloc(pgStatLocalContext,
@@ -4330,13 +4330,13 @@ PgstatCollectorMain(int argc, char *argv[])
case PGSTAT_MTYPE_RESETSHAREDCOUNTER:
pgstat_recv_resetsharedcounter(
(PgStat_MsgResetsharedcounter *) &msg,
(PgStat_MsgResetsharedcounter *) &msg,
len);
break;
case PGSTAT_MTYPE_RESETSINGLECOUNTER:
pgstat_recv_resetsinglecounter(
(PgStat_MsgResetsinglecounter *) &msg,
(PgStat_MsgResetsinglecounter *) &msg,
len);
break;
@@ -4388,7 +4388,7 @@ PgstatCollectorMain(int argc, char *argv[])
/* Sleep until there's something to do */
#ifndef WIN32
wr = WaitLatchOrSocket(MyLatch,
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE,
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE,
pgStatSock, -1L,
WAIT_EVENT_PGSTAT_MAIN);
#else
@@ -4404,7 +4404,7 @@ PgstatCollectorMain(int argc, char *argv[])
* backend_read_statsfile.
*/
wr = WaitLatchOrSocket(MyLatch,
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT,
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT,
pgStatSock,
2 * 1000L /* msec */ ,
WAIT_EVENT_PGSTAT_MAIN);
@@ -4683,8 +4683,8 @@ pgstat_write_statsfiles(bool permanent, bool allDbs)
{
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not write temporary statistics file \"%s\": %m",
tmpfile)));
errmsg("could not write temporary statistics file \"%s\": %m",
tmpfile)));
FreeFile(fpout);
unlink(tmpfile);
}
@@ -4692,8 +4692,8 @@ pgstat_write_statsfiles(bool permanent, bool allDbs)
{
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not close temporary statistics file \"%s\": %m",
tmpfile)));
errmsg("could not close temporary statistics file \"%s\": %m",
tmpfile)));
unlink(tmpfile);
}
else if (rename(tmpfile, statfile) < 0)
@@ -4818,8 +4818,8 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
{
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not write temporary statistics file \"%s\": %m",
tmpfile)));
errmsg("could not write temporary statistics file \"%s\": %m",
tmpfile)));
FreeFile(fpout);
unlink(tmpfile);
}
@@ -4827,8 +4827,8 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
{
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not close temporary statistics file \"%s\": %m",
tmpfile)));
errmsg("could not close temporary statistics file \"%s\": %m",
tmpfile)));
unlink(tmpfile);
}
else if (rename(tmpfile, statfile) < 0)
@@ -4986,7 +4986,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
* Add to the DB hash
*/
dbentry = (PgStat_StatDBEntry *) hash_search(dbhash,
(void *) &dbbuf.databaseid,
(void *) &dbbuf.databaseid,
HASH_ENTER,
&found);
if (found)
@@ -5019,7 +5019,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
dbentry->tables = hash_create("Per-database table",
PGSTAT_TAB_HASH_SIZE,
&hash_ctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
hash_ctl.keysize = sizeof(Oid);
hash_ctl.entrysize = sizeof(PgStat_StatFuncEntry);
@@ -5027,7 +5027,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
dbentry->functions = hash_create("Per-database function",
PGSTAT_FUNCTION_HASH_SIZE,
&hash_ctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
/*
* If requested, read the data from the database-specific
@@ -5153,8 +5153,8 @@ pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash,
break;
tabentry = (PgStat_StatTabEntry *) hash_search(tabhash,
(void *) &tabbuf.tableid,
HASH_ENTER, &found);
(void *) &tabbuf.tableid,
HASH_ENTER, &found);
if (found)
{
@@ -5187,8 +5187,8 @@ pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash,
break;
funcentry = (PgStat_StatFuncEntry *) hash_search(funchash,
(void *) &funcbuf.functionid,
HASH_ENTER, &found);
(void *) &funcbuf.functionid,
HASH_ENTER, &found);
if (found)
{
@@ -5655,7 +5655,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
PgStat_TableEntry *tabmsg = &(msg->m_entry[i]);
tabentry = (PgStat_StatTabEntry *) hash_search(dbentry->tables,
(void *) &(tabmsg->t_id),
(void *) &(tabmsg->t_id),
HASH_ENTER, &found);
if (!found)
@@ -6140,7 +6140,7 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
for (i = 0; i < msg->m_nentries; i++, funcmsg++)
{
funcentry = (PgStat_StatFuncEntry *) hash_search(dbentry->functions,
(void *) &(funcmsg->f_id),
(void *) &(funcmsg->f_id),
HASH_ENTER, &found);
if (!found)

View File

@@ -918,15 +918,15 @@ PostmasterMain(int argc, char *argv[])
char **p;
ereport(DEBUG3,
(errmsg_internal("%s: PostmasterMain: initial environment dump:",
progname)));
(errmsg_internal("%s: PostmasterMain: initial environment dump:",
progname)));
ereport(DEBUG3,
(errmsg_internal("-----------------------------------------")));
(errmsg_internal("-----------------------------------------")));
for (p = environ; *p; ++p)
ereport(DEBUG3,
(errmsg_internal("\t%s", *p)));
ereport(DEBUG3,
(errmsg_internal("-----------------------------------------")));
(errmsg_internal("-----------------------------------------")));
}
/*
@@ -1180,7 +1180,7 @@ PostmasterMain(int argc, char *argv[])
win32ChildQueue = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1);
if (win32ChildQueue == NULL)
ereport(FATAL,
(errmsg("could not create I/O completion port for child queue")));
(errmsg("could not create I/O completion port for child queue")));
#endif
/*
@@ -1271,8 +1271,8 @@ PostmasterMain(int argc, char *argv[])
if (!(Log_destination & LOG_DESTINATION_STDERR))
ereport(LOG,
(errmsg("ending log output to stderr"),
errhint("Future log output will go to log destination \"%s\".",
Log_destination_string)));
errhint("Future log output will go to log destination \"%s\".",
Log_destination_string)));
whereToSendOutput = DestNone;
@@ -1324,7 +1324,7 @@ PostmasterMain(int argc, char *argv[])
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("postmaster became multithreaded during startup"),
errhint("Set the LC_ALL environment variable to a valid locale.")));
errhint("Set the LC_ALL environment variable to a valid locale.")));
#endif
/*
@@ -1479,8 +1479,8 @@ checkDataDir(void)
else
ereport(FATAL,
(errcode_for_file_access(),
errmsg("could not read permissions of directory \"%s\": %m",
DataDir)));
errmsg("could not read permissions of directory \"%s\": %m",
DataDir)));
}
/* eventual chdir would fail anyway, but let's test ... */
@@ -1619,7 +1619,7 @@ DetermineSleepTime(struct timeval *timeout)
}
this_wakeup = TimestampTzPlusMilliseconds(rw->rw_crashed_at,
1000L * rw->rw_worker.bgw_restart_time);
1000L * rw->rw_worker.bgw_restart_time);
if (next_wakeup == 0 || this_wakeup < next_wakeup)
next_wakeup = this_wakeup;
}
@@ -2106,9 +2106,9 @@ retry1:
else if (!parse_bool(valptr, &am_walsender))
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for parameter \"%s\": \"%s\"",
"replication",
valptr),
errmsg("invalid value for parameter \"%s\": \"%s\"",
"replication",
valptr),
errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\".")));
}
else
@@ -2157,7 +2157,7 @@ retry1:
if (port->user_name == NULL || port->user_name[0] == '\0')
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("no PostgreSQL user name specified in startup packet")));
errmsg("no PostgreSQL user name specified in startup packet")));
/* The database defaults to the user name. */
if (port->database_name == NULL || port->database_name[0] == '\0')
@@ -2610,7 +2610,7 @@ pmdie(SIGNAL_ARGS)
/* autovac workers are told to shut down immediately */
/* and bgworkers too; does this need tweaking? */
SignalSomeChildren(SIGTERM,
BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER);
BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER);
/* and the autovac launcher too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
@@ -2687,7 +2687,7 @@ pmdie(SIGNAL_ARGS)
(errmsg("aborting any active transactions")));
/* shut down all backends and workers */
SignalSomeChildren(SIGTERM,
BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC |
BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC |
BACKEND_TYPE_BGWORKER);
/* and the autovac launcher too */
if (AutoVacPID != 0)
@@ -2801,7 +2801,7 @@ reaper(SIGNAL_ARGS)
LogChildExit(LOG, _("startup process"),
pid, exitstatus);
ereport(LOG,
(errmsg("aborting startup due to startup process failure")));
(errmsg("aborting startup due to startup process failure")));
ExitPostmaster(1);
}
@@ -2862,7 +2862,7 @@ reaper(SIGNAL_ARGS)
/* at this point we are really open for business */
ereport(LOG,
(errmsg("database system is ready to accept connections")));
(errmsg("database system is ready to accept connections")));
#ifdef USE_SYSTEMD
sd_notify(0, "READY=1");
@@ -3517,7 +3517,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
if (!EXIT_STATUS_0(exitstatus))
activity = pgstat_get_crashed_backend_activity(pid,
activity_buffer,
sizeof(activity_buffer));
sizeof(activity_buffer));
if (WIFEXITED(exitstatus))
ereport(lev,
@@ -4148,7 +4148,7 @@ BackendInitialize(Port *port)
if ((ret = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
remote_host, sizeof(remote_host),
remote_port, sizeof(remote_port),
(log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0)
(log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0)
ereport(WARNING,
(errmsg_internal("pg_getnameinfo_all() failed: %s",
gai_strerror(ret))));
@@ -4655,7 +4655,7 @@ internal_forkexec(int argc, char *argv[], Port *port)
pgwin32_deadchild_callback,
childinfo,
INFINITE,
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
ereport(FATAL,
(errmsg_internal("could not register process for wait: error code %lu",
GetLastError())));
@@ -4934,7 +4934,7 @@ ExitPostmaster(int status)
ereport(LOG,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg_internal("postmaster became multithreaded"),
errdetail("Please report this to <pgsql-bugs@postgresql.org>.")));
errdetail("Please report this to <pgsql-bugs@postgresql.org>.")));
#endif
/* should cleanup shared memory and kill all backends */
@@ -5013,7 +5013,7 @@ sigusr1_handler(SIGNAL_ARGS)
PgStatPID = pgstat_start();
ereport(LOG,
(errmsg("database system is ready to accept read only connections")));
(errmsg("database system is ready to accept read only connections")));
#ifdef USE_SYSTEMD
sd_notify(0, "READY=1");
@@ -5286,7 +5286,7 @@ StartChildProcess(AuxProcType type)
break;
case BgWriterProcess:
ereport(LOG,
(errmsg("could not fork background writer process: %m")));
(errmsg("could not fork background writer process: %m")));
break;
case CheckpointerProcess:
ereport(LOG,
@@ -5796,7 +5796,7 @@ maybe_start_bgworkers(void)
now = GetCurrentTimestamp();
if (!TimestampDifferenceExceeds(rw->rw_crashed_at, now,
rw->rw_worker.bgw_restart_time * 1000))
rw->rw_worker.bgw_restart_time * 1000))
{
/* Set flag to remember that we have workers to start later */
HaveCrashedWorker = true;

View File

@@ -630,8 +630,8 @@ SysLogger_Start(void)
*/
ereport(LOG,
(errmsg("redirecting log output to logging collector process"),
errhint("Future log output will appear in directory \"%s\".",
Log_directory)));
errhint("Future log output will appear in directory \"%s\".",
Log_directory)));
#ifndef WIN32
fflush(stdout);