Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1793f2

Browse files
committed
In SPGiST replay, do conflict resolution before modifying the page.
In yesterday's commit962e0cc, I added theResolveRecoveryConflictWithSnapshot call in the wrong place. I correctlyput it before spgRedoVacuumRedirect itself would modify the index page ---but not before RestoreBkpBlocks, so replay of a record with a full-pageimage would modify the page before kicking off any conflicting HStransactions. Oops.
1 parent9fb5952 commitc1793f2

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

‎src/backend/access/spgist/spgxlog.c

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -889,15 +889,6 @@ spgRedoVacuumRedirect(XLogRecPtr lsn, XLogRecord *record)
889889
ptr+=sizeof(spgxlogVacuumRedirect);
890890
itemToPlaceholder= (OffsetNumber*)ptr;
891891

892-
/*
893-
* If any redirection tuples are being removed, make sure there are no
894-
* live Hot Standby transactions that might need to see them. This code
895-
* behaves similarly to btree's XLOG_BTREE_REUSE_PAGE case.
896-
*/
897-
if (InHotStandby&&TransactionIdIsValid(xldata->newestRedirectXid))
898-
ResolveRecoveryConflictWithSnapshot(xldata->newestRedirectXid,
899-
xldata->node);
900-
901892
if (!(record->xl_info&XLR_BKP_BLOCK_1))
902893
{
903894
buffer=XLogReadBuffer(xldata->node,xldata->blkno, false);
@@ -964,10 +955,33 @@ spg_redo(XLogRecPtr lsn, XLogRecord *record)
964955
MemoryContextoldCxt;
965956

966957
/*
967-
* SP-GiST indexes do not require any conflict processing. NB: If we ever
968-
* implement a similar optimization as we have in b-tree, and remove
969-
* killed tuples outside VACUUM, we'll need to handle that here.
958+
* If we have any conflict processing to do, it must happen before we
959+
* update the page.
970960
*/
961+
if (InHotStandby)
962+
{
963+
switch (info)
964+
{
965+
caseXLOG_SPGIST_VACUUM_REDIRECT:
966+
{
967+
spgxlogVacuumRedirect*xldata=
968+
(spgxlogVacuumRedirect*)XLogRecGetData(record);
969+
970+
/*
971+
* If any redirection tuples are being removed, make sure
972+
* there are no live Hot Standby transactions that might
973+
* need to see them.
974+
*/
975+
if (TransactionIdIsValid(xldata->newestRedirectXid))
976+
ResolveRecoveryConflictWithSnapshot(xldata->newestRedirectXid,
977+
xldata->node);
978+
break;
979+
}
980+
default:
981+
break;
982+
}
983+
}
984+
971985
RestoreBkpBlocks(lsn,record, false);
972986

973987
oldCxt=MemoryContextSwitchTo(opCtx);
@@ -1072,7 +1086,7 @@ spg_desc(StringInfo buf, uint8 xl_info, char *rec)
10721086
out_target(buf, ((spgxlogVacuumRedirect*)rec)->node);
10731087
appendStringInfo(buf,"vacuum redirect tuples on page %u, newest XID %u",
10741088
((spgxlogVacuumRedirect*)rec)->blkno,
1075-
((spgxlogVacuumRedirect*)rec)->newestRedirectXid);
1089+
((spgxlogVacuumRedirect*)rec)->newestRedirectXid);
10761090
break;
10771091
default:
10781092
appendStringInfo(buf,"unknown spgist op code %u",info);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp