+61
-29
lines changedFilter options
+61
-29
lines changed Original file line number Diff line number Diff line change
@@ -177,6 +177,7 @@ gistRedoDeleteRecord(XLogReaderState *record)
177
177
gistxlogDelete *xldata = (gistxlogDelete *) XLogRecGetData(record);
178
178
Buffer buffer;
179
179
Page page;
180
+
OffsetNumber *toDelete = xldata->offsets;
180
181
181
182
/*
182
183
* If we have any conflict processing to do, it must happen before we
@@ -203,14 +204,7 @@ gistRedoDeleteRecord(XLogReaderState *record)
203
204
{
204
205
page = (Page) BufferGetPage(buffer);
205
206
206
-
if (XLogRecGetDataLen(record) > SizeOfGistxlogDelete)
207
-
{
208
-
OffsetNumber *todelete;
209
-
210
-
todelete = (OffsetNumber *) ((char *) xldata + SizeOfGistxlogDelete);
211
-
212
-
PageIndexMultiDelete(page, todelete, xldata->ntodelete);
213
-
}
207
+
PageIndexMultiDelete(page, toDelete, xldata->ntodelete);
214
208
215
209
GistClearPageHasGarbage(page);
216
210
GistMarkTuplesDeleted(page);
@@ -609,6 +603,7 @@ gistXLogPageReuse(Relation rel, Relation heaprel,
609
603
*/
610
604
611
605
/* XLOG stuff */
606
+
xlrec_reuse.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
612
607
xlrec_reuse.locator = rel->rd_locator;
613
608
xlrec_reuse.block = blkno;
614
609
xlrec_reuse.snapshotConflictHorizon = deleteXid;
@@ -678,6 +673,7 @@ gistXLogDelete(Buffer buffer, OffsetNumber *todelete, int ntodelete,
678
673
gistxlogDelete xlrec;
679
674
XLogRecPtr recptr;
680
675
676
+
xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
681
677
xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
682
678
xlrec.ntodelete = ntodelete;
683
679
Original file line number Diff line number Diff line change
@@ -980,8 +980,10 @@ hash_xlog_vacuum_one_page(XLogReaderState *record)
980
980
Page page;
981
981
XLogRedoAction action;
982
982
HashPageOpaque pageopaque;
983
+
OffsetNumber *toDelete;
983
984
984
985
xldata = (xl_hash_vacuum_one_page *) XLogRecGetData(record);
986
+
toDelete = xldata->offsets;
985
987
986
988
/*
987
989
* If we have any conflict processing to do, it must happen before we
@@ -1010,14 +1012,7 @@ hash_xlog_vacuum_one_page(XLogReaderState *record)
1010
1012
{
1011
1013
page = (Page) BufferGetPage(buffer);
1012
1014
1013
-
if (XLogRecGetDataLen(record) > SizeOfHashVacuumOnePage)
1014
-
{
1015
-
OffsetNumber *unused;
1016
-
1017
-
unused = (OffsetNumber *) ((char *) xldata + SizeOfHashVacuumOnePage);
1018
-
1019
-
PageIndexMultiDelete(page, unused, xldata->ntuples);
1020
-
}
1015
+
PageIndexMultiDelete(page, toDelete, xldata->ntuples);
1021
1016
1022
1017
/*
1023
1018
* Mark the page as not containing any LP_DEAD items. See comments in
Original file line number Diff line number Diff line change
@@ -432,6 +432,7 @@ _hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf)
432
432
xl_hash_vacuum_one_page xlrec;
433
433
XLogRecPtr recptr;
434
434
435
+
xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(hrel);
435
436
xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
436
437
xlrec.ntuples = ndeletable;
437
438
Original file line number Diff line number Diff line change
@@ -6698,6 +6698,7 @@ heap_freeze_execute_prepared(Relation rel, Buffer buffer,
6698
6698
nplans = heap_log_freeze_plan(tuples, ntuples, plans, offsets);
6699
6699
6700
6700
xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
6701
+
xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(rel);
6701
6702
xlrec.nplans = nplans;
6702
6703
6703
6704
XLogBeginInsert();
@@ -8280,6 +8281,8 @@ log_heap_visible(Relation rel, Buffer heap_buffer, Buffer vm_buffer,
8280
8281
8281
8282
xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
8282
8283
xlrec.flags = vmflags;
8284
+
if (RelationIsAccessibleInLogicalDecoding(rel))
8285
+
xlrec.flags |= VISIBILITYMAP_XLOG_CATALOG_REL;
8283
8286
XLogBeginInsert();
8284
8287
XLogRegisterData((char *) &xlrec, SizeOfHeapVisible);
8285
8288
@@ -8870,6 +8873,8 @@ heap_xlog_visible(XLogReaderState *record)
8870
8873
BlockNumber blkno;
8871
8874
XLogRedoAction action;
8872
8875
8876
+
Assert((xlrec->flags & VISIBILITYMAP_XLOG_VALID_BITS) == xlrec->flags);
8877
+
8873
8878
XLogRecGetBlockTag(record, 1, &rlocator, NULL, &blkno);
8874
8879
8875
8880
/*
@@ -8956,11 +8961,15 @@ heap_xlog_visible(XLogReaderState *record)
8956
8961
{
8957
8962
Page vmpage = BufferGetPage(vmbuffer);
8958
8963
Relation reln;
8964
+
uint8 vmbits;
8959
8965
8960
8966
/* initialize the page if it was read as zeros */
8961
8967
if (PageIsNew(vmpage))
8962
8968
PageInit(vmpage, BLCKSZ, 0);
8963
8969
8970
+
/* remove VISIBILITYMAP_XLOG_* */
8971
+
vmbits = xlrec->flags & VISIBILITYMAP_VALID_BITS;
8972
+
8964
8973
/*
8965
8974
* XLogReadBufferForRedoExtended locked the buffer. But
8966
8975
* visibilitymap_set will handle locking itself.
@@ -8971,7 +8980,7 @@ heap_xlog_visible(XLogReaderState *record)
8971
8980
visibilitymap_pin(reln, blkno, &vmbuffer);
8972
8981
8973
8982
visibilitymap_set(reln, blkno, InvalidBuffer, lsn, vmbuffer,
8974
-
xlrec->snapshotConflictHorizon, xlrec->flags);
8983
+
xlrec->snapshotConflictHorizon, vmbits);
8975
8984
8976
8985
ReleaseBuffer(vmbuffer);
8977
8986
FreeFakeRelcacheEntry(reln);
Original file line number Diff line number Diff line change
@@ -418,6 +418,7 @@ heap_page_prune(Relation relation, Buffer buffer,
418
418
xl_heap_prune xlrec;
419
419
XLogRecPtr recptr;
420
420
421
+
xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(relation);
421
422
xlrec.snapshotConflictHorizon = prstate.snapshotConflictHorizon;
422
423
xlrec.nredirected = prstate.nredirected;
423
424
xlrec.ndead = prstate.ndead;
Original file line number Diff line number Diff line change
@@ -836,6 +836,7 @@ _bt_log_reuse_page(Relation rel, Relation heaprel, BlockNumber blkno,
836
836
*/
837
837
838
838
/* XLOG stuff */
839
+
xlrec_reuse.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
839
840
xlrec_reuse.locator = rel->rd_locator;
840
841
xlrec_reuse.block = blkno;
841
842
xlrec_reuse.snapshotConflictHorizon = safexid;
@@ -1358,6 +1359,7 @@ _bt_delitems_delete(Relation rel, Relation heaprel, Buffer buf,
1358
1359
XLogRecPtr recptr;
1359
1360
xl_btree_delete xlrec_delete;
1360
1361
1362
+
xlrec_delete.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
1361
1363
xlrec_delete.snapshotConflictHorizon = snapshotConflictHorizon;
1362
1364
xlrec_delete.ndeleted = ndeletable;
1363
1365
xlrec_delete.nupdated = nupdatable;
Original file line number Diff line number Diff line change
@@ -503,6 +503,7 @@ vacuumRedirectAndPlaceholder(Relation index, Relation heaprel, Buffer buffer)
503
503
spgxlogVacuumRedirect xlrec;
504
504
GlobalVisState *vistest;
505
505
506
+
xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
506
507
xlrec.nToPlaceholder = 0;
507
508
xlrec.snapshotConflictHorizon = InvalidTransactionId;
508
509
Original file line number Diff line number Diff line change
@@ -51,11 +51,14 @@ typedef struct gistxlogDelete
51
51
{
52
52
TransactionId snapshotConflictHorizon;
53
53
uint16 ntodelete; /* number of deleted offsets */
54
+
bool isCatalogRel; /* to handle recovery conflict during logical
55
+
* decoding on standby */
54
56
55
-
/* TODELETE OFFSET NUMBER ARRAY FOLLOWS */
57
+
/* TODELETE OFFSET NUMBERS */
58
+
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
56
59
} gistxlogDelete;
57
60
58
-
#define SizeOfGistxlogDelete (offsetof(gistxlogDelete, ntodelete) + sizeof(uint16))
61
+
#define SizeOfGistxlogDelete offsetof(gistxlogDelete, offsets)
59
62
60
63
/*
61
64
* Backup Blk 0: If this operation completes a page split, by inserting a
@@ -98,9 +101,11 @@ typedef struct gistxlogPageReuse
98
101
RelFileLocator locator;
99
102
BlockNumber block;
100
103
FullTransactionId snapshotConflictHorizon;
104
+
bool isCatalogRel; /* to handle recovery conflict during logical
105
+
* decoding on standby */
101
106
} gistxlogPageReuse;
102
107
103
-
#define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, snapshotConflictHorizon) + sizeof(FullTransactionId))
108
+
#define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, isCatalogRel) + sizeof(bool))
104
109
105
110
extern void gist_redo(XLogReaderState *record);
106
111
extern void gist_desc(StringInfo buf, XLogReaderState *record);
Original file line number Diff line number Diff line change
@@ -251,13 +251,15 @@ typedef struct xl_hash_init_bitmap_page
251
251
typedef struct xl_hash_vacuum_one_page
252
252
{
253
253
TransactionId snapshotConflictHorizon;
254
-
uint16 ntuples;
254
+
uint16 ntuples;
255
+
bool isCatalogRel; /* to handle recovery conflict during logical
256
+
* decoding on standby */
255
257
256
-
/* TARGET OFFSET NUMBERS FOLLOW AT THE END */
258
+
/* TARGET OFFSET NUMBERS */
259
+
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
257
260
} xl_hash_vacuum_one_page;
258
261
259
-
#define SizeOfHashVacuumOnePage \
260
-
(offsetof(xl_hash_vacuum_one_page, ntuples) + sizeof(uint16))
262
+
#define SizeOfHashVacuumOnePage offsetof(xl_hash_vacuum_one_page, offsets)
261
263
262
264
extern void hash_redo(XLogReaderState *record);
263
265
extern void hash_desc(StringInfo buf, XLogReaderState *record);
Original file line number Diff line number Diff line change
@@ -245,10 +245,12 @@ typedef struct xl_heap_prune
245
245
TransactionId snapshotConflictHorizon;
246
246
uint16 nredirected;
247
247
uint16 ndead;
248
+
bool isCatalogRel; /* to handle recovery conflict during logical
249
+
* decoding on standby */
248
250
/* OFFSET NUMBERS are in the block reference 0 */
249
251
} xl_heap_prune;
250
252
251
-
#define SizeOfHeapPrune (offsetof(xl_heap_prune, ndead) + sizeof(uint16))
253
+
#define SizeOfHeapPrune (offsetof(xl_heap_prune, isCatalogRel) + sizeof(bool))
252
254
253
255
/*
254
256
* The vacuum page record is similar to the prune record, but can only mark
@@ -344,13 +346,15 @@ typedef struct xl_heap_freeze_page
344
346
{
345
347
TransactionId snapshotConflictHorizon;
346
348
uint16 nplans;
349
+
bool isCatalogRel; /* to handle recovery conflict during logical
350
+
* decoding on standby */
347
351
348
352
/*
349
353
* In payload of blk 0 : FREEZE PLANS and OFFSET NUMBER ARRAY
350
354
*/
351
355
} xl_heap_freeze_page;
352
356
353
-
#define SizeOfHeapFreezePage (offsetof(xl_heap_freeze_page, nplans) + sizeof(uint16))
357
+
#define SizeOfHeapFreezePage (offsetof(xl_heap_freeze_page, isCatalogRel) + sizeof(bool))
354
358
355
359
/*
356
360
* This is what we need to know about setting a visibility map bit
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4