From b247b688a8ef56103b2dea1f9dd53a87b27696b6 Mon Sep 17 00:00:00 2001 From: jeff-davis Date: Fri, 15 Sep 2023 13:14:10 -0700 Subject: [PATCH] No need to MarkBufferDirty(); GenericXLogFinish() does that. (#265) --- src/hnswbuild.c | 3 --- src/hnswinsert.c | 7 ------- src/hnswutils.c | 1 - src/hnswvacuum.c | 7 ------- src/ivfinsert.c | 2 -- src/ivfutils.c | 3 --- src/ivfvacuum.c | 1 - 7 files changed, 24 deletions(-) diff --git a/src/hnswbuild.c b/src/hnswbuild.c index 8cf5b75..40fdf58 100644 --- a/src/hnswbuild.c +++ b/src/hnswbuild.c @@ -81,7 +81,6 @@ HnswBuildAppendPage(Relation index, Buffer *buf, Page *page, GenericXLogState ** HnswPageGetOpaque(*page)->nextblkno = BufferGetBlockNumber(newbuf); /* Commit */ - MarkBufferDirty(*buf); GenericXLogFinish(*state); UnlockReleaseBuffer(*buf); @@ -179,7 +178,6 @@ CreateElementPages(HnswBuildState * buildstate) insertPage = BufferGetBlockNumber(buf); /* Commit */ - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); @@ -227,7 +225,6 @@ CreateNeighborPages(HnswBuildState * buildstate) elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index)); /* Commit */ - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); } diff --git a/src/hnswinsert.c b/src/hnswinsert.c index 8ac9650..ebdc3f4 100644 --- a/src/hnswinsert.c +++ b/src/hnswinsert.c @@ -202,8 +202,6 @@ WriteNewElementPages(Relation index, HnswElement e, int m, BlockNumber insertPag HnswInsertAppendPage(index, &newbuf, &newpage, state, page); /* Commit */ - MarkBufferDirty(newbuf); - MarkBufferDirty(buf); GenericXLogFinish(state); /* Unlock previous buffer */ @@ -270,9 +268,6 @@ WriteNewElementPages(Relation index, HnswElement e, int m, BlockNumber insertPag } /* Commit */ - MarkBufferDirty(buf); - if (nbuf != buf) - MarkBufferDirty(nbuf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); if (nbuf != buf) @@ -391,7 +386,6 @@ HnswUpdateNeighborPages(Relation index, FmgrInfo *procinfo, Oid collation, HnswE elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index)); /* Commit */ - MarkBufferDirty(buf); GenericXLogFinish(state); } else @@ -445,7 +439,6 @@ HnswAddDuplicate(Relation index, HnswElement element, HnswElement dup) elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index)); /* Commit */ - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); diff --git a/src/hnswutils.c b/src/hnswutils.c index b179268..72cf94e 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -117,7 +117,6 @@ HnswInitRegisterPage(Relation index, Buffer *buf, Page *page, GenericXLogState * void HnswCommitBuffer(Buffer buf, GenericXLogState *state) { - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); } diff --git a/src/hnswvacuum.c b/src/hnswvacuum.c index 3ebeb02..29b675f 100644 --- a/src/hnswvacuum.c +++ b/src/hnswvacuum.c @@ -128,10 +128,7 @@ RemoveHeapTids(HnswVacuumState * vacuumstate) blkno = HnswPageGetOpaque(page)->nextblkno; if (updated) - { - MarkBufferDirty(buf); GenericXLogFinish(state); - } else GenericXLogAbort(state); @@ -229,7 +226,6 @@ RepairGraphElement(HnswVacuumState * vacuumstate, HnswElement element, HnswEleme elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index)); /* Commit */ - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); @@ -547,9 +543,6 @@ MarkDeleted(HnswVacuumState * vacuumstate) elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index)); /* Commit */ - MarkBufferDirty(buf); - if (nbuf != buf) - MarkBufferDirty(nbuf); GenericXLogFinish(state); if (nbuf != buf) UnlockReleaseBuffer(nbuf); diff --git a/src/ivfinsert.c b/src/ivfinsert.c index c42de00..f158592 100644 --- a/src/ivfinsert.c +++ b/src/ivfinsert.c @@ -142,8 +142,6 @@ InsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, R IvfflatPageGetOpaque(page)->nextblkno = insertPage; /* Commit */ - MarkBufferDirty(newbuf); - MarkBufferDirty(buf); GenericXLogFinish(state); /* Unlock previous buffer */ diff --git a/src/ivfutils.c b/src/ivfutils.c index 5ddec28..7959a17 100644 --- a/src/ivfutils.c +++ b/src/ivfutils.c @@ -136,7 +136,6 @@ IvfflatInitRegisterPage(Relation index, Buffer *buf, Page *page, GenericXLogStat void IvfflatCommitBuffer(Buffer buf, GenericXLogState *state) { - MarkBufferDirty(buf); GenericXLogFinish(state); UnlockReleaseBuffer(buf); } @@ -160,8 +159,6 @@ IvfflatAppendPage(Relation index, Buffer *buf, Page *page, GenericXLogState **st IvfflatInitPage(newbuf, newpage); /* Commit */ - MarkBufferDirty(*buf); - MarkBufferDirty(newbuf); GenericXLogFinish(*state); /* Unlock */ diff --git a/src/ivfvacuum.c b/src/ivfvacuum.c index 435dfe1..b548af1 100644 --- a/src/ivfvacuum.c +++ b/src/ivfvacuum.c @@ -107,7 +107,6 @@ ivfflatbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, { /* Delete tuples */ PageIndexMultiDelete(page, deletable, ndeletable); - MarkBufferDirty(buf); GenericXLogFinish(state); } else