From 08e6344fd6423210b339e92c069bb979ba4e7cd6 Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Mon, 29 Jan 2024 10:37:16 +0900 Subject: 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 --- src/backend/replication/logical/decode.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/backend/replication/logical/decode.c') 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); -- cgit v1.2.3