summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-01-13 19:52:55 +0200
committerGitHub <noreply@github.com>2023-01-13 19:52:55 +0200
commit68658fc1e0a0902343bb165b7ed12b6fba1f2202 (patch)
treeb4b15043880ca48d146f8d8c09a039db42d69d71 /libnetdata
parent6f587f5aced38d7f55a95fe815bb59499552345d (diff)
DBENGINE v2 - improvements 2 (#14257)
* allow extents to be merged for as long as possible * do not block the event loop while recalculating retention due to datafile rotation * buffers are incrementally cleaned up, every second, by just 1 entry * fix order of commands * remove newline * measure cancelled extent read requests * count all cancelled extent requests * do not double count failed pages * fixed cancelled name * Fix error and warnings when compiling with --disable-dbengine * when the timeframe is outside retention and whole query should fail * do not mark as failed pages that have been loaded but have been skipped * added chart to show cache memory calculation variables * LONG_MAX for 32-bit compatibility * fix cache size calculation on 32-bit * fix cache size calculation on 32-bit - use unsinged long long * fix compilation warnings on 32-bits * fix another compilation warning on 32-bits * fix compilation warnings on older 32-bit compilers * fix compilation warnings on older 32-bit compilers - more of them * disable ML threads joining Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/july/july.c20
-rw-r--r--libnetdata/july/july.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/libnetdata/july/july.c b/libnetdata/july/july.c
index eda2f7ed34..ccb8ef4cf6 100644
--- a/libnetdata/july/july.c
+++ b/libnetdata/july/july.c
@@ -56,20 +56,26 @@ static struct {
},
};
-void julyl_cleanup(void) {
- netdata_spinlock_lock(&julyl_globals.protected.spinlock);
+void julyl_cleanup1(void) {
+ struct JulyL *item = NULL;
+
+ if(!netdata_spinlock_trylock(&julyl_globals.protected.spinlock))
+ return;
- while(julyl_globals.protected.available_items && julyl_globals.protected.available > 10) {
- struct JulyL *item = julyl_globals.protected.available_items;
+ if(julyl_globals.protected.available_items && julyl_globals.protected.available > 10) {
+ item = julyl_globals.protected.available_items;
DOUBLE_LINKED_LIST_REMOVE_UNSAFE(julyl_globals.protected.available_items, item, cache.prev, cache.next);
+ julyl_globals.protected.available--;
+ }
+
+ netdata_spinlock_unlock(&julyl_globals.protected.spinlock);
+
+ if(item) {
size_t bytes = item->bytes;
freez(item);
- julyl_globals.protected.available--;
__atomic_sub_fetch(&julyl_globals.atomics.bytes, bytes, __ATOMIC_RELAXED);
__atomic_sub_fetch(&julyl_globals.atomics.allocated, 1, __ATOMIC_RELAXED);
}
-
- netdata_spinlock_unlock(&julyl_globals.protected.spinlock);
}
struct JulyL *julyl_get(void) {
diff --git a/libnetdata/july/july.h b/libnetdata/july/july.h
index 9a273b7e6b..672ed44e4e 100644
--- a/libnetdata/july/july.h
+++ b/libnetdata/july/july.h
@@ -33,7 +33,7 @@ static inline PPvoid_t JulyLLastThenPrev(Pcvoid_t PArray, Word_t * PIndex, bool
return JulyLPrev(PArray, PIndex, PJE0);
}
-void julyl_cleanup(void);
+void julyl_cleanup1(void);
size_t julyl_cache_size(void);
size_t julyl_bytes_moved(void);