mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 09:22:55 +00:00
Add readahead_distance GUC
This commit is contained in:
@@ -49,7 +49,6 @@ static int max_access_stat_count;
|
||||
static double min_seq_access_ratio;
|
||||
static int min_seq_access_count;
|
||||
|
||||
|
||||
void access_stat_init(void)
|
||||
{
|
||||
MemoryContext memctx = AllocSetContextCreate(TopMemoryContext,
|
||||
|
||||
@@ -58,6 +58,7 @@ char *neon_auth_token;
|
||||
int n_unflushed_requests = 0;
|
||||
int flush_every_n_requests = 8;
|
||||
int readahead_buffer_size = 128;
|
||||
int readahead_distance = 10;
|
||||
|
||||
bool (*old_redo_read_buffer_filter) (XLogReaderState *record, uint8 block_id) = NULL;
|
||||
|
||||
@@ -452,6 +453,18 @@ pg_init_libpagestore(void)
|
||||
PGC_USERSET,
|
||||
0, /* no flags required */
|
||||
NULL, (GucIntAssignHook) &readahead_buffer_resize, NULL);
|
||||
DefineCustomIntVariable("neon.readahead_distance",
|
||||
"Number of read-ahead blocks",
|
||||
NULL,
|
||||
&readahead_distance,
|
||||
10,
|
||||
0,
|
||||
INT_MAX,
|
||||
PGC_USERSET,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
relsize_hash_init();
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ extern page_server_api * page_server;
|
||||
extern char *page_server_connstring;
|
||||
extern int flush_every_n_requests;
|
||||
extern int readahead_buffer_size;
|
||||
extern int readahead_distance = 10;
|
||||
extern bool seqscan_prefetch_enabled;
|
||||
extern int seqscan_prefetch_distance;
|
||||
extern char *neon_timeline;
|
||||
|
||||
@@ -2006,7 +2006,7 @@ neon_read(SMgrRelation reln, ForkNumber forkNum, BlockNumber blkno,
|
||||
|
||||
/* If it is expected to be sequential access then initiate prefetch of next block */
|
||||
if (is_sequential_access(reln->smgr_rnode.node, forkNum, blkno))
|
||||
neon_prefetch(reln, forkNum, blkno+1);
|
||||
neon_prefetch(reln, forkNum, blkno + readahead_distance);
|
||||
|
||||
/* Try to read from local file cache */
|
||||
if (lfc_read(reln->smgr_rnode.node, forkNum, blkno, buffer))
|
||||
|
||||
Reference in New Issue
Block a user