Skip to content

Commit 0d78936

Browse files
author
Heikki Linnakangas
committed
Remove unnecessary set_lwlsn_block_* hooks
The hook calls from gist_indexsortbuild() on PostgreSQL 17 was unnecessary, because the smgr_bulk_*() functions perform smgrextend/smgrwrite calls and WAL-logging so that the last-written LSN cache is updated normally. (If they didn't, we'd have problems with B-tree index builds and anything else that uses the bulk-writing facility too.) Remove those hook calls from gist_indexsortbuild(). That was the only usage of set_lwlsn_block_hook. set_lwlsn_block_range_hook and set_lwlsn_block_v_hook were unused even before this.
1 parent 1b558ed commit 0d78936

File tree

3 files changed

+0
-20
lines changed

3 files changed

+0
-20
lines changed

src/backend/access/gist/gistbuild.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,6 @@ gist_indexsortbuild(GISTBuildState *state)
456456
memcpy(rootbuf, levelstate->pages[0], BLCKSZ);
457457
smgr_bulk_write(state->bulkstate, GIST_ROOT_BLKNO, rootbuf, true);
458458

459-
if (RelationNeedsWAL(state->indexrel))
460-
{
461-
XLogRecPtr lsn = GetRedoRecPtr();
462-
463-
if (set_lwlsn_block_hook)
464-
set_lwlsn_block_hook(lsn, state->indexrel->rd_smgr->smgr_rlocator.locator,
465-
MAIN_FORKNUM, GIST_ROOT_BLKNO);
466-
if (set_lwlsn_relation_hook)
467-
set_lwlsn_relation_hook(lsn, state->indexrel->rd_smgr->smgr_rlocator.locator, MAIN_FORKNUM);
468-
}
469-
470459
pfree(levelstate);
471460

472461
smgr_bulk_finish(state->bulkstate);

src/backend/access/transam/xlog.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ int wal_segment_size = DEFAULT_XLOG_SEG_SIZE;
150150
restore_running_xacts_callback_t restore_running_xacts_callback = NULL;
151151

152152
/* NEON: Hooks to facilitate the last written LSN cache */
153-
set_lwlsn_block_hook_type set_lwlsn_block_hook = NULL;
154-
set_lwlsn_block_range_hook_type set_lwlsn_block_range_hook = NULL;
155-
set_lwlsn_block_v_hook_type set_lwlsn_block_v_hook = NULL;
156153
set_lwlsn_db_hook_type set_lwlsn_db_hook = NULL;
157154
set_lwlsn_relation_hook_type set_lwlsn_relation_hook = NULL;
158155
set_max_lwlsn_hook_type set_max_lwlsn_hook = NULL;

src/include/access/xlog.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,10 @@ extern Size WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
282282
TimeLineID tli);
283283

284284
/* Hooks for LwLSN */
285-
typedef XLogRecPtr (*set_lwlsn_block_hook_type)(XLogRecPtr lsn, RelFileLocator relfilenode, ForkNumber forknum, BlockNumber blkno);
286-
typedef XLogRecPtr (*set_lwlsn_block_range_hook_type)(XLogRecPtr lsn, RelFileLocator relfilenode, ForkNumber forknum, BlockNumber from, BlockNumber n_blocks);
287-
typedef XLogRecPtr (*set_lwlsn_block_v_hook_type)(const XLogRecPtr *lsns, RelFileLocator relfilenode, ForkNumber forknum, BlockNumber blockno, int nblocks);
288285
typedef XLogRecPtr (*set_lwlsn_db_hook_type)(XLogRecPtr lsn);
289286
typedef XLogRecPtr (*set_lwlsn_relation_hook_type)(XLogRecPtr lsn, RelFileLocator relfilenode, ForkNumber forknum);
290287
typedef void (*set_max_lwlsn_hook_type) (XLogRecPtr lsn);
291288

292-
extern set_lwlsn_block_hook_type set_lwlsn_block_hook;
293-
extern set_lwlsn_block_range_hook_type set_lwlsn_block_range_hook;
294-
extern set_lwlsn_block_v_hook_type set_lwlsn_block_v_hook;
295289
extern set_lwlsn_db_hook_type set_lwlsn_db_hook;
296290
extern set_lwlsn_relation_hook_type set_lwlsn_relation_hook;
297291
extern set_max_lwlsn_hook_type set_max_lwlsn_hook;

0 commit comments

Comments
 (0)