summaryrefslogtreecommitdiffstats
path: root/database/engine/pagecache.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:11 +0000
commit483926a283e118590da3f9ecfa75a8a4d62143ce (patch)
treecb77052778df9a128a8cd3ff5bf7645322a13bc5 /database/engine/pagecache.c
parentReleasing debian version 1.31.0-4. (diff)
downloadnetdata-483926a283e118590da3f9ecfa75a8a4d62143ce.tar.xz
netdata-483926a283e118590da3f9ecfa75a8a4d62143ce.zip
Merging upstream version 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
+}