mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
Seems nice to keep all these together. This also provides a nice place for a README file to describe the compute image build process. For now, it briefly describes the contents of the directory, but can be expanded.
63 lines
1.8 KiB
Diff
63 lines
1.8 KiB
Diff
diff --git a/src/hnswbuild.c b/src/hnswbuild.c
|
|
index dcfb2bd..d5189ee 100644
|
|
--- a/src/hnswbuild.c
|
|
+++ b/src/hnswbuild.c
|
|
@@ -860,9 +860,17 @@ HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc)
|
|
|
|
hnswarea = shm_toc_lookup(toc, PARALLEL_KEY_HNSW_AREA, false);
|
|
|
|
+#ifdef NEON_SMGR
|
|
+ smgr_start_unlogged_build(RelationGetSmgr(indexRel));
|
|
+#endif
|
|
+
|
|
/* Perform inserts */
|
|
HnswParallelScanAndInsert(heapRel, indexRel, hnswshared, hnswarea, false);
|
|
|
|
+#ifdef NEON_SMGR
|
|
+ smgr_finish_unlogged_build_phase_1(RelationGetSmgr(indexRel));
|
|
+#endif
|
|
+
|
|
/* Close relations within worker */
|
|
index_close(indexRel, indexLockmode);
|
|
table_close(heapRel, heapLockmode);
|
|
@@ -1117,12 +1125,38 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo,
|
|
SeedRandom(42);
|
|
#endif
|
|
|
|
+#ifdef NEON_SMGR
|
|
+ smgr_start_unlogged_build(RelationGetSmgr(index));
|
|
+#endif
|
|
+
|
|
InitBuildState(buildstate, heap, index, indexInfo, forkNum);
|
|
|
|
BuildGraph(buildstate, forkNum);
|
|
|
|
- if (RelationNeedsWAL(index) || forkNum == INIT_FORKNUM)
|
|
+#ifdef NEON_SMGR
|
|
+ smgr_finish_unlogged_build_phase_1(RelationGetSmgr(index));
|
|
+#endif
|
|
+
|
|
+ if (RelationNeedsWAL(index) || forkNum == INIT_FORKNUM) {
|
|
log_newpage_range(index, forkNum, 0, RelationGetNumberOfBlocksInFork(index, forkNum), true);
|
|
+#ifdef NEON_SMGR
|
|
+ {
|
|
+#if PG_VERSION_NUM >= 160000
|
|
+ RelFileLocator rlocator = RelationGetSmgr(index)->smgr_rlocator.locator;
|
|
+#else
|
|
+ RelFileNode rlocator = RelationGetSmgr(index)->smgr_rnode.node;
|
|
+#endif
|
|
+
|
|
+ SetLastWrittenLSNForBlockRange(XactLastRecEnd, rlocator,
|
|
+ MAIN_FORKNUM, 0, RelationGetNumberOfBlocks(index));
|
|
+ SetLastWrittenLSNForRelation(XactLastRecEnd, rlocator, MAIN_FORKNUM);
|
|
+ }
|
|
+#endif
|
|
+ }
|
|
+
|
|
+#ifdef NEON_SMGR
|
|
+ smgr_end_unlogged_build(RelationGetSmgr(index));
|
|
+#endif
|
|
|
|
FreeBuildState(buildstate);
|
|
}
|