mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +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:
@@ -365,7 +365,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
dir = AllocateDir("pg_wal");
|
||||
if (!dir)
|
||||
ereport(ERROR,
|
||||
(errmsg("could not open directory \"%s\": %m", "pg_wal")));
|
||||
(errmsg("could not open directory \"%s\": %m", "pg_wal")));
|
||||
while ((de = ReadDir(dir, "pg_wal")) != NULL)
|
||||
{
|
||||
/* Does it look like a WAL segment, and is it in the range? */
|
||||
@@ -436,7 +436,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
|
||||
XLogFileName(nextfname, ThisTimeLineID, nextsegno);
|
||||
ereport(ERROR,
|
||||
(errmsg("could not find WAL file \"%s\"", nextfname)));
|
||||
(errmsg("could not find WAL file \"%s\"", nextfname)));
|
||||
}
|
||||
}
|
||||
if (segno != endsegno)
|
||||
@@ -484,7 +484,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
CheckXLogRemoved(segno, tli);
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("unexpected WAL file size \"%s\"", walFiles[i])));
|
||||
errmsg("unexpected WAL file size \"%s\"", walFiles[i])));
|
||||
}
|
||||
|
||||
/* send the WAL file itself */
|
||||
@@ -510,7 +510,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
CheckXLogRemoved(segno, tli);
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("unexpected WAL file size \"%s\"", walFiles[i])));
|
||||
errmsg("unexpected WAL file size \"%s\"", walFiles[i])));
|
||||
}
|
||||
|
||||
/* XLogSegSize is a multiple of 512, so no need for padding */
|
||||
@@ -652,7 +652,7 @@ parse_basebackup_options(List *options, basebackup_options *opt)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
errmsg("%d is outside the valid range for parameter \"%s\" (%d .. %d)",
|
||||
(int) maxrate, "MAX_RATE", MAX_RATE_LOWER, MAX_RATE_UPPER)));
|
||||
(int) maxrate, "MAX_RATE", MAX_RATE_LOWER, MAX_RATE_UPPER)));
|
||||
|
||||
opt->maxrate = (uint32) maxrate;
|
||||
o_maxrate = true;
|
||||
@@ -992,9 +992,9 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("the standby was promoted during online backup"),
|
||||
errhint("This means that the backup being taken is corrupt "
|
||||
"and should not be used. "
|
||||
"Try taking another online backup.")));
|
||||
errhint("This means that the backup being taken is corrupt "
|
||||
"and should not be used. "
|
||||
"Try taking another online backup.")));
|
||||
|
||||
/* Scan for files that should be excluded */
|
||||
excludeFound = false;
|
||||
@@ -1113,7 +1113,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
||||
*/
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
continue;
|
||||
#endif /* HAVE_READLINK */
|
||||
}
|
||||
@@ -1225,7 +1225,7 @@ sendFile(char *readfilename, char *tarfilename, struct stat *statbuf,
|
||||
/* Send the chunk as a CopyData message */
|
||||
if (pq_putmessage('d', buf, cnt))
|
||||
ereport(ERROR,
|
||||
(errmsg("base backup could not send data, aborting backup")));
|
||||
(errmsg("base backup could not send data, aborting backup")));
|
||||
|
||||
len += cnt;
|
||||
throttle(cnt);
|
||||
@@ -1281,7 +1281,7 @@ _tarWriteHeader(const char *filename, const char *linktarget,
|
||||
if (!sizeonly)
|
||||
{
|
||||
rc = tarCreateHeader(h, filename, linktarget, statbuf->st_size,
|
||||
statbuf->st_mode, statbuf->st_uid, statbuf->st_gid,
|
||||
statbuf->st_mode, statbuf->st_uid, statbuf->st_gid,
|
||||
statbuf->st_mtime);
|
||||
|
||||
switch (rc)
|
||||
@@ -1295,9 +1295,9 @@ _tarWriteHeader(const char *filename, const char *linktarget,
|
||||
break;
|
||||
case TAR_SYMLINK_TOO_LONG:
|
||||
ereport(ERROR,
|
||||
(errmsg("symbolic link target too long for tar format: "
|
||||
"file name \"%s\", target \"%s\"",
|
||||
filename, linktarget)));
|
||||
(errmsg("symbolic link target too long for tar format: "
|
||||
"file name \"%s\", target \"%s\"",
|
||||
filename, linktarget)));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized tar error: %d", rc);
|
||||
@@ -1366,7 +1366,7 @@ throttle(size_t increment)
|
||||
* the maximum time to sleep. Thus the cast to long is safe.
|
||||
*/
|
||||
wait_result = WaitLatch(MyLatch,
|
||||
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
|
||||
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
|
||||
(long) (sleep / 1000),
|
||||
WAIT_EVENT_BASE_BACKUP_THROTTLE);
|
||||
|
||||
|
||||
@@ -425,8 +425,8 @@ libpqrcv_endstreaming(WalReceiverConn *conn, TimeLineID *next_tli)
|
||||
if (PQputCopyEnd(conn->streamConn, NULL) <= 0 ||
|
||||
PQflush(conn->streamConn))
|
||||
ereport(ERROR,
|
||||
(errmsg("could not send end-of-streaming message to primary: %s",
|
||||
pchomp(PQerrorMessage(conn->streamConn)))));
|
||||
(errmsg("could not send end-of-streaming message to primary: %s",
|
||||
pchomp(PQerrorMessage(conn->streamConn)))));
|
||||
|
||||
*next_tli = 0;
|
||||
|
||||
@@ -797,7 +797,7 @@ libpqrcv_create_slot(WalReceiverConn *conn, const char *slotname,
|
||||
}
|
||||
|
||||
*lsn = DatumGetLSN(DirectFunctionCall1Coll(pg_lsn_in, InvalidOid,
|
||||
CStringGetDatum(PQgetvalue(res, 0, 1))));
|
||||
CStringGetDatum(PQgetvalue(res, 0, 1))));
|
||||
if (!PQgetisnull(res, 0, 2))
|
||||
snapshot = pstrdup(PQgetvalue(res, 0, 2));
|
||||
else
|
||||
@@ -896,7 +896,7 @@ libpqrcv_exec(WalReceiverConn *conn, const char *query,
|
||||
if (MyDatabaseId == InvalidOid)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("the query interface requires a database connection")));
|
||||
errmsg("the query interface requires a database connection")));
|
||||
|
||||
pgres = libpqrcv_PQexec(conn->streamConn, query);
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ DecodeStandbyOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
|
||||
(xl_invalidations *) XLogRecGetData(r);
|
||||
|
||||
ReorderBufferImmediateInvalidation(
|
||||
ctx->reorder, invalidations->nmsgs, invalidations->msgs);
|
||||
ctx->reorder, invalidations->nmsgs, invalidations->msgs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -265,8 +265,8 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
|
||||
TimestampTz now;
|
||||
|
||||
ereport(DEBUG1,
|
||||
(errmsg("starting logical replication worker for subscription \"%s\"",
|
||||
subname)));
|
||||
(errmsg("starting logical replication worker for subscription \"%s\"",
|
||||
subname)));
|
||||
|
||||
/* Report this after the initial starting message for consistency. */
|
||||
if (max_replication_slots == 0)
|
||||
@@ -399,7 +399,7 @@ retry:
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
|
||||
errmsg("out of background worker slots"),
|
||||
errhint("You might need to increase max_worker_processes.")));
|
||||
errhint("You might need to increase max_worker_processes.")));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -556,8 +556,8 @@ logicalrep_worker_attach(int slot)
|
||||
LWLockRelease(LogicalRepWorkerLock);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("logical replication worker slot %d is empty, cannot attach",
|
||||
slot)));
|
||||
errmsg("logical replication worker slot %d is empty, cannot attach",
|
||||
slot)));
|
||||
}
|
||||
|
||||
if (MyLogicalRepWorker->proc)
|
||||
@@ -565,8 +565,8 @@ logicalrep_worker_attach(int slot)
|
||||
LWLockRelease(LogicalRepWorkerLock);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("logical replication worker slot %d is already used by "
|
||||
"another worker, cannot attach", slot)));
|
||||
errmsg("logical replication worker slot %d is already used by "
|
||||
"another worker, cannot attach", slot)));
|
||||
}
|
||||
|
||||
MyLogicalRepWorker->proc = MyProc;
|
||||
@@ -829,7 +829,7 @@ ApplyLauncherMain(Datum main_arg)
|
||||
{
|
||||
/* Use temporary context for the database list and worker info. */
|
||||
subctx = AllocSetContextCreate(TopMemoryContext,
|
||||
"Logical Replication Launcher sublist",
|
||||
"Logical Replication Launcher sublist",
|
||||
ALLOCSET_DEFAULT_MINSIZE,
|
||||
ALLOCSET_DEFAULT_INITSIZE,
|
||||
ALLOCSET_DEFAULT_MAXSIZE);
|
||||
|
||||
@@ -64,7 +64,7 @@ static void change_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
|
||||
Relation relation, ReorderBufferChange *change);
|
||||
static void message_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
|
||||
XLogRecPtr message_lsn, bool transactional,
|
||||
const char *prefix, Size message_size, const char *message);
|
||||
const char *prefix, Size message_size, const char *message);
|
||||
|
||||
static void LoadOutputPlugin(OutputPluginCallbacks *callbacks, char *plugin);
|
||||
|
||||
@@ -103,7 +103,7 @@ CheckLogicalDecodingRequirements(void)
|
||||
if (RecoveryInProgress())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("logical decoding cannot be used while in recovery")));
|
||||
errmsg("logical decoding cannot be used while in recovery")));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -118,7 +118,7 @@ StartupDecodingContext(List *output_plugin_options,
|
||||
XLogPageReadCB read_page,
|
||||
LogicalOutputPluginWriterPrepareWrite prepare_write,
|
||||
LogicalOutputPluginWriterWrite do_write,
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress)
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress)
|
||||
{
|
||||
ReplicationSlot *slot;
|
||||
MemoryContext context,
|
||||
@@ -219,7 +219,7 @@ CreateInitDecodingContext(char *plugin,
|
||||
XLogPageReadCB read_page,
|
||||
LogicalOutputPluginWriterPrepareWrite prepare_write,
|
||||
LogicalOutputPluginWriterWrite do_write,
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress)
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress)
|
||||
{
|
||||
TransactionId xmin_horizon = InvalidTransactionId;
|
||||
ReplicationSlot *slot;
|
||||
@@ -240,13 +240,13 @@ CreateInitDecodingContext(char *plugin,
|
||||
if (SlotIsPhysical(slot))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("cannot use physical replication slot for logical decoding")));
|
||||
errmsg("cannot use physical replication slot for logical decoding")));
|
||||
|
||||
if (slot->data.database != MyDatabaseId)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("replication slot \"%s\" was not created in this database",
|
||||
NameStr(slot->data.name))));
|
||||
errmsg("replication slot \"%s\" was not created in this database",
|
||||
NameStr(slot->data.name))));
|
||||
|
||||
if (IsTransactionState() &&
|
||||
GetTopTransactionIdIfAny() != InvalidTransactionId)
|
||||
@@ -367,8 +367,8 @@ CreateDecodingContext(XLogRecPtr start_lsn,
|
||||
if (slot->data.database != MyDatabaseId)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
(errmsg("replication slot \"%s\" was not created in this database",
|
||||
NameStr(slot->data.name)))));
|
||||
(errmsg("replication slot \"%s\" was not created in this database",
|
||||
NameStr(slot->data.name)))));
|
||||
|
||||
if (start_lsn == InvalidXLogRecPtr)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ LogicalOutputWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xi
|
||||
|
||||
/* ick, but cstring_to_text_with_len works for bytea perfectly fine */
|
||||
values[2] = PointerGetDatum(
|
||||
cstring_to_text_with_len(ctx->out->data, ctx->out->len));
|
||||
cstring_to_text_with_len(ctx->out->data, ctx->out->len));
|
||||
|
||||
tuplestore_putvalues(p->tupstore, p->tupdesc, values, nulls);
|
||||
p->returned_rows++;
|
||||
@@ -116,7 +116,7 @@ check_permissions(void)
|
||||
|
||||
int
|
||||
logical_read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr,
|
||||
int reqLen, XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI)
|
||||
int reqLen, XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI)
|
||||
{
|
||||
return read_local_xlog_page(state, targetPagePtr, reqLen,
|
||||
targetRecPtr, cur_page, pageTLI);
|
||||
|
||||
@@ -187,7 +187,7 @@ replorigin_check_prerequisites(bool check_slots, bool recoveryOK)
|
||||
if (!recoveryOK && RecoveryInProgress())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
|
||||
errmsg("cannot manipulate replication origins during recovery")));
|
||||
errmsg("cannot manipulate replication origins during recovery")));
|
||||
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ ReplicationOriginShmemSize(void)
|
||||
size = add_size(size, offsetof(ReplicationStateCtl, states));
|
||||
|
||||
size = add_size(size,
|
||||
mul_size(max_replication_slots, sizeof(ReplicationState)));
|
||||
mul_size(max_replication_slots, sizeof(ReplicationState)));
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -664,8 +664,8 @@ StartupReplicationOrigin(void)
|
||||
|
||||
if (magic != REPLICATION_STATE_MAGIC)
|
||||
ereport(PANIC,
|
||||
(errmsg("replication checkpoint has wrong magic %u instead of %u",
|
||||
magic, REPLICATION_STATE_MAGIC)));
|
||||
(errmsg("replication checkpoint has wrong magic %u instead of %u",
|
||||
magic, REPLICATION_STATE_MAGIC)));
|
||||
|
||||
/* we can skip locking here, no other access is possible */
|
||||
|
||||
@@ -997,7 +997,7 @@ replorigin_session_setup(RepOriginId node)
|
||||
if (session_replication_state != NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("cannot setup replication origin when one is already setup")));
|
||||
errmsg("cannot setup replication origin when one is already setup")));
|
||||
|
||||
/* Lock exclusively, as we may have to create a new table entry. */
|
||||
LWLockAcquire(ReplicationOriginLock, LW_EXCLUSIVE);
|
||||
@@ -1026,8 +1026,8 @@ replorigin_session_setup(RepOriginId node)
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_IN_USE),
|
||||
errmsg("replication identifier %d is already active for PID %d",
|
||||
curstate->roident, curstate->acquired_by)));
|
||||
errmsg("replication identifier %d is already active for PID %d",
|
||||
curstate->roident, curstate->acquired_by)));
|
||||
}
|
||||
|
||||
/* ok, found slot */
|
||||
|
||||
@@ -283,7 +283,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
|
||||
continue;
|
||||
|
||||
attnum = logicalrep_rel_att_by_name(remoterel,
|
||||
NameStr(desc->attrs[i]->attname));
|
||||
NameStr(desc->attrs[i]->attname));
|
||||
|
||||
entry->attrmap[i] = attnum;
|
||||
if (attnum >= 0)
|
||||
@@ -294,9 +294,9 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
|
||||
if (found < remoterel->natts)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("logical replication target relation \"%s.%s\" is missing "
|
||||
"some replicated columns",
|
||||
remoterel->nspname, remoterel->relname)));
|
||||
errmsg("logical replication target relation \"%s.%s\" is missing "
|
||||
"some replicated columns",
|
||||
remoterel->nspname, remoterel->relname)));
|
||||
|
||||
/*
|
||||
* Check that replica identity matches. We allow for stricter replica
|
||||
@@ -334,9 +334,9 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
|
||||
if (!AttrNumberIsForUserDefinedAttr(attnum))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("logical replication target relation \"%s.%s\" uses "
|
||||
"system columns in REPLICA IDENTITY index",
|
||||
remoterel->nspname, remoterel->relname)));
|
||||
errmsg("logical replication target relation \"%s.%s\" uses "
|
||||
"system columns in REPLICA IDENTITY index",
|
||||
remoterel->nspname, remoterel->relname)));
|
||||
|
||||
attnum = AttrNumberGetAttrOffset(attnum);
|
||||
|
||||
|
||||
@@ -1403,7 +1403,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
|
||||
Assert(snapshot_now);
|
||||
|
||||
reloid = RelidByRelfilenode(change->data.tp.relnode.spcNode,
|
||||
change->data.tp.relnode.relNode);
|
||||
change->data.tp.relnode.relNode);
|
||||
|
||||
/*
|
||||
* Catalog tuple without data, emitted while catalog was
|
||||
@@ -1565,7 +1565,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
|
||||
{
|
||||
/* we don't use the global one anymore */
|
||||
snapshot_now = ReorderBufferCopySnap(rb, snapshot_now,
|
||||
txn, command_id);
|
||||
txn, command_id);
|
||||
}
|
||||
|
||||
snapshot_now->curcid = command_id;
|
||||
@@ -2384,7 +2384,7 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
else if (readBytes < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read from reorderbuffer spill file: %m")));
|
||||
errmsg("could not read from reorderbuffer spill file: %m")));
|
||||
else if (readBytes != sizeof(ReorderBufferDiskChange))
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
@@ -2395,7 +2395,7 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
ondisk = (ReorderBufferDiskChange *) rb->outbuf;
|
||||
|
||||
ReorderBufferSerializeReserve(rb,
|
||||
sizeof(ReorderBufferDiskChange) + ondisk->size);
|
||||
sizeof(ReorderBufferDiskChange) + ondisk->size);
|
||||
ondisk = (ReorderBufferDiskChange *) rb->outbuf;
|
||||
|
||||
pgstat_report_wait_start(WAIT_EVENT_REORDER_BUFFER_READ);
|
||||
@@ -2406,13 +2406,13 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
if (readBytes < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read from reorderbuffer spill file: %m")));
|
||||
errmsg("could not read from reorderbuffer spill file: %m")));
|
||||
else if (readBytes != ondisk->size - sizeof(ReorderBufferDiskChange))
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read from reorderbuffer spill file: read %d instead of %u bytes",
|
||||
readBytes,
|
||||
(uint32) (ondisk->size - sizeof(ReorderBufferDiskChange)))));
|
||||
(uint32) (ondisk->size - sizeof(ReorderBufferDiskChange)))));
|
||||
|
||||
/*
|
||||
* ok, read a full change from disk, now restore it into proper
|
||||
@@ -2521,7 +2521,7 @@ ReorderBufferRestoreChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
memcpy(&change->data.msg.message_size, data, sizeof(Size));
|
||||
data += sizeof(Size);
|
||||
change->data.msg.message = MemoryContextAlloc(rb->context,
|
||||
change->data.msg.message_size);
|
||||
change->data.msg.message_size);
|
||||
memcpy(change->data.msg.message, data,
|
||||
change->data.msg.message_size);
|
||||
data += change->data.msg.message_size;
|
||||
@@ -2867,7 +2867,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
cchange = dlist_container(ReorderBufferChange, node, it.cur);
|
||||
ctup = cchange->data.tp.newtuple;
|
||||
chunk = DatumGetPointer(
|
||||
fastgetattr(&ctup->tuple, 3, toast_desc, &isnull));
|
||||
fastgetattr(&ctup->tuple, 3, toast_desc, &isnull));
|
||||
|
||||
Assert(!isnull);
|
||||
Assert(!VARATT_IS_EXTERNAL(chunk));
|
||||
|
||||
@@ -662,7 +662,7 @@ SnapBuildExportSnapshot(SnapBuild *builder)
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg_plural("exported logical decoding snapshot: \"%s\" with %u transaction ID",
|
||||
"exported logical decoding snapshot: \"%s\" with %u transaction IDs",
|
||||
"exported logical decoding snapshot: \"%s\" with %u transaction IDs",
|
||||
snap->xcnt,
|
||||
snapname, snap->xcnt)));
|
||||
return snapname;
|
||||
@@ -866,7 +866,7 @@ SnapBuildAddCommittedTxn(SnapBuild *builder, TransactionId xid)
|
||||
(uint32) builder->committed.xcnt_space);
|
||||
|
||||
builder->committed.xip = repalloc(builder->committed.xip,
|
||||
builder->committed.xcnt_space * sizeof(TransactionId));
|
||||
builder->committed.xcnt_space * sizeof(TransactionId));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1169,10 +1169,10 @@ SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, xl_running_xact
|
||||
* we have one.
|
||||
*/
|
||||
else if (txn == NULL &&
|
||||
builder->reorder->current_restart_decoding_lsn != InvalidXLogRecPtr &&
|
||||
builder->reorder->current_restart_decoding_lsn != InvalidXLogRecPtr &&
|
||||
builder->last_serialized_snapshot != InvalidXLogRecPtr)
|
||||
LogicalIncreaseRestartDecodingForSlot(lsn,
|
||||
builder->last_serialized_snapshot);
|
||||
builder->last_serialized_snapshot);
|
||||
}
|
||||
|
||||
|
||||
@@ -1222,8 +1222,8 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("skipping snapshot at %X/%X while building logical decoding snapshot, xmin horizon too low",
|
||||
(uint32) (lsn >> 32), (uint32) lsn),
|
||||
errdetail_internal("initial xmin horizon of %u vs the snapshot's %u",
|
||||
builder->initial_xmin_horizon, running->oldestRunningXid)));
|
||||
errdetail_internal("initial xmin horizon of %u vs the snapshot's %u",
|
||||
builder->initial_xmin_horizon, running->oldestRunningXid)));
|
||||
|
||||
|
||||
SnapBuildWaitSnapshot(running, builder->initial_xmin_horizon);
|
||||
@@ -1303,10 +1303,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
|
||||
Assert(TransactionIdIsNormal(builder->xmax));
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("logical decoding found initial starting point at %X/%X",
|
||||
(uint32) (lsn >> 32), (uint32) lsn),
|
||||
errdetail("Waiting for transactions (approximately %d) older than %u to end.",
|
||||
running->xcnt, running->nextXid)));
|
||||
(errmsg("logical decoding found initial starting point at %X/%X",
|
||||
(uint32) (lsn >> 32), (uint32) lsn),
|
||||
errdetail("Waiting for transactions (approximately %d) older than %u to end.",
|
||||
running->xcnt, running->nextXid)));
|
||||
|
||||
SnapBuildWaitSnapshot(running, running->nextXid);
|
||||
}
|
||||
@@ -1327,10 +1327,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
|
||||
SnapBuildStartNextPhaseAt(builder, running->nextXid);
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("logical decoding found initial consistent point at %X/%X",
|
||||
(uint32) (lsn >> 32), (uint32) lsn),
|
||||
errdetail("Waiting for transactions (approximately %d) older than %u to end.",
|
||||
running->xcnt, running->nextXid)));
|
||||
(errmsg("logical decoding found initial consistent point at %X/%X",
|
||||
(uint32) (lsn >> 32), (uint32) lsn),
|
||||
errdetail("Waiting for transactions (approximately %d) older than %u to end.",
|
||||
running->xcnt, running->nextXid)));
|
||||
|
||||
SnapBuildWaitSnapshot(running, running->nextXid);
|
||||
}
|
||||
@@ -1570,7 +1570,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
|
||||
INIT_CRC32C(ondisk->checksum);
|
||||
COMP_CRC32C(ondisk->checksum,
|
||||
((char *) ondisk) + SnapBuildOnDiskNotChecksummedSize,
|
||||
SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize);
|
||||
SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize);
|
||||
ondisk_c += sizeof(SnapBuildOnDisk);
|
||||
|
||||
memcpy(&ondisk->builder, builder, sizeof(SnapBuild));
|
||||
@@ -1729,7 +1729,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
|
||||
INIT_CRC32C(checksum);
|
||||
COMP_CRC32C(checksum,
|
||||
((char *) &ondisk) + SnapBuildOnDiskNotChecksummedSize,
|
||||
SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize);
|
||||
SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize);
|
||||
|
||||
/* read SnapBuild */
|
||||
pgstat_report_wait_start(WAIT_EVENT_SNAPBUILD_READ);
|
||||
|
||||
@@ -186,7 +186,7 @@ wait_for_relation_state_change(Oid relid, char expected_state)
|
||||
|
||||
/* Check if the opposite worker is still running and bail if not. */
|
||||
worker = logicalrep_worker_find(MyLogicalRepWorker->subid,
|
||||
am_tablesync_worker() ? InvalidOid : relid,
|
||||
am_tablesync_worker() ? InvalidOid : relid,
|
||||
false);
|
||||
LWLockRelease(LogicalRepWorkerLock);
|
||||
if (!worker)
|
||||
@@ -682,7 +682,7 @@ fetch_remote_table_info(char *nspname, char *relname,
|
||||
" a.attnum = ANY(i.indkey)"
|
||||
" FROM pg_catalog.pg_attribute a"
|
||||
" LEFT JOIN pg_catalog.pg_index i"
|
||||
" ON (i.indexrelid = pg_get_replica_identity_index(%u))"
|
||||
" ON (i.indexrelid = pg_get_replica_identity_index(%u))"
|
||||
" WHERE a.attnum > 0::pg_catalog.int2"
|
||||
" AND NOT a.attisdropped"
|
||||
" AND a.attrelid = %u"
|
||||
|
||||
@@ -628,7 +628,7 @@ check_relation_updatable(LogicalRepRelMapEntry *rel)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("publisher does not send replica identity column "
|
||||
"expected by the logical replication target relation \"%s.%s\"",
|
||||
"expected by the logical replication target relation \"%s.%s\"",
|
||||
rel->remoterel.nspname, rel->remoterel.relname)));
|
||||
}
|
||||
|
||||
@@ -908,7 +908,7 @@ apply_dispatch(StringInfo s)
|
||||
default:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||
errmsg("invalid logical replication message type %c", action)));
|
||||
errmsg("invalid logical replication message type %c", action)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
|
||||
if (!ping_sent)
|
||||
{
|
||||
timeout = TimestampTzPlusMilliseconds(last_recv_timestamp,
|
||||
(wal_receiver_timeout / 2));
|
||||
(wal_receiver_timeout / 2));
|
||||
if (now >= timeout)
|
||||
{
|
||||
requestReply = true;
|
||||
@@ -1375,7 +1375,7 @@ maybe_reread_subscription(void)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication apply worker for subscription \"%s\" will "
|
||||
"restart because the connection information was changed",
|
||||
"restart because the connection information was changed",
|
||||
MySubscription->name)));
|
||||
|
||||
proc_exit(0);
|
||||
@@ -1406,7 +1406,7 @@ maybe_reread_subscription(void)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication apply worker for subscription \"%s\" will "
|
||||
"restart because the replication slot name was changed",
|
||||
"restart because the replication slot name was changed",
|
||||
MySubscription->name)));
|
||||
|
||||
proc_exit(0);
|
||||
@@ -1420,7 +1420,7 @@ maybe_reread_subscription(void)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication apply worker for subscription \"%s\" will "
|
||||
"restart because subscription's publications were changed",
|
||||
"restart because subscription's publications were changed",
|
||||
MySubscription->name)));
|
||||
|
||||
proc_exit(0);
|
||||
@@ -1528,7 +1528,7 @@ ApplyWorkerMain(Datum main_arg)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication apply worker for subscription \"%s\" will not "
|
||||
"start because the subscription was disabled during startup",
|
||||
"start because the subscription was disabled during startup",
|
||||
MySubscription->name)));
|
||||
|
||||
proc_exit(0);
|
||||
@@ -1542,7 +1542,7 @@ ApplyWorkerMain(Datum main_arg)
|
||||
if (am_tablesync_worker())
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has started",
|
||||
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
|
||||
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
|
||||
else
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication apply worker for subscription \"%s\" has started",
|
||||
|
||||
@@ -150,7 +150,7 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
|
||||
|
||||
/* Create our memory context for private allocations. */
|
||||
data->context = AllocSetContextCreate(ctx->context,
|
||||
"logical replication output context",
|
||||
"logical replication output context",
|
||||
ALLOCSET_DEFAULT_MINSIZE,
|
||||
ALLOCSET_DEFAULT_INITSIZE,
|
||||
ALLOCSET_DEFAULT_MAXSIZE);
|
||||
@@ -177,13 +177,13 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("client sent proto_version=%d but we only support protocol %d or lower",
|
||||
data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));
|
||||
data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));
|
||||
|
||||
if (data->protocol_version < LOGICALREP_PROTO_MIN_VERSION_NUM)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("client sent proto_version=%d but we only support protocol %d or higher",
|
||||
data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM)));
|
||||
data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM)));
|
||||
|
||||
if (list_length(data->publication_names) < 1)
|
||||
ereport(ERROR,
|
||||
|
||||
@@ -200,8 +200,8 @@ ReplicationSlotValidateName(const char *name, int elevel)
|
||||
{
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_INVALID_NAME),
|
||||
errmsg("replication slot name \"%s\" contains invalid character",
|
||||
name),
|
||||
errmsg("replication slot name \"%s\" contains invalid character",
|
||||
name),
|
||||
errhint("Replication slot names may only contain lower case letters, numbers, and the underscore character.")));
|
||||
return false;
|
||||
}
|
||||
@@ -1352,15 +1352,15 @@ RestoreSlotFromDisk(const char *name)
|
||||
if (cp.version != SLOT_VERSION)
|
||||
ereport(PANIC,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("replication slot file \"%s\" has unsupported version %u",
|
||||
path, cp.version)));
|
||||
errmsg("replication slot file \"%s\" has unsupported version %u",
|
||||
path, cp.version)));
|
||||
|
||||
/* boundary check on length */
|
||||
if (cp.length != ReplicationSlotOnDiskV2Size)
|
||||
ereport(PANIC,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("replication slot file \"%s\" has corrupted length %u",
|
||||
path, cp.length)));
|
||||
errmsg("replication slot file \"%s\" has corrupted length %u",
|
||||
path, cp.length)));
|
||||
|
||||
/* Now that we know the size, read the entire file */
|
||||
pgstat_report_wait_start(WAIT_EVENT_REPLICATION_SLOT_READ);
|
||||
|
||||
@@ -393,8 +393,8 @@ SyncRepInitConfig(void)
|
||||
MyWalSnd->sync_standby_priority = priority;
|
||||
LWLockRelease(SyncRepLock);
|
||||
ereport(DEBUG1,
|
||||
(errmsg("standby \"%s\" now has synchronous standby priority %u",
|
||||
application_name, priority)));
|
||||
(errmsg("standby \"%s\" now has synchronous standby priority %u",
|
||||
application_name, priority)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ SyncRepReleaseWaiters(void)
|
||||
if (SyncRepConfig->syncrep_method == SYNC_REP_PRIORITY)
|
||||
ereport(LOG,
|
||||
(errmsg("standby \"%s\" is now a synchronous standby with priority %u",
|
||||
application_name, MyWalSnd->sync_standby_priority)));
|
||||
application_name, MyWalSnd->sync_standby_priority)));
|
||||
else
|
||||
ereport(LOG,
|
||||
(errmsg("standby \"%s\" is now a candidate for quorum synchronous standby",
|
||||
@@ -606,7 +606,7 @@ SyncRepGetOldestSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr,
|
||||
*/
|
||||
static void
|
||||
SyncRepGetNthLatestSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr,
|
||||
XLogRecPtr *applyPtr, List *sync_standbys, uint8 nth)
|
||||
XLogRecPtr *applyPtr, List *sync_standbys, uint8 nth)
|
||||
{
|
||||
ListCell *cell;
|
||||
XLogRecPtr *write_array;
|
||||
|
||||
@@ -385,13 +385,13 @@ WalReceiverMain(void)
|
||||
if (first_stream)
|
||||
ereport(LOG,
|
||||
(errmsg("started streaming WAL from primary at %X/%X on timeline %u",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint,
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint,
|
||||
startpointTLI)));
|
||||
else
|
||||
ereport(LOG,
|
||||
(errmsg("restarted WAL streaming at %X/%X on timeline %u",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint,
|
||||
startpointTLI)));
|
||||
(errmsg("restarted WAL streaming at %X/%X on timeline %u",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint,
|
||||
startpointTLI)));
|
||||
first_stream = false;
|
||||
|
||||
/* Initialize LogstreamResult and buffers for processing messages */
|
||||
@@ -493,7 +493,7 @@ WalReceiverMain(void)
|
||||
*/
|
||||
Assert(wait_fd != PGINVALID_SOCKET);
|
||||
rc = WaitLatchOrSocket(walrcv->latch,
|
||||
WL_POSTMASTER_DEATH | WL_SOCKET_READABLE |
|
||||
WL_POSTMASTER_DEATH | WL_SOCKET_READABLE |
|
||||
WL_TIMEOUT | WL_LATCH_SET,
|
||||
wait_fd,
|
||||
NAPTIME_PER_CYCLE,
|
||||
@@ -560,7 +560,7 @@ WalReceiverMain(void)
|
||||
if (!ping_sent)
|
||||
{
|
||||
timeout = TimestampTzPlusMilliseconds(last_recv_timestamp,
|
||||
(wal_receiver_timeout / 2));
|
||||
(wal_receiver_timeout / 2));
|
||||
if (now >= timeout)
|
||||
{
|
||||
requestReply = true;
|
||||
@@ -1002,9 +1002,9 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr)
|
||||
if (lseek(recvFile, (off_t) startoff, SEEK_SET) < 0)
|
||||
ereport(PANIC,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek in log segment %s to offset %u: %m",
|
||||
XLogFileNameP(recvFileTLI, recvSegNo),
|
||||
startoff)));
|
||||
errmsg("could not seek in log segment %s to offset %u: %m",
|
||||
XLogFileNameP(recvFileTLI, recvSegNo),
|
||||
startoff)));
|
||||
recvOff = startoff;
|
||||
}
|
||||
|
||||
@@ -1474,5 +1474,5 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
|
||||
|
||||
/* Returns the record as Datum */
|
||||
PG_RETURN_DATUM(HeapTupleGetDatum(
|
||||
heap_form_tuple(tupdesc, values, nulls)));
|
||||
heap_form_tuple(tupdesc, values, nulls)));
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
|
||||
if (lseek(fd, 0, SEEK_SET) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek to beginning of file \"%s\": %m", path)));
|
||||
errmsg("could not seek to beginning of file \"%s\": %m", path)));
|
||||
|
||||
pq_sendint(&buf, histfilelen, 4); /* col2 len */
|
||||
|
||||
@@ -528,7 +528,7 @@ StartReplication(StartReplicationCmd *cmd)
|
||||
if (ThisTimeLineID == 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("IDENTIFY_SYSTEM has not been run before START_REPLICATION")));
|
||||
errmsg("IDENTIFY_SYSTEM has not been run before START_REPLICATION")));
|
||||
|
||||
/*
|
||||
* We assume here that we're logging enough information in the WAL for
|
||||
@@ -750,7 +750,7 @@ StartReplication(StartReplicationCmd *cmd)
|
||||
*/
|
||||
static int
|
||||
logical_read_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen,
|
||||
XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI)
|
||||
XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI)
|
||||
{
|
||||
XLogRecPtr flushptr;
|
||||
int count;
|
||||
@@ -2059,7 +2059,7 @@ WalSndCheckTimeOut(TimestampTz now)
|
||||
* standby.
|
||||
*/
|
||||
ereport(COMMERROR,
|
||||
(errmsg("terminating walsender process due to replication timeout")));
|
||||
(errmsg("terminating walsender process due to replication timeout")));
|
||||
|
||||
WalSndShutdown();
|
||||
}
|
||||
@@ -2147,8 +2147,8 @@ WalSndLoop(WalSndSendDataCallback send_data)
|
||||
if (MyWalSnd->state == WALSNDSTATE_CATCHUP)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg("standby \"%s\" has now caught up with primary",
|
||||
application_name)));
|
||||
(errmsg("standby \"%s\" has now caught up with primary",
|
||||
application_name)));
|
||||
WalSndSetState(WALSNDSTATE_STREAMING);
|
||||
}
|
||||
|
||||
@@ -2372,7 +2372,7 @@ retry:
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("requested WAL segment %s has already been removed",
|
||||
XLogFileNameP(curFileTimeLine, sendSegNo))));
|
||||
XLogFileNameP(curFileTimeLine, sendSegNo))));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
@@ -2388,9 +2388,9 @@ retry:
|
||||
if (lseek(sendFile, (off_t) startoff, SEEK_SET) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek in log segment %s to offset %u: %m",
|
||||
XLogFileNameP(curFileTimeLine, sendSegNo),
|
||||
startoff)));
|
||||
errmsg("could not seek in log segment %s to offset %u: %m",
|
||||
XLogFileNameP(curFileTimeLine, sendSegNo),
|
||||
startoff)));
|
||||
sendOff = startoff;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user