Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication')
-rw-r--r--src/backend/replication/basebackup.c86
-rw-r--r--src/backend/replication/logical/proto.c20
-rw-r--r--src/backend/replication/walreceiver.c8
-rw-r--r--src/backend/replication/walsender.c36
4 files changed, 75 insertions, 75 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index c3b9bddc8fe..75029b0def9 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -274,7 +274,7 @@ 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_sendint16(&buf, 0); /* natts */
pq_endmessage(&buf);
if (ti->path == NULL)
@@ -722,7 +722,7 @@ send_int8_string(StringInfoData *buf, int64 intval)
char is[32];
sprintf(is, INT64_FORMAT, intval);
- pq_sendint(buf, strlen(is), 4);
+ pq_sendint32(buf, strlen(is));
pq_sendbytes(buf, is, strlen(is));
}
@@ -734,34 +734,34 @@ SendBackupHeader(List *tablespaces)
/* Construct and send the directory information */
pq_beginmessage(&buf, 'T'); /* RowDescription */
- pq_sendint(&buf, 3, 2); /* 3 fields */
+ pq_sendint16(&buf, 3); /* 3 fields */
/* First field - spcoid */
pq_sendstring(&buf, "spcoid");
- pq_sendint(&buf, 0, 4); /* table oid */
- pq_sendint(&buf, 0, 2); /* attnum */
- pq_sendint(&buf, OIDOID, 4); /* type oid */
- pq_sendint(&buf, 4, 2); /* typlen */
- pq_sendint(&buf, 0, 4); /* typmod */
- pq_sendint(&buf, 0, 2); /* format code */
+ pq_sendint32(&buf, 0); /* table oid */
+ pq_sendint16(&buf, 0); /* attnum */
+ pq_sendint32(&buf, OIDOID); /* type oid */
+ pq_sendint16(&buf, 4); /* typlen */
+ pq_sendint32(&buf, 0); /* typmod */
+ pq_sendint16(&buf, 0); /* format code */
/* Second field - spcpath */
pq_sendstring(&buf, "spclocation");
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
- pq_sendint(&buf, TEXTOID, 4);
- pq_sendint(&buf, -1, 2);
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
+ pq_sendint32(&buf, TEXTOID);
+ pq_sendint16(&buf, -1);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
/* Third field - size */
pq_sendstring(&buf, "size");
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
- pq_sendint(&buf, INT8OID, 4);
- pq_sendint(&buf, 8, 2);
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
+ pq_sendint32(&buf, INT8OID);
+ pq_sendint16(&buf, 8);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
pq_endmessage(&buf);
foreach(lc, tablespaces)
@@ -770,28 +770,28 @@ SendBackupHeader(List *tablespaces)
/* Send one datarow message */
pq_beginmessage(&buf, 'D');
- pq_sendint(&buf, 3, 2); /* number of columns */
+ pq_sendint16(&buf, 3); /* number of columns */
if (ti->path == NULL)
{
- pq_sendint(&buf, -1, 4); /* Length = -1 ==> NULL */
- pq_sendint(&buf, -1, 4);
+ pq_sendint32(&buf, -1); /* Length = -1 ==> NULL */
+ pq_sendint32(&buf, -1);
}
else
{
Size len;
len = strlen(ti->oid);
- pq_sendint(&buf, len, 4);
+ pq_sendint32(&buf, len);
pq_sendbytes(&buf, ti->oid, len);
len = strlen(ti->path);
- pq_sendint(&buf, len, 4);
+ pq_sendint32(&buf, len);
pq_sendbytes(&buf, ti->path, len);
}
if (ti->size >= 0)
send_int8_string(&buf, ti->size / 1024);
else
- pq_sendint(&buf, -1, 4); /* NULL */
+ pq_sendint32(&buf, -1); /* NULL */
pq_endmessage(&buf);
}
@@ -812,42 +812,42 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
Size len;
pq_beginmessage(&buf, 'T'); /* RowDescription */
- pq_sendint(&buf, 2, 2); /* 2 fields */
+ pq_sendint16(&buf, 2); /* 2 fields */
/* Field headers */
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, -1, 2);
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
+ pq_sendint32(&buf, 0); /* table oid */
+ pq_sendint16(&buf, 0); /* attnum */
+ pq_sendint32(&buf, TEXTOID); /* type oid */
+ pq_sendint16(&buf, -1);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
pq_sendstring(&buf, "tli");
- pq_sendint(&buf, 0, 4); /* table oid */
- pq_sendint(&buf, 0, 2); /* attnum */
+ pq_sendint32(&buf, 0); /* table oid */
+ pq_sendint16(&buf, 0); /* attnum */
/*
* 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, -1, 2);
- pq_sendint(&buf, 0, 4);
- pq_sendint(&buf, 0, 2);
+ pq_sendint32(&buf, INT8OID); /* type oid */
+ pq_sendint16(&buf, -1);
+ pq_sendint32(&buf, 0);
+ pq_sendint16(&buf, 0);
pq_endmessage(&buf);
/* Data row */
pq_beginmessage(&buf, 'D');
- pq_sendint(&buf, 2, 2); /* number of columns */
+ pq_sendint16(&buf, 2); /* number of columns */
len = snprintf(str, sizeof(str),
"%X/%X", (uint32) (ptr >> 32), (uint32) ptr);
- pq_sendint(&buf, len, 4);
+ pq_sendint32(&buf, len);
pq_sendbytes(&buf, str, len);
len = snprintf(str, sizeof(str), "%u", tli);
- pq_sendint(&buf, len, 4);
+ pq_sendint32(&buf, len);
pq_sendbytes(&buf, str, len);
pq_endmessage(&buf);
diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c
index f19649b113c..9b126b29570 100644
--- a/src/backend/replication/logical/proto.c
+++ b/src/backend/replication/logical/proto.c
@@ -47,7 +47,7 @@ logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn)
/* fixed fields */
pq_sendint64(out, txn->final_lsn);
pq_sendint64(out, txn->commit_time);
- pq_sendint(out, txn->xid, 4);
+ pq_sendint32(out, txn->xid);
}
/*
@@ -145,7 +145,7 @@ logicalrep_write_insert(StringInfo out, Relation rel, HeapTuple newtuple)
rel->rd_rel->relreplident == REPLICA_IDENTITY_INDEX);
/* use Oid as relation identifier */
- pq_sendint(out, RelationGetRelid(rel), 4);
+ pq_sendint32(out, RelationGetRelid(rel));
pq_sendbyte(out, 'N'); /* new tuple follows */
logicalrep_write_tuple(out, rel, newtuple);
@@ -189,7 +189,7 @@ logicalrep_write_update(StringInfo out, Relation rel, HeapTuple oldtuple,
rel->rd_rel->relreplident == REPLICA_IDENTITY_INDEX);
/* use Oid as relation identifier */
- pq_sendint(out, RelationGetRelid(rel), 4);
+ pq_sendint32(out, RelationGetRelid(rel));
if (oldtuple != NULL)
{
@@ -258,7 +258,7 @@ logicalrep_write_delete(StringInfo out, Relation rel, HeapTuple oldtuple)
pq_sendbyte(out, 'D'); /* action DELETE */
/* use Oid as relation identifier */
- pq_sendint(out, RelationGetRelid(rel), 4);
+ pq_sendint32(out, RelationGetRelid(rel));
if (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL)
pq_sendbyte(out, 'O'); /* old tuple follows */
@@ -303,7 +303,7 @@ logicalrep_write_rel(StringInfo out, Relation rel)
pq_sendbyte(out, 'R'); /* sending RELATION */
/* use Oid as relation identifier */
- pq_sendint(out, RelationGetRelid(rel), 4);
+ pq_sendint32(out, RelationGetRelid(rel));
/* send qualified relation name */
logicalrep_write_namespace(out, RelationGetNamespace(rel));
@@ -360,7 +360,7 @@ logicalrep_write_typ(StringInfo out, Oid typoid)
typtup = (Form_pg_type) GETSTRUCT(tup);
/* use Oid as relation identifier */
- pq_sendint(out, typoid, 4);
+ pq_sendint32(out, typoid);
/* send qualified type name */
logicalrep_write_namespace(out, typtup->typnamespace);
@@ -402,7 +402,7 @@ logicalrep_write_tuple(StringInfo out, Relation rel, HeapTuple tuple)
continue;
nliveatts++;
}
- pq_sendint(out, nliveatts, 2);
+ pq_sendint16(out, nliveatts);
/* try to allocate enough memory from the get-go */
enlargeStringInfo(out, tuple->t_len +
@@ -522,7 +522,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel)
continue;
nliveatts++;
}
- pq_sendint(out, nliveatts, 2);
+ pq_sendint16(out, nliveatts);
/* fetch bitmap of REPLICATION IDENTITY attributes */
replidentfull = (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL);
@@ -551,10 +551,10 @@ logicalrep_write_attrs(StringInfo out, Relation rel)
pq_sendstring(out, NameStr(att->attname));
/* attribute type id */
- pq_sendint(out, (int) att->atttypid, sizeof(att->atttypid));
+ pq_sendint32(out, (int) att->atttypid);
/* attribute mode */
- pq_sendint(out, att->atttypmod, sizeof(att->atttypmod));
+ pq_sendint32(out, att->atttypmod);
}
bms_free(idattrs);
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 1bf9be673b7..fe4e0859389 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -1272,10 +1272,10 @@ XLogWalRcvSendHSFeedback(bool immed)
resetStringInfo(&reply_message);
pq_sendbyte(&reply_message, 'h');
pq_sendint64(&reply_message, GetCurrentTimestamp());
- pq_sendint(&reply_message, xmin, 4);
- pq_sendint(&reply_message, xmin_epoch, 4);
- pq_sendint(&reply_message, catalog_xmin, 4);
- pq_sendint(&reply_message, catalog_xmin_epoch, 4);
+ pq_sendint32(&reply_message, xmin);
+ pq_sendint32(&reply_message, xmin_epoch);
+ pq_sendint32(&reply_message, catalog_xmin);
+ pq_sendint32(&reply_message, catalog_xmin_epoch);
walrcv_send(wrconn, reply_message.data, reply_message.len);
if (TransactionIdIsValid(xmin) || TransactionIdIsValid(catalog_xmin))
master_has_standby_xmin = true;
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 6ec4e631612..fa1db748b5e 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -444,32 +444,32 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
/* Send a RowDescription message */
pq_beginmessage(&buf, 'T');
- pq_sendint(&buf, 2, 2); /* 2 fields */
+ pq_sendint16(&buf, 2); /* 2 fields */
/* first field */
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, -1, 2); /* typlen */
- pq_sendint(&buf, 0, 4); /* typmod */
- pq_sendint(&buf, 0, 2); /* format code */
+ pq_sendint32(&buf, 0); /* table oid */
+ pq_sendint16(&buf, 0); /* attnum */
+ pq_sendint32(&buf, TEXTOID); /* type oid */
+ pq_sendint16(&buf, -1); /* typlen */
+ pq_sendint32(&buf, 0); /* typmod */
+ pq_sendint16(&buf, 0); /* format code */
/* second field */
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, -1, 2); /* typlen */
- pq_sendint(&buf, 0, 4); /* typmod */
- pq_sendint(&buf, 0, 2); /* format code */
+ pq_sendint32(&buf, 0); /* table oid */
+ pq_sendint16(&buf, 0); /* attnum */
+ pq_sendint32(&buf, BYTEAOID); /* type oid */
+ pq_sendint16(&buf, -1); /* typlen */
+ pq_sendint32(&buf, 0); /* typmod */
+ pq_sendint16(&buf, 0); /* format code */
pq_endmessage(&buf);
/* Send a DataRow message */
pq_beginmessage(&buf, 'D');
- pq_sendint(&buf, 2, 2); /* # of columns */
+ pq_sendint16(&buf, 2); /* # of columns */
len = strlen(histfname);
- pq_sendint(&buf, len, 4); /* col1 len */
+ pq_sendint32(&buf, len); /* col1 len */
pq_sendbytes(&buf, histfname, len);
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
@@ -489,7 +489,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
(errcode_for_file_access(),
errmsg("could not seek to beginning of file \"%s\": %m", path)));
- pq_sendint(&buf, histfilelen, 4); /* col2 len */
+ pq_sendint32(&buf, histfilelen); /* col2 len */
bytesleft = histfilelen;
while (bytesleft > 0)
@@ -646,7 +646,7 @@ StartReplication(StartReplicationCmd *cmd)
/* Send a CopyBothResponse message, and start streaming */
pq_beginmessage(&buf, 'W');
pq_sendbyte(&buf, 0);
- pq_sendint(&buf, 0, 2);
+ pq_sendint16(&buf, 0);
pq_endmessage(&buf);
pq_flush();
@@ -1065,7 +1065,7 @@ StartLogicalReplication(StartReplicationCmd *cmd)
/* Send a CopyBothResponse message, and start streaming */
pq_beginmessage(&buf, 'W');
pq_sendbyte(&buf, 0);
- pq_sendint(&buf, 0, 2);
+ pq_sendint16(&buf, 0);
pq_endmessage(&buf);
pq_flush();