Commit pages with tuple

This commit is contained in:
Andrew Kane
2022-07-31 21:29:29 -07:00
parent 6866939090
commit 94eeb83abe

View File

@@ -60,6 +60,7 @@ static void
InsertTuple(Relation rel, IndexTuple itup, Relation heapRel, Datum *values)
{
Buffer buf;
Buffer prevbuf = InvalidBuffer;
Page page;
GenericXLogState *state;
Size itemsz;
@@ -105,20 +106,18 @@ InsertTuple(Relation rel, IndexTuple itup, Relation heapRel, Datum *values)
/* Update previous buffer */
IvfflatPageGetOpaque(page)->nextblkno = insertPage;
MarkBufferDirty(buf);
/* Init page */
PageInit(newpage, BufferGetPageSize(newbuf), sizeof(IvfflatPageOpaqueData));
IvfflatPageGetOpaque(newpage)->nextblkno = InvalidBlockNumber;
IvfflatPageGetOpaque(newpage)->page_id = IVFFLAT_PAGE_ID;
/* Commit */
MarkBufferDirty(buf);
MarkBufferDirty(newbuf);
GenericXLogFinish(state);
prevbuf = buf;
buf = newbuf;
page = newpage;
/* Unlock */
UnlockReleaseBuffer(buf);
UnlockReleaseBuffer(newbuf);
break;
}
}
@@ -128,6 +127,9 @@ InsertTuple(Relation rel, IndexTuple itup, Relation heapRel, Datum *values)
IvfflatCommitBuffer(buf, state);
if (BufferIsValid(prevbuf))
UnlockReleaseBuffer(prevbuf);
/* Update the insert page */
if (insertPage != originalInsertPage)
IvfflatUpdateList(rel, state, listInfo, insertPage, originalInsertPage, InvalidBlockNumber, MAIN_FORKNUM);