summaryrefslogtreecommitdiffstats
path: root/database/engine/pagecache.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
commite970e0b37b8bd7f246feb3f70c4136418225e434 (patch)
tree0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /database/engine/pagecache.c
parentAdding upstream version 1.31.0. (diff)
downloadnetdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz
netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/engine/pagecache.c')
-rw-r--r--database/engine/pagecache.c11
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
+}