mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-30 09:41:15 +08:00
Fix init_fork WAL-logging on unlogged indexes (#591)
Currently pgvector does not create any WAL records for unlogged tables Postgres assumes INIT_FORK of unlogged tables is persistent and uses it to reset the table index to its default empty state after a server crash. This patch makes INIT_FORK of unlogged table WAL-tracked, which ensures an unlogged table is usable after a crash-restart
This commit is contained in:
@@ -1121,8 +1121,8 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo,
|
||||
|
||||
BuildGraph(buildstate, forkNum);
|
||||
|
||||
if (RelationNeedsWAL(index))
|
||||
log_newpage_range(index, forkNum, 0, RelationGetNumberOfBlocks(index), true);
|
||||
if (RelationNeedsWAL(index) || forkNum == INIT_FORKNUM)
|
||||
log_newpage_range(index, forkNum, 0, RelationGetNumberOfBlocksInFork(index, forkNum), true);
|
||||
|
||||
FreeBuildState(buildstate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user