aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/decode.c
diff options
context:
space:
mode:
authorMasahiko Sawada <msawada@postgresql.org>2024-01-29 10:37:16 +0900
committerMasahiko Sawada <msawada@postgresql.org>2024-01-29 10:37:16 +0900
commit08e6344fd6423210b339e92c069bb979ba4e7cd6 (patch)
tree231defcb4b2376503dcbe21dfefb1a82c561e76c /src/backend/replication/logical/decode.c
parent50b797dc99ec3bf97ea5d0955a3b42d356c1522d (diff)
downloadpostgresql-08e6344fd6423210b339e92c069bb979ba4e7cd6.tar.gz
postgresql-08e6344fd6423210b339e92c069bb979ba4e7cd6.zip
Remove ReorderBufferTupleBuf structure.
Since commit a4ccc1cef, the 'node' and 'alloc_tuple_size' fields of the ReorderBufferTupleBuf structure are no longer used. This leaves only the 'tuple' field in the structure. Since keeping a single-field structure makes little sense, the ReorderBufferTupleBuf is removed entirely. The code is refactored accordingly. No back-patching since these are ABI changes in an exposed structure and functions, and there would be some risk of breaking extensions. Author: Aleksander Alekseev Reviewed-by: Amit Kapila, Masahiko Sawada, Reid Thompson Discussion: https://postgr.es/m/CAD21AoCvnuxiXXfRecp7g9+CeC35POQfhuQeJFr7_9u_Q5jc_Q@mail.gmail.com
Diffstat (limited to 'src/backend/replication/logical/decode.c')
-rw-r--r--src/backend/replication/logical/decode.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 6a0f22b209b..7b21731287d 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -62,7 +62,7 @@ static void DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
/* common function to decode tuples */
-static void DecodeXLogTuple(char *data, Size len, ReorderBufferTupleBuf *tuple);
+static void DecodeXLogTuple(char *data, Size len, HeapTuple tuple);
/* helper functions for decoding transactions */
static inline bool FilterPrepare(LogicalDecodingContext *ctx,
@@ -1152,7 +1152,7 @@ DecodeMultiInsert(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
ReorderBufferChange *change;
xl_multi_insert_tuple *xlhdr;
int datalen;
- ReorderBufferTupleBuf *tuple;
+ HeapTuple tuple;
HeapTupleHeader header;
change = ReorderBufferGetChange(ctx->reorder);
@@ -1169,21 +1169,21 @@ DecodeMultiInsert(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
ReorderBufferGetTupleBuf(ctx->reorder, datalen);
tuple = change->data.tp.newtuple;
- header = tuple->tuple.t_data;
+ header = tuple->t_data;
/* not a disk based tuple */
- ItemPointerSetInvalid(&tuple->tuple.t_self);
+ ItemPointerSetInvalid(&tuple->t_self);
/*
* We can only figure this out after reassembling the transactions.
*/
- tuple->tuple.t_tableOid = InvalidOid;
+ tuple->t_tableOid = InvalidOid;
- tuple->tuple.t_len = datalen + SizeofHeapTupleHeader;
+ tuple->t_len = datalen + SizeofHeapTupleHeader;
memset(header, 0, SizeofHeapTupleHeader);
- memcpy((char *) tuple->tuple.t_data + SizeofHeapTupleHeader,
+ memcpy((char *) tuple->t_data + SizeofHeapTupleHeader,
(char *) data,
datalen);
header->t_infomask = xlhdr->t_infomask;
@@ -1253,7 +1253,7 @@ DecodeSpecConfirm(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
* computed outside as they are record specific.
*/
static void
-DecodeXLogTuple(char *data, Size len, ReorderBufferTupleBuf *tuple)
+DecodeXLogTuple(char *data, Size len, HeapTuple tuple)
{
xl_heap_header xlhdr;
int datalen = len - SizeOfHeapHeader;
@@ -1261,14 +1261,14 @@ DecodeXLogTuple(char *data, Size len, ReorderBufferTupleBuf *tuple)
Assert(datalen >= 0);
- tuple->tuple.t_len = datalen + SizeofHeapTupleHeader;
- header = tuple->tuple.t_data;
+ tuple->t_len = datalen + SizeofHeapTupleHeader;
+ header = tuple->t_data;
/* not a disk based tuple */
- ItemPointerSetInvalid(&tuple->tuple.t_self);
+ ItemPointerSetInvalid(&tuple->t_self);
/* we can only figure this out after reassembling the transactions */
- tuple->tuple.t_tableOid = InvalidOid;
+ tuple->t_tableOid = InvalidOid;
/* data is not stored aligned, copy to aligned storage */
memcpy((char *) &xlhdr,
@@ -1277,7 +1277,7 @@ DecodeXLogTuple(char *data, Size len, ReorderBufferTupleBuf *tuple)
memset(header, 0, SizeofHeapTupleHeader);
- memcpy(((char *) tuple->tuple.t_data) + SizeofHeapTupleHeader,
+ memcpy(((char *) tuple->t_data) + SizeofHeapTupleHeader,
data + SizeOfHeapHeader,
datalen);