mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 22:56:55 +08:00
Improved order of insert operations
This commit is contained in:
@@ -113,23 +113,24 @@ InsertTuple(Relation rel, IndexTuple itup, Relation heapRel, Datum *values)
|
|||||||
newbuf = IvfflatNewBuffer(rel, MAIN_FORKNUM);
|
newbuf = IvfflatNewBuffer(rel, MAIN_FORKNUM);
|
||||||
newpage = GenericXLogRegisterBuffer(state, newbuf, GENERIC_XLOG_FULL_IMAGE);
|
newpage = GenericXLogRegisterBuffer(state, newbuf, GENERIC_XLOG_FULL_IMAGE);
|
||||||
|
|
||||||
insertPage = BufferGetBlockNumber(newbuf);
|
/* Init new page */
|
||||||
|
|
||||||
/* Update previous buffer */
|
|
||||||
IvfflatPageGetOpaque(page)->nextblkno = insertPage;
|
|
||||||
|
|
||||||
/* Init page */
|
|
||||||
IvfflatInitPage(newbuf, newpage);
|
IvfflatInitPage(newbuf, newpage);
|
||||||
|
|
||||||
|
/* Update previous buffer */
|
||||||
|
insertPage = BufferGetBlockNumber(newbuf);
|
||||||
|
IvfflatPageGetOpaque(page)->nextblkno = insertPage;
|
||||||
|
|
||||||
/* Commit */
|
/* Commit */
|
||||||
MarkBufferDirty(buf);
|
|
||||||
MarkBufferDirty(newbuf);
|
MarkBufferDirty(newbuf);
|
||||||
|
MarkBufferDirty(buf);
|
||||||
GenericXLogFinish(state);
|
GenericXLogFinish(state);
|
||||||
|
|
||||||
/* Unlock */
|
/* Unlock extend relation lock as early as possible */
|
||||||
UnlockReleaseBuffer(buf);
|
|
||||||
UnlockReleaseBuffer(newbuf);
|
|
||||||
UnlockReleaseBuffer(metabuf);
|
UnlockReleaseBuffer(metabuf);
|
||||||
|
|
||||||
|
/* Unlock rest */
|
||||||
|
UnlockReleaseBuffer(newbuf);
|
||||||
|
UnlockReleaseBuffer(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user