diff options
author | Tom Lane | 2017-06-21 19:18:54 +0000 |
---|---|---|
committer | Tom Lane | 2017-06-21 19:19:25 +0000 |
commit | c7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch) | |
tree | e85979fb1213a731b7b557f8a830df541f26b135 /src/backend/replication | |
parent | f669c09989bda894d6ba01634ccb229f0687c08a (diff) |
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
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/[email protected]
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/replication')
-rw-r--r-- | src/backend/replication/basebackup.c | 14 | ||||
-rw-r--r-- | src/backend/replication/logical/logical.c | 4 | ||||
-rw-r--r-- | src/backend/replication/logical/origin.c | 2 | ||||
-rw-r--r-- | src/backend/replication/logical/proto.c | 8 | ||||
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 8 | ||||
-rw-r--r-- | src/backend/replication/logical/snapbuild.c | 12 | ||||
-rw-r--r-- | src/backend/replication/logical/tablesync.c | 2 | ||||
-rw-r--r-- | src/backend/replication/logical/worker.c | 6 | ||||
-rw-r--r-- | src/backend/replication/slot.c | 2 | ||||
-rw-r--r-- | src/backend/replication/slotfuncs.c | 2 | ||||
-rw-r--r-- | src/backend/replication/syncrep.c | 2 | ||||
-rw-r--r-- | src/backend/replication/walreceiver.c | 3 | ||||
-rw-r--r-- | src/backend/replication/walsender.c | 24 |
13 files changed, 44 insertions, 45 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index f3671cf41ff..25ce7a7bd27 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -16,7 +16,7 @@ #include <unistd.h> #include <time.h> -#include "access/xlog_internal.h" /* for pg_start/stop_backup */ +#include "access/xlog_internal.h" /* for pg_start/stop_backup */ #include "catalog/catalog.h" #include "catalog/pg_type.h" #include "lib/stringinfo.h" @@ -273,8 +273,8 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) /* Send CopyOutResponse message */ pq_beginmessage(&buf, 'H'); - pq_sendbyte(&buf, 0); /* overall format */ - pq_sendint(&buf, 0, 2); /* natts */ + pq_sendbyte(&buf, 0); /* overall format */ + pq_sendint(&buf, 0, 2); /* natts */ pq_endmessage(&buf); if (ti->path == NULL) @@ -318,7 +318,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) Assert(lnext(lc) == NULL); } else - pq_putemptymessage('c'); /* CopyDone */ + pq_putemptymessage('c'); /* CopyDone */ } } PG_END_ENSURE_ERROR_CLEANUP(base_backup_cleanup, (Datum) 0); @@ -814,7 +814,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli) pq_sendstring(&buf, "recptr"); pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, TEXTOID, 4); /* type oid */ + pq_sendint(&buf, TEXTOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); pq_sendint(&buf, 0, 4); pq_sendint(&buf, 0, 2); @@ -827,7 +827,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli) * int8 may seem like a surprising data type for this, but in theory int4 * would not be wide enough for this, as TimeLineID is unsigned. */ - pq_sendint(&buf, INT8OID, 4); /* type oid */ + pq_sendint(&buf, INT8OID, 4); /* type oid */ pq_sendint(&buf, -1, 2); pq_sendint(&buf, 0, 4); pq_sendint(&buf, 0, 2); @@ -1115,7 +1115,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("tablespaces are not supported on this platform"))); continue; -#endif /* HAVE_READLINK */ +#endif /* HAVE_READLINK */ } else if (S_ISDIR(statbuf.st_mode)) { diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 33cb01b8d0e..f4d123ec05e 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -451,7 +451,7 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx) if (err) elog(ERROR, "%s", err); if (!record) - elog(ERROR, "no record found"); /* shouldn't happen */ + elog(ERROR, "no record found"); /* shouldn't happen */ startptr = InvalidXLogRecPtr; @@ -661,7 +661,7 @@ commit_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, /* Push callback + info on the error context stack */ state.ctx = ctx; state.callback_name = "commit"; - state.report_location = txn->final_lsn; /* beginning of commit record */ + state.report_location = txn->final_lsn; /* beginning of commit record */ errcallback.callback = output_plugin_error_callback; errcallback.arg = (void *) &state; errcallback.previous = error_context_stack; diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index 09206f29a0a..f73b1a6d6c8 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -147,7 +147,7 @@ typedef struct ReplicationStateCtl } ReplicationStateCtl; /* external variables */ -RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ +RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ XLogRecPtr replorigin_session_origin_lsn = InvalidXLogRecPtr; TimestampTz replorigin_session_origin_timestamp = 0; diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index ff348ff2a8c..e3230e1fa2a 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -194,9 +194,9 @@ logicalrep_write_update(StringInfo out, Relation rel, HeapTuple oldtuple, if (oldtuple != NULL) { if (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL) - pq_sendbyte(out, 'O'); /* old tuple follows */ + pq_sendbyte(out, 'O'); /* old tuple follows */ else - pq_sendbyte(out, 'K'); /* old key follows */ + pq_sendbyte(out, 'K'); /* old key follows */ logicalrep_write_tuple(out, rel, oldtuple); } @@ -424,12 +424,12 @@ logicalrep_write_tuple(StringInfo out, Relation rel, HeapTuple tuple) if (isnull[i]) { - pq_sendbyte(out, 'n'); /* null column */ + pq_sendbyte(out, 'n'); /* null column */ continue; } else if (att->attlen == -1 && VARATT_IS_EXTERNAL_ONDISK(values[i])) { - pq_sendbyte(out, 'u'); /* unchanged toast column */ + pq_sendbyte(out, 'u'); /* unchanged toast column */ continue; } diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 0182fb7fa72..4905207893a 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -62,7 +62,7 @@ #include "replication/logical.h" #include "replication/reorderbuffer.h" #include "replication/slot.h" -#include "replication/snapbuild.h" /* just for SnapBuildSnapDecRefcount */ +#include "replication/snapbuild.h" /* just for SnapBuildSnapDecRefcount */ #include "storage/bufmgr.h" #include "storage/fd.h" #include "storage/sinval.h" @@ -124,8 +124,8 @@ typedef struct ReorderBufferToastEnt Size num_chunks; /* number of chunks we've already seen */ Size size; /* combined size of chunks seen */ dlist_head chunks; /* linked list of chunks */ - struct varlena *reconstructed; /* reconstructed varlena now pointed - * to in main tup */ + struct varlena *reconstructed; /* reconstructed varlena now pointed to in + * main tup */ } ReorderBufferToastEnt; /* Disk serialization support datastructures */ @@ -157,7 +157,7 @@ static const Size max_changes_in_memory = 4096; * major bottleneck, especially when spilling to disk while decoding batch * workloads. */ -static const Size max_cached_tuplebufs = 4096 * 2; /* ~8MB */ +static const Size max_cached_tuplebufs = 4096 * 2; /* ~8MB */ /* --------------------------------------- * primary reorderbuffer support routines diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index e06aa0992a6..fc9dc525b3e 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -210,7 +210,7 @@ struct SnapBuild TransactionId was_xmax; size_t was_xcnt; /* number of used xip entries */ - size_t was_xcnt_space; /* allocated size of xip */ + size_t was_xcnt_space; /* allocated size of xip */ TransactionId *was_xip; /* running xacts array, xidComparator-sorted */ } was_running; @@ -336,7 +336,7 @@ AllocateSnapshotBuilder(ReorderBuffer *reorder, /* Other struct members initialized by zeroing via palloc0 above */ builder->committed.xcnt = 0; - builder->committed.xcnt_space = 128; /* arbitrary number */ + builder->committed.xcnt_space = 128; /* arbitrary number */ builder->committed.xip = palloc0(builder->committed.xcnt_space * sizeof(TransactionId)); builder->committed.includes_all_transactions = true; @@ -1248,8 +1248,8 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn builder->start_decoding_at = lsn + 1; /* As no transactions were running xmin/xmax can be trivially set. */ - builder->xmin = running->nextXid; /* < are finished */ - builder->xmax = running->nextXid; /* >= are running */ + builder->xmin = running->nextXid; /* < are finished */ + builder->xmax = running->nextXid; /* >= are running */ /* so we can safely use the faster comparisons */ Assert(TransactionIdIsNormal(builder->xmin)); @@ -1295,8 +1295,8 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn * currently running transactions have finished. We'll update both * while waiting for the pending transactions to finish. */ - builder->xmin = running->nextXid; /* < are finished */ - builder->xmax = running->nextXid; /* >= are running */ + builder->xmin = running->nextXid; /* < are finished */ + builder->xmax = running->nextXid; /* >= are running */ /* so we can safely use the faster comparisons */ Assert(TransactionIdIsNormal(builder->xmin)); diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 3ff08bfb2bf..d5577e38d25 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -812,7 +812,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) * NAMEDATALEN on the remote that matters, but this scheme will also work * reasonably if that is different.) */ - StaticAssertStmt(NAMEDATALEN >= 32, "NAMEDATALEN too small"); /* for sanity */ + StaticAssertStmt(NAMEDATALEN >= 32, "NAMEDATALEN too small"); /* for sanity */ slotname = psprintf("%.*s_%u_sync_%u", NAMEDATALEN - 28, MySubscription->slotname, diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 21a4fea821d..2288675ff2b 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -1290,9 +1290,9 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply) resetStringInfo(reply_message); pq_sendbyte(reply_message, 'r'); - pq_sendint64(reply_message, recvpos); /* write */ - pq_sendint64(reply_message, flushpos); /* flush */ - pq_sendint64(reply_message, writepos); /* apply */ + pq_sendint64(reply_message, recvpos); /* write */ + pq_sendint64(reply_message, flushpos); /* flush */ + pq_sendint64(reply_message, writepos); /* apply */ pq_sendint64(reply_message, now); /* sendTime */ pq_sendbyte(reply_message, requestReply); /* replyRequested */ diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index c0f7fbb2b29..4bc28162411 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -86,7 +86,7 @@ typedef struct ReplicationSlotOnDisk #define ReplicationSlotOnDiskV2Size \ sizeof(ReplicationSlotOnDisk) - ReplicationSlotOnDiskConstantSize -#define SLOT_MAGIC 0x1051CA1 /* format identifier */ +#define SLOT_MAGIC 0x1051CA1 /* format identifier */ #define SLOT_VERSION 2 /* version for new files */ /* Control array for replication slot management */ diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c index bbd26f3d6a3..6dc808874d6 100644 --- a/src/backend/replication/slotfuncs.c +++ b/src/backend/replication/slotfuncs.c @@ -132,7 +132,7 @@ pg_create_logical_replication_slot(PG_FUNCTION_ARGS) * Create logical decoding context, to build the initial snapshot. */ ctx = CreateInitDecodingContext(NameStr(*plugin), NIL, - false, /* do not build snapshot */ + false, /* do not build snapshot */ logical_read_local_xlog_page, NULL, NULL, NULL); diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index ad213fc454a..8092f01edda 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -888,7 +888,7 @@ SyncRepGetSyncStandbysPriority(bool *am_sync) if (list_length(result) == SyncRepConfig->num_sync) { list_free(pending); - return result; /* Exit if got enough sync standbys */ + return result; /* Exit if got enough sync standbys */ } /* diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index 01b86ffe8aa..8e64e8bf7aa 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -259,8 +259,7 @@ WalReceiverMain(void) walrcv->latch = &MyProc->procLatch; /* Properly accept or ignore signals the postmaster might send us */ - pqsignal(SIGHUP, WalRcvSigHupHandler); /* set flag to read config - * file */ + pqsignal(SIGHUP, WalRcvSigHupHandler); /* set flag to read config file */ pqsignal(SIGINT, SIG_IGN); pqsignal(SIGTERM, WalRcvShutdownHandler); /* request shutdown */ pqsignal(SIGQUIT, WalRcvQuickDieHandler); /* hard crash time */ diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index b61eaef6f57..71057aecfac 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -111,16 +111,16 @@ WalSndCtlData *WalSndCtl = NULL; WalSnd *MyWalSnd = NULL; /* Global state */ -bool am_walsender = false; /* Am I a walsender process? */ -bool am_cascading_walsender = false; /* Am I cascading WAL to - * another standby? */ +bool am_walsender = false; /* Am I a walsender process? */ +bool am_cascading_walsender = false; /* Am I cascading WAL to another + * standby? */ bool am_db_walsender = false; /* Connected to a database? */ /* User-settable parameters for walsender */ int max_wal_senders = 0; /* the maximum number of concurrent * walsenders */ -int wal_sender_timeout = 60 * 1000; /* maximum time to send one - * WAL data message */ +int wal_sender_timeout = 60 * 1000; /* maximum time to send one WAL + * data message */ bool log_replication_commands = false; /* @@ -450,16 +450,16 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd) pq_sendstring(&buf, "filename"); /* col name */ pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, TEXTOID, 4); /* type oid */ + pq_sendint(&buf, TEXTOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); /* typlen */ pq_sendint(&buf, 0, 4); /* typmod */ pq_sendint(&buf, 0, 2); /* format code */ /* second field */ - pq_sendstring(&buf, "content"); /* col name */ + pq_sendstring(&buf, "content"); /* col name */ pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, BYTEAOID, 4); /* type oid */ + pq_sendint(&buf, BYTEAOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); /* typlen */ pq_sendint(&buf, 0, 4); /* typmod */ pq_sendint(&buf, 0, 2); /* format code */ @@ -1748,7 +1748,7 @@ ProcessStandbyReplyMessage(void) writePtr = pq_getmsgint64(&reply_message); flushPtr = pq_getmsgint64(&reply_message); applyPtr = pq_getmsgint64(&reply_message); - (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ + (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ replyRequested = pq_getmsgbyte(&reply_message); elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s", @@ -1911,7 +1911,7 @@ ProcessStandbyHSFeedbackMessage(void) * byte. See XLogWalRcvSendHSFeedback() in walreceiver.c for the creation * of this message. */ - (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ + (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ feedbackXmin = pq_getmsgint(&reply_message, 4); feedbackEpoch = pq_getmsgint(&reply_message, 4); feedbackCatalogXmin = pq_getmsgint(&reply_message, 4); @@ -1978,7 +1978,7 @@ ProcessStandbyHSFeedbackMessage(void) * XXX: It might make sense to generalize the ephemeral slot concept and * always use the slot mechanism to handle the feedback xmin. */ - if (MyReplicationSlot != NULL) /* XXX: persistency configurable? */ + if (MyReplicationSlot != NULL) /* XXX: persistency configurable? */ PhysicalReplicationSlotNewXmin(feedbackXmin, feedbackCatalogXmin); else { @@ -2000,7 +2000,7 @@ ProcessStandbyHSFeedbackMessage(void) static long WalSndComputeSleeptime(TimestampTz now) { - long sleeptime = 10000; /* 10 s */ + long sleeptime = 10000; /* 10 s */ if (wal_sender_timeout > 0 && last_reply_timestamp > 0) { |