* Read a HeapTuple as WAL logged by heap_insert, heap_update and heap_delete * (but not by heap_multi_insert) into a tuplebuf. * * The size 'len' and the pointer 'data' in the record need to be * computed outside as they are record specific. */
| 1205 | * computed outside as they are record specific. |
| 1206 | */ |
| 1207 | static void |
| 1208 | DecodeXLogTuple(char *data, Size len, ReorderBufferTupleBuf *tuple) |
| 1209 | { |
| 1210 | xl_heap_header xlhdr; |
| 1211 | int datalen = len - SizeOfHeapHeader; |
| 1212 | HeapTupleHeader header; |
| 1213 | |
| 1214 | Assert(datalen >= 0); |
| 1215 | |
| 1216 | tuple->tuple.t_len = datalen + SizeofHeapTupleHeader; |
| 1217 | header = tuple->tuple.t_data; |
| 1218 | |
| 1219 | /* not a disk based tuple */ |
| 1220 | ItemPointerSetInvalid(&tuple->tuple.t_self); |
| 1221 | |
| 1222 | /* we can only figure this out after reassembling the transactions */ |
| 1223 | tuple->tuple.t_tableOid = InvalidOid; |
| 1224 | |
| 1225 | /* data is not stored aligned, copy to aligned storage */ |
| 1226 | memcpy((char *) &xlhdr, |
| 1227 | data, |
| 1228 | SizeOfHeapHeader); |
| 1229 | |
| 1230 | memset(header, 0, SizeofHeapTupleHeader); |
| 1231 | |
| 1232 | memcpy(((char *) tuple->tuple.t_data) + SizeofHeapTupleHeader, |
| 1233 | data + SizeOfHeapHeader, |
| 1234 | datalen); |
| 1235 | |
| 1236 | header->t_infomask = xlhdr.t_infomask; |
| 1237 | header->t_infomask2 = xlhdr.t_infomask2; |
| 1238 | header->t_hoff = xlhdr.t_hoff; |
| 1239 | } |
| 1240 | |
| 1241 | /* |
| 1242 | * Check whether we are interested in this specific transaction. |
no outgoing calls
no test coverage detected