diff options
Diffstat (limited to 'database/engine/pagecache.c')
-rw-r--r-- | database/engine/pagecache.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/database/engine/pagecache.c b/database/engine/pagecache.c index f17afc22b..90423176c 100644 --- a/database/engine/pagecache.c +++ b/database/engine/pagecache.c @@ -299,10 +299,15 @@ static void pg_cache_reserve_pages(struct rrdengine_instance *ctx, unsigned numb destroy_completion(&compl); if (unlikely(failures > 1)) { - unsigned long slots; + unsigned long slots, usecs_to_sleep; /* exponential backoff */ slots = random() % (2LU << MIN(failures, FAILURES_CEILING)); - (void)sleep_usec(slots * exp_backoff_slot_usec); + usecs_to_sleep = slots * exp_backoff_slot_usec; + + if (usecs_to_sleep >= USEC_PER_SEC) + error("Page cache is full. Sleeping for %llu second(s).", usecs_to_sleep / USEC_PER_SEC); + + (void)sleep_usec(usecs_to_sleep); } uv_rwlock_wrlock(&pg_cache->pg_cache_rwlock); } @@ -1243,4 +1248,4 @@ void free_page_cache(struct rrdengine_instance *ctx) bytes_freed += ret_Judy; info("Freed %lu bytes of memory from page cache.", bytes_freed); -}
\ No newline at end of file +} |