Check for concurrent prewarm

This commit is contained in:
Konstantin Knizhnik
2025-01-30 22:03:39 +02:00
parent f98e54186f
commit 971d20169b
2 changed files with 11 additions and 2 deletions

View File

@@ -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);

View File

@@ -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);
/*