mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
Check for concurrent prewarm
This commit is contained in:
@@ -632,6 +632,7 @@ lfc_prewarm(FileCacheStateEntry* fs, size_t n_entries)
|
||||
/* Do not prewarm more entries than LFC limit */
|
||||
if (lfc_ctl->limit <= lfc_ctl->size)
|
||||
{
|
||||
elog(LOG, "LFC: skip prewarm because LFC limit is smaller than prewarm size");
|
||||
LWLockRelease(lfc_lock);
|
||||
return;
|
||||
}
|
||||
@@ -641,12 +642,19 @@ lfc_prewarm(FileCacheStateEntry* fs, size_t n_entries)
|
||||
n_entries = lfc_ctl->limit - lfc_ctl->size;
|
||||
}
|
||||
|
||||
LWLockRelease(lfc_lock);
|
||||
|
||||
if (lfc_ctl->prewarm_total_chunks != lfc_ctl->prewarm_curr_chunk)
|
||||
{
|
||||
elog(LOG, "LFC: skip prewarm because concurrent prewarm is detected");
|
||||
LWLockRelease(lfc_lock);
|
||||
return;
|
||||
}
|
||||
/* Initialize fields used to track prewarming progress */
|
||||
lfc_ctl->prewarm_total_chunks = n_entries;
|
||||
lfc_ctl->prewarm_curr_chunk = 0;
|
||||
|
||||
LWLockRelease(lfc_lock);
|
||||
|
||||
|
||||
ring = (PrewarmRequest*)palloc(sizeof(PrewarmRequest)*ring_size);
|
||||
|
||||
elog(LOG, "LFC: start loading %ld chunks", (long)n_entries);
|
||||
|
||||
@@ -186,6 +186,7 @@ typedef struct
|
||||
{
|
||||
/*
|
||||
* Send this request to the PageServer associated with this shard.
|
||||
* This function assigns request_id to the request which can be extracted by caller from request struct.
|
||||
*/
|
||||
bool (*send) (shardno_t shard_no, NeonRequest * request);
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user