Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
883379f
Add cache for relation kind
Jun 8, 2025
1f93b66
Add test_unlogged for measuring effect of relkind cache
Jun 9, 2025
8884f55
Increase number of updates in test_unlogged.py
Jun 9, 2025
c083765
Address review comments
Jun 11, 2025
ac233dc
Fix access to uninitialized flag
Jun 12, 2025
510c891
Add comments
Jun 12, 2025
2e34fe0
Replace flags with enum
Jun 27, 2025
d5d4124
Fix incorrect unpin condition in get_cached_relkind
Jun 28, 2025
a9d4cbe
Unpin entry in case of mdexists error
Jul 11, 2025
2c0a87a
Update pgxn/neon/relkind_cache.c
knizhnik Jul 11, 2025
02ecb1e
Update pgxn/neon/pagestore_client.h
knizhnik Jul 11, 2025
a9e940e
Add assertion to store_cached_relkind
Jul 11, 2025
840c73e
Rename safe_mdexists to determine_entry_relkind and do unpin instead …
Jul 12, 2025
e9df43a
Change return type of determine_entry_relkind to RelKind
Jul 12, 2025
87c9b06
Remove obsolete comment
Jul 12, 2025
ca13e7a
Do not return from TRY/CATCH in determine_entry_relkind
Jul 12, 2025
20dea3a
Move lwlock to pagestore_smgr
Jul 13, 2025
1e4783f
Update pgxn/neon/pagestore_client.h
knizhnik Jul 14, 2025
c3fdab3
Update pgxn/neon/pagestore_client.h
knizhnik Jul 14, 2025
5d93a8c
Update pgxn/neon/relkind_cache.c
knizhnik Jul 14, 2025
fb6d7c4
Fix merge conflict
Jul 14, 2025
902ea0c
Address review comments
Jul 14, 2025
c1362cb
Fix empty list check
Jul 14, 2025
9d12eea
Fix merge problems
Jul 14, 2025
67c31b6
Fix warning
Jul 14, 2025
1c0f4d6
Replace spinlock with LWLock
Jul 17, 2025
1ca23b4
Add comment to the test
Jul 17, 2025
8e15056
Handle init fork in specialk way
Jul 17, 2025
eabac14
Fix merge conflicts
Jul 18, 2025
de33aff
Fix merge conflicts
Jul 18, 2025
3c54a23
Add test_unlogged_build.py
Jul 18, 2025
ae7b92a
Undo check for INIT_FORKNUM
Jul 19, 2025
28ce584
Rename relkind to relpersistence
Jul 19, 2025
4580391
Update pgxn/neon/pagestore_smgr.c
knizhnik Jul 22, 2025
4885621
Update pgxn/neon/pagestore_smgr.c
knizhnik Jul 22, 2025
657c63b
Update pgxn/neon/pagestore_smgr.c
knizhnik Jul 22, 2025
9955d02
Update pgxn/neon/pagestore_smgr.c
knizhnik Jul 22, 2025
388be47
Update test_runner/performance/test_unlogged.py
knizhnik Jul 22, 2025
adf103a
Update test_runner/performance/test_unlogged.py
knizhnik Jul 22, 2025
ec89876
Update test_runner/performance/test_unlogged_build.py
knizhnik Jul 22, 2025
b36c02d
Update pgxn/neon/pagestore_smgr.c
knizhnik Jul 22, 2025
d6d39f7
Reduce size of shared_buffer in test_unlogged_build to rertproduce th…
Jul 22, 2025
0226a67
Restore timeout for test_unlogged_)build_test
Jul 23, 2025
6164f5e
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
dd14409
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
d961d39
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
74076ee
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
34cf566
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
374cd22
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
963ffda
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
382895d
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
9030bc8
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
4c49423
Update pgxn/neon/relperst_cache.c
knizhnik Jul 23, 2025
b7dbf4c
Update test_runner/performance/test_unlogged.py
knizhnik Jul 23, 2025
2546b79
Update test_runner/performance/test_unlogged.py
knizhnik Jul 23, 2025
71980e3
Address review comments
Jul 23, 2025
43b0106
Improve the added test case
hlinnaka Jul 28, 2025
d161115
Update test_runner/performance/test_unlogged_build.py
knizhnik Jul 28, 2025
b71c609
Move test_unlogged_build.py from p[erformance to regression tests
Jul 28, 2025
499df11
Fix bug with using @skip_in_debug_build directive
Jul 28, 2025
d3f91be
Compare unlogged build speed with vanilla
Jul 29, 2025
75dafd4
Speedup test_unlogged_build.py
Jul 29, 2025
9a1317e
Update pgxn/neon/relperst_cache.c
knizhnik Jul 31, 2025
f8b4875
Update test_runner/regress/test_unlogged_build.py
knizhnik Jul 31, 2025
9290103
Update test_runner/regress/test_unlogged_build.py
knizhnik Jul 31, 2025
fbd668e
Update comment for test_runner/regress/test_unlogged_build.py
Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pgxn/neon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ OBJS = \
neon_walreader.o \
pagestore_smgr.o \
relsize_cache.o \
relperst_cache.o \
unstable_extensions.o \
walproposer.o \
walproposer_pg.o \
Expand Down
3 changes: 3 additions & 0 deletions pgxn/neon/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ _PG_init(void)
/* Stage 1: Define GUCs, and other early intialization */
pg_init_libpagestore();
relsize_hash_init();
relperst_hash_init();
lfc_init();
pg_init_walproposer();
init_lwlsncache();
Expand Down Expand Up @@ -722,6 +723,7 @@ neon_shmem_request_hook(void)
NeonPerfCountersShmemRequest();
PagestoreShmemRequest();
RelsizeCacheShmemRequest();
RelperstCacheShmemRequest();
WalproposerShmemRequest();
LwLsnCacheShmemRequest();
}
Expand All @@ -744,6 +746,7 @@ neon_shmem_startup_hook(void)
NeonPerfCountersShmemInit();
PagestoreShmemInit();
RelsizeCacheShmemInit();
RelperstCacheShmemInit();
WalproposerShmemInit();
LwLsnCacheShmemInit();

Expand Down
2 changes: 2 additions & 0 deletions pgxn/neon/neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ extern PGDLLEXPORT void LogicalSlotsMonitorMain(Datum main_arg);
extern void LfcShmemRequest(void);
extern void PagestoreShmemRequest(void);
extern void RelsizeCacheShmemRequest(void);
extern void RelperstCacheShmemRequest(void);
extern void WalproposerShmemRequest(void);
extern void LwLsnCacheShmemRequest(void);
extern void NeonPerfCountersShmemRequest(void);

extern void LfcShmemInit(void);
extern void PagestoreShmemInit(void);
extern void RelsizeCacheShmemInit(void);
extern void RelperstCacheShmemInit(void);
extern void WalproposerShmemInit(void);
extern void LwLsnCacheShmemInit(void);
extern void NeonPerfCountersShmemInit(void);
Expand Down
46 changes: 46 additions & 0 deletions pgxn/neon/pagestore_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,50 @@ extern void set_cached_relsize(NRelFileInfo rinfo, ForkNumber forknum, BlockNumb
extern void update_cached_relsize(NRelFileInfo rinfo, ForkNumber forknum, BlockNumber size);
extern void forget_cached_relsize(NRelFileInfo rinfo, ForkNumber forknum);

/*
* Relation persistence enum.
*/
typedef enum
{
/* The persistence is not known */
NEON_RELPERSISTENCE_UNKNOWN,

/* The relation is a permanent relation that is WAL-logged normally */
NEON_RELPERSISTENCE_PERMANENT,

/* The relation is an unlogged table/index, stored only on local disk */
NEON_RELPERSISTENCE_UNLOGGED,

/*
* The relation is a permanent (index) relation, but it is being built by an in-progress
* transaction. It currently only lives on local disk and hasn't been WAL-logged yet.
* It will turn into a permanent relation later when the index build completes.
* This is currently used for GiST, SP-GiST and GIN indexes, as well as the pgvector
* extension.
*/
NEON_RELPERSISTENCE_UNLOGGED_BUILD
} NeonRelPersistence;

/*
* Entry type stored in relperst_hash. We have just one entry for the whole relation, i.e. we don't have separate entries for the individual forks.
* It gets a little complicated with unlogged relations. The main fork of an unlogged relation is considered UNLOGGED, but its init-fork is
* treated as PERMANENT. It is specially checked in neon_write.
*/
typedef struct
{
NRelFileInfo rel;
uint8 relperst; /* See NeonRelPersistence */
uint16 access_count;
dlist_node lru_node; /* LRU list node */
} NeonRelPersistenceEntry;

extern LWLockId finish_unlogged_build_lock;

extern void relperst_hash_init(void);
extern void set_cached_relperst(NRelFileInfo rinfo, NeonRelPersistence relperst);
extern NeonRelPersistence get_cached_relperst(NRelFileInfo rinfo);
extern NeonRelPersistenceEntry* pin_cached_relperst(NRelFileInfo rinfo, NeonRelPersistence relperst);
extern void unpin_cached_relperst(NeonRelPersistenceEntry* entry);
extern void forget_cached_relperst(NRelFileInfo rinfo);

#endif /* PAGESTORE_CLIENT_H */
Loading
Loading