Add prefetch_enabled GUC to trigger Neon prefetch mechansim

This commit is contained in:
Konstantin Knizhnik
2022-09-14 12:59:37 +03:00
parent 53654e4a41
commit d3fafee65b
3 changed files with 11 additions and 1 deletions

View File

@@ -435,6 +435,14 @@ pg_init_libpagestore(void)
GUC_UNIT_MB,
NULL, NULL, NULL);
DefineCustomBoolVariable("neon.prefetch",
"Enable Neon prefetch mechanism",
NULL,
&prefetch_enabled,
false,
PGC_SIGHUP,
NULL, NULL, NULL);
relsize_hash_init();
if (page_server != NULL)

View File

@@ -154,6 +154,7 @@ extern char *zenith_timeline;
extern char *zenith_tenant;
extern bool wal_redo;
extern int32 max_cluster_size;
extern bool prefetch_enabled;
extern const f_smgr *smgr_zenith(BackendId backend, RelFileNode rnode);
extern void smgr_init_zenith(void);

View File

@@ -98,6 +98,7 @@ char *page_server_connstring; // with substituted password
char *zenith_timeline;
char *zenith_tenant;
bool wal_redo = false;
bool prefetch_enabled;
int32 max_cluster_size;
/* unlogged relation build states */
@@ -1026,7 +1027,7 @@ zenith_prefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
elog(ERROR, "unknown relpersistence '%c'", reln->smgr_relpersistence);
}
if (n_prefetch_requests < MAX_PREFETCH_REQUESTS)
if (prefetch_enabled && n_prefetch_requests < MAX_PREFETCH_REQUESTS)
{
prefetch_requests[n_prefetch_requests].rnode = reln->smgr_rnode.node;
prefetch_requests[n_prefetch_requests].forkNum = forknum;