mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -194,18 +194,18 @@ cleanup_directories_atexit(void)
|
||||
{
|
||||
if (made_new_pgdata || found_existing_pgdata)
|
||||
fprintf(stderr,
|
||||
_("%s: data directory \"%s\" not removed at user's request\n"),
|
||||
_("%s: data directory \"%s\" not removed at user's request\n"),
|
||||
progname, basedir);
|
||||
|
||||
if (made_new_xlogdir || found_existing_xlogdir)
|
||||
fprintf(stderr,
|
||||
_("%s: WAL directory \"%s\" not removed at user's request\n"),
|
||||
_("%s: WAL directory \"%s\" not removed at user's request\n"),
|
||||
progname, xlog_dir);
|
||||
}
|
||||
|
||||
if (made_tablespace_dirs || found_tablespace_dirs)
|
||||
fprintf(stderr,
|
||||
_("%s: changes to tablespace directories will not be undone\n"),
|
||||
_("%s: changes to tablespace directories will not be undone\n"),
|
||||
progname);
|
||||
}
|
||||
|
||||
@@ -332,13 +332,13 @@ usage(void)
|
||||
printf(_(" -D, --pgdata=DIRECTORY receive base backup into directory\n"));
|
||||
printf(_(" -F, --format=p|t output format (plain (default), tar)\n"));
|
||||
printf(_(" -r, --max-rate=RATE maximum transfer rate to transfer data directory\n"
|
||||
" (in kB/s, or use suffix \"k\" or \"M\")\n"));
|
||||
" (in kB/s, or use suffix \"k\" or \"M\")\n"));
|
||||
printf(_(" -R, --write-recovery-conf\n"
|
||||
" write recovery.conf for replication\n"));
|
||||
" write recovery.conf for replication\n"));
|
||||
printf(_(" -S, --slot=SLOTNAME replication slot to use\n"));
|
||||
printf(_(" --no-slot prevent creation of temporary replication slot\n"));
|
||||
printf(_(" -T, --tablespace-mapping=OLDDIR=NEWDIR\n"
|
||||
" relocate tablespace in OLDDIR to NEWDIR\n"));
|
||||
" relocate tablespace in OLDDIR to NEWDIR\n"));
|
||||
printf(_(" -X, --wal-method=none|fetch|stream\n"
|
||||
" include required WAL files with specified method\n"));
|
||||
printf(_(" --waldir=WALDIR location for the write-ahead log directory\n"));
|
||||
@@ -414,7 +414,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline,
|
||||
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
progname, xlogend);
|
||||
exit(1);
|
||||
}
|
||||
@@ -771,8 +771,8 @@ progress_report(int tablespacenum, const char *filename, bool force)
|
||||
tablespacenum, tablespacecount,
|
||||
/* Prefix with "..." if we do leading truncation */
|
||||
truncate ? "..." : "",
|
||||
truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
|
||||
truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
|
||||
truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
|
||||
truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
|
||||
/* Truncate filename at beginning if it's too long */
|
||||
truncate ? filename + strlen(filename) - VERBOSE_FILENAME_LENGTH + 3 : filename);
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
||||
if (gzclose(ztarfile) != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not close compressed file \"%s\": %s\n"),
|
||||
_("%s: could not close compressed file \"%s\": %s\n"),
|
||||
progname, filename, get_gz_error(ztarfile));
|
||||
disconnect_and_exit(1);
|
||||
}
|
||||
@@ -1412,11 +1412,11 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
|
||||
*/
|
||||
if (!((pg_str_endswith(filename, "/pg_wal") ||
|
||||
pg_str_endswith(filename, "/pg_xlog") ||
|
||||
pg_str_endswith(filename, "/archive_status")) &&
|
||||
pg_str_endswith(filename, "/archive_status")) &&
|
||||
errno == EEXIST))
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not create directory \"%s\": %s\n"),
|
||||
_("%s: could not create directory \"%s\": %s\n"),
|
||||
progname, filename, strerror(errno));
|
||||
disconnect_and_exit(1);
|
||||
}
|
||||
@@ -1758,7 +1758,7 @@ BaseBackup(void)
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
_("%s: initiating base backup, waiting for checkpoint to complete\n"),
|
||||
_("%s: initiating base backup, waiting for checkpoint to complete\n"),
|
||||
progname);
|
||||
|
||||
if (showprogress && !verbose)
|
||||
@@ -1907,14 +1907,14 @@ BaseBackup(void)
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not get write-ahead log end position from server: %s"),
|
||||
_("%s: could not get write-ahead log end position from server: %s"),
|
||||
progname, PQerrorMessage(conn));
|
||||
disconnect_and_exit(1);
|
||||
}
|
||||
if (PQntuples(res) != 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: no write-ahead log end position returned from server\n"),
|
||||
_("%s: no write-ahead log end position returned from server\n"),
|
||||
progname);
|
||||
disconnect_and_exit(1);
|
||||
}
|
||||
@@ -1998,7 +1998,7 @@ BaseBackup(void)
|
||||
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
progname, xlogend);
|
||||
disconnect_and_exit(1);
|
||||
}
|
||||
@@ -2312,7 +2312,7 @@ main(int argc, char **argv)
|
||||
if (format == 't' && includewal == STREAM_WAL && strcmp(basedir, "-") == 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: cannot stream write-ahead logs in tar mode to stdout\n"),
|
||||
_("%s: cannot stream write-ahead logs in tar mode to stdout\n"),
|
||||
progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
|
||||
progname);
|
||||
@@ -2322,7 +2322,7 @@ main(int argc, char **argv)
|
||||
if (replication_slot && includewal != STREAM_WAL)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: replication slots can only be used with WAL streaming\n"),
|
||||
_("%s: replication slots can only be used with WAL streaming\n"),
|
||||
progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
|
||||
progname);
|
||||
@@ -2405,7 +2405,7 @@ main(int argc, char **argv)
|
||||
* renamed to pg_wal in post-10 clusters.
|
||||
*/
|
||||
linkloc = psprintf("%s/%s", basedir,
|
||||
PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
|
||||
PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
|
||||
"pg_xlog" : "pg_wal");
|
||||
|
||||
#ifdef HAVE_SYMLINK
|
||||
|
@@ -405,7 +405,7 @@ StreamLog(void)
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
_("%s: starting log streaming at %X/%X (timeline %u)\n"),
|
||||
progname, (uint32) (stream.startpos >> 32), (uint32) stream.startpos,
|
||||
progname, (uint32) (stream.startpos >> 32), (uint32) stream.startpos,
|
||||
stream.timeline);
|
||||
|
||||
stream.stream_stop = stop_streaming;
|
||||
|
@@ -132,9 +132,9 @@ sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested)
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
_("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"),
|
||||
_("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"),
|
||||
progname,
|
||||
(uint32) (output_written_lsn >> 32), (uint32) output_written_lsn,
|
||||
(uint32) (output_written_lsn >> 32), (uint32) output_written_lsn,
|
||||
(uint32) (output_fsync_lsn >> 32), (uint32) output_fsync_lsn,
|
||||
replication_slot);
|
||||
|
||||
@@ -241,7 +241,7 @@ StreamLogicalLog(void)
|
||||
|
||||
/* Initiate the replication stream at specified location */
|
||||
appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X",
|
||||
replication_slot, (uint32) (startpos >> 32), (uint32) startpos);
|
||||
replication_slot, (uint32) (startpos >> 32), (uint32) startpos);
|
||||
|
||||
/* print options if there are any */
|
||||
if (noptions)
|
||||
@@ -570,7 +570,7 @@ StreamLogicalLog(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not write %u bytes to log file \"%s\": %s\n"),
|
||||
_("%s: could not write %u bytes to log file \"%s\": %s\n"),
|
||||
progname, bytes_left, outfile,
|
||||
strerror(errno));
|
||||
goto error;
|
||||
@@ -584,7 +584,7 @@ StreamLogicalLog(void)
|
||||
if (write(outfd, "\n", 1) != 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not write %u bytes to log file \"%s\": %s\n"),
|
||||
_("%s: could not write %u bytes to log file \"%s\": %s\n"),
|
||||
progname, 1, outfile,
|
||||
strerror(errno));
|
||||
goto error;
|
||||
|
@@ -116,7 +116,7 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
|
||||
if (size < 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not get size of write-ahead log file \"%s\": %s\n"),
|
||||
_("%s: could not get size of write-ahead log file \"%s\": %s\n"),
|
||||
progname, fn, stream->walmethod->getlasterror());
|
||||
return false;
|
||||
}
|
||||
@@ -191,8 +191,8 @@ close_walfile(StreamCtl *stream, XLogRecPtr pos)
|
||||
if (currpos == -1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not determine seek position in file \"%s\": %s\n"),
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
_("%s: could not determine seek position in file \"%s\": %s\n"),
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
stream->walmethod->close(walfile, CLOSE_UNLINK);
|
||||
walfile = NULL;
|
||||
|
||||
@@ -219,7 +219,7 @@ close_walfile(StreamCtl *stream, XLogRecPtr pos)
|
||||
if (r != 0)
|
||||
{
|
||||
fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
if (stream->timeline > atoi(PQgetvalue(res, 0, 1)))
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: starting timeline %u is not present in the server\n"),
|
||||
_("%s: starting timeline %u is not present in the server\n"),
|
||||
progname, stream->timeline);
|
||||
PQclear(res);
|
||||
return false;
|
||||
@@ -525,7 +525,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
if (stream->temp_slot)
|
||||
{
|
||||
snprintf(query, sizeof(query),
|
||||
"CREATE_REPLICATION_SLOT \"%s\" TEMPORARY PHYSICAL RESERVE_WAL",
|
||||
"CREATE_REPLICATION_SLOT \"%s\" TEMPORARY PHYSICAL RESERVE_WAL",
|
||||
stream->replication_slot);
|
||||
res = PQexec(conn, query);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
@@ -559,7 +559,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
{
|
||||
/* FIXME: we might send it ok, but get an error */
|
||||
fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
|
||||
progname, "TIMELINE_HISTORY", PQresultErrorMessage(res));
|
||||
progname, "TIMELINE_HISTORY", PQresultErrorMessage(res));
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@@ -652,7 +652,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
fprintf(stderr,
|
||||
_("%s: server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X\n"),
|
||||
progname,
|
||||
stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos,
|
||||
stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos,
|
||||
newtimeline, (uint32) (stream->startpos >> 32), (uint32) stream->startpos);
|
||||
goto error;
|
||||
}
|
||||
@@ -662,7 +662,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: unexpected termination of replication stream: %s"),
|
||||
_("%s: unexpected termination of replication stream: %s"),
|
||||
progname, PQresultErrorMessage(res));
|
||||
PQclear(res);
|
||||
goto error;
|
||||
@@ -710,7 +710,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
|
||||
error:
|
||||
if (walfile != NULL && stream->walmethod->close(walfile, CLOSE_NO_RENAME) != 0)
|
||||
fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
progname, current_walfile_name, stream->walmethod->getlasterror());
|
||||
walfile = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -750,7 +750,7 @@ ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos, uint32 *timeline)
|
||||
&startpos_xrecoff) != 2)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not parse next timeline's starting point \"%s\"\n"),
|
||||
_("%s: could not parse next timeline's starting point \"%s\"\n"),
|
||||
progname, PQgetvalue(res, 0, 1));
|
||||
return false;
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ ProcessXLogDataMsg(PGconn *conn, StreamCtl *stream, char *copybuf, int len,
|
||||
bytes_to_write) != bytes_to_write)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not write %u bytes to WAL file \"%s\": %s\n"),
|
||||
_("%s: could not write %u bytes to WAL file \"%s\": %s\n"),
|
||||
progname, bytes_to_write, current_walfile_name,
|
||||
stream->walmethod->getlasterror());
|
||||
return false;
|
||||
|
@@ -212,7 +212,7 @@ GetConnection(void)
|
||||
if (!tmpparam)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not determine server setting for integer_datetimes\n"),
|
||||
_("%s: could not determine server setting for integer_datetimes\n"),
|
||||
progname);
|
||||
PQfinish(tmpconn);
|
||||
exit(1);
|
||||
@@ -221,7 +221,7 @@ GetConnection(void)
|
||||
if (strcmp(tmpparam, "on") != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: integer_datetimes compile flag does not match server\n"),
|
||||
_("%s: integer_datetimes compile flag does not match server\n"),
|
||||
progname);
|
||||
PQfinish(tmpconn);
|
||||
exit(1);
|
||||
@@ -282,7 +282,7 @@ RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli,
|
||||
if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2)
|
||||
{
|
||||
fprintf(stderr,
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
_("%s: could not parse write-ahead log location \"%s\"\n"),
|
||||
progname, PQgetvalue(res, 0, 2));
|
||||
|
||||
PQclear(res);
|
||||
|
@@ -534,7 +534,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
|
||||
* We open the tar file only when we first try to write to it.
|
||||
*/
|
||||
tar_data->fd = open(tar_data->tarfilename,
|
||||
O_WRONLY | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR);
|
||||
O_WRONLY | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR);
|
||||
if (tar_data->fd < 0)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user