diff --git a/compute/patches/pgvector.patch b/compute/patches/pgvector.patch index 6fe3d073ed..6a203489fd 100644 --- a/compute/patches/pgvector.patch +++ b/compute/patches/pgvector.patch @@ -15,7 +15,7 @@ index 7a4b88c..56678af 100644 HEADERS = src/halfvec.h src/sparsevec.h src/vector.h diff --git a/src/hnswbuild.c b/src/hnswbuild.c -index b667478..dc95d89 100644 +index b667478..1298aa1 100644 --- a/src/hnswbuild.c +++ b/src/hnswbuild.c @@ -843,9 +843,17 @@ HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc) @@ -36,7 +36,7 @@ index b667478..dc95d89 100644 /* Close relations within worker */ index_close(indexRel, indexLockmode); table_close(heapRel, heapLockmode); -@@ -1100,12 +1108,39 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo, +@@ -1100,13 +1108,25 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo, SeedRandom(42); #endif @@ -48,32 +48,17 @@ index b667478..dc95d89 100644 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) { + 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 -+ if (set_lwlsn_block_range_hook) -+ set_lwlsn_block_range_hook(XactLastRecEnd, rlocator, -+ MAIN_FORKNUM, 0, RelationGetNumberOfBlocks(index)); -+ if (set_lwlsn_relation_hook) -+ set_lwlsn_relation_hook(XactLastRecEnd, rlocator, MAIN_FORKNUM); -+ } -+#endif -+ } -+ + +#ifdef NEON_SMGR + smgr_end_unlogged_build(RelationGetSmgr(index)); +#endif - ++ FreeBuildState(buildstate); } + diff --git a/compute/patches/rum.patch b/compute/patches/rum.patch index 5bc5d739b3..b45afe2874 100644 --- a/compute/patches/rum.patch +++ b/compute/patches/rum.patch @@ -1,5 +1,5 @@ diff --git a/src/ruminsert.c b/src/ruminsert.c -index 255e616..7a2240f 100644 +index 255e616..1c6edb7 100644 --- a/src/ruminsert.c +++ b/src/ruminsert.c @@ -628,6 +628,10 @@ rumbuild(Relation heap, Relation index, struct IndexInfo *indexInfo) @@ -24,24 +24,12 @@ index 255e616..7a2240f 100644 /* * Write index to xlog */ -@@ -713,6 +721,22 @@ rumbuild(Relation heap, Relation index, struct IndexInfo *indexInfo) +@@ -713,6 +721,10 @@ rumbuild(Relation heap, Relation index, struct IndexInfo *indexInfo) UnlockReleaseBuffer(buffer); } +#ifdef NEON_SMGR -+ { -+#if PG_VERSION_NUM >= 160000 -+ RelFileLocator rlocator = RelationGetSmgr(index)->smgr_rlocator.locator; -+#else -+ RelFileNode rlocator = RelationGetSmgr(index)->smgr_rnode.node; -+#endif -+ if (set_lwlsn_block_range_hook) -+ set_lwlsn_block_range_hook(XactLastRecEnd, rlocator, MAIN_FORKNUM, 0, RelationGetNumberOfBlocks(index)); -+ if (set_lwlsn_relation_hook) -+ set_lwlsn_relation_hook(XactLastRecEnd, rlocator, MAIN_FORKNUM); -+ -+ smgr_end_unlogged_build(index->rd_smgr); -+ } ++ smgr_end_unlogged_build(index->rd_smgr); +#endif + /* diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index ef6bd038bb..9fe085c558 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -2040,7 +2040,7 @@ neon_finish_unlogged_build_phase_1(SMgrRelation reln) /* * neon_end_unlogged_build() -- Finish an unlogged rel build. * - * Call this after you have finished WAL-logging an relation that was + * Call this after you have finished WAL-logging a relation that was * first populated without WAL-logging. * * This removes the local copy of the rel, since it's now been fully @@ -2059,14 +2059,35 @@ neon_end_unlogged_build(SMgrRelation reln) if (unlogged_build_phase != UNLOGGED_BUILD_NOT_PERMANENT) { + XLogRecPtr recptr; + BlockNumber nblocks; + Assert(unlogged_build_phase == UNLOGGED_BUILD_PHASE_2); Assert(reln->smgr_relpersistence == RELPERSISTENCE_UNLOGGED); + /* + * Update the last-written LSN cache. + * + * The relation is still on local disk so we can get the size by + * calling mdnblocks() directly. For the LSN, GetXLogInsertRecPtr() is + * very conservative. If we could assume that this function is called + * from the same backend that WAL-logged the contents, we could use + * XactLastRecEnd here. But better safe than sorry. + */ + nblocks = mdnblocks(reln, MAIN_FORKNUM); + recptr = GetXLogInsertRecPtr(); + + neon_set_lwlsn_block_range(recptr, + InfoFromNInfoB(rinfob), + MAIN_FORKNUM, 0, nblocks); + neon_set_lwlsn_relation(recptr, + InfoFromNInfoB(rinfob), + MAIN_FORKNUM); + /* Make the relation look permanent again */ reln->smgr_relpersistence = RELPERSISTENCE_PERMANENT; /* Remove local copy */ - rinfob = InfoBFromSMgrRel(reln); for (int forknum = 0; forknum <= MAX_FORKNUM; forknum++) { neon_log(SmgrTrace, "forgetting cached relsize for %u/%u/%u.%u", diff --git a/vendor/postgres-v14 b/vendor/postgres-v14 index a0391901a2..d3c9d61fb7 160000 --- a/vendor/postgres-v14 +++ b/vendor/postgres-v14 @@ -1 +1 @@ -Subproject commit a0391901a2af13aa029b905272a5b2024133c926 +Subproject commit d3c9d61fb7a362a165dac7060819dd9d6ad68c28 diff --git a/vendor/postgres-v15 b/vendor/postgres-v15 index aeb292eeac..8ecb12f21d 160000 --- a/vendor/postgres-v15 +++ b/vendor/postgres-v15 @@ -1 +1 @@ -Subproject commit aeb292eeace9072e07071254b6ffc7a74007d4d2 +Subproject commit 8ecb12f21d862dfa39f7204b8f5e1c00a2a225b3 diff --git a/vendor/postgres-v16 b/vendor/postgres-v16 index d56e79cd5d..37496f87b5 160000 --- a/vendor/postgres-v16 +++ b/vendor/postgres-v16 @@ -1 +1 @@ -Subproject commit d56e79cd5d6136c159b1d8d98acb7981d4b69364 +Subproject commit 37496f87b5324af53c56127e278ee5b1e8435253 diff --git a/vendor/postgres-v17 b/vendor/postgres-v17 index 66114c23bc..eab3a37834 160000 --- a/vendor/postgres-v17 +++ b/vendor/postgres-v17 @@ -1 +1 @@ -Subproject commit 66114c23bc61205b0e3fb1e77ee76a4abc1eb4b8 +Subproject commit eab3a37834cac6ec0719bf817ac918a201712d66 diff --git a/vendor/revisions.json b/vendor/revisions.json index d7eddf42b7..90d878d0f7 100644 --- a/vendor/revisions.json +++ b/vendor/revisions.json @@ -1,18 +1,18 @@ { "v17": [ "17.4", - "66114c23bc61205b0e3fb1e77ee76a4abc1eb4b8" + "eab3a37834cac6ec0719bf817ac918a201712d66" ], "v16": [ "16.8", - "d56e79cd5d6136c159b1d8d98acb7981d4b69364" + "37496f87b5324af53c56127e278ee5b1e8435253" ], "v15": [ "15.12", - "aeb292eeace9072e07071254b6ffc7a74007d4d2" + "8ecb12f21d862dfa39f7204b8f5e1c00a2a225b3" ], "v14": [ "14.17", - "a0391901a2af13aa029b905272a5b2024133c926" + "d3c9d61fb7a362a165dac7060819dd9d6ad68c28" ] }