summaryrefslogtreecommitdiffstats
path: root/database/engine
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-17 09:30:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-17 09:30:23 +0000
commit517a443636daa1e8085cb4e5325524a54e8a8fd7 (patch)
tree5352109cc7cd5122274ab0cfc1f887b685f04edf /database/engine
parentReleasing debian version 1.42.4-1. (diff)
downloadnetdata-517a443636daa1e8085cb4e5325524a54e8a8fd7.tar.xz
netdata-517a443636daa1e8085cb4e5325524a54e8a8fd7.zip
Merging upstream version 1.43.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/engine')
-rw-r--r--database/engine/cache.h4
-rw-r--r--database/engine/datafile.c6
-rw-r--r--database/engine/metric.c2
-rwxr-xr-xdatabase/engine/rrdengineapi.c20
-rw-r--r--database/engine/rrdengineapi.h4
5 files changed, 21 insertions, 15 deletions
diff --git a/database/engine/cache.h b/database/engine/cache.h
index 1486fdc1..c10e0992 100644
--- a/database/engine/cache.h
+++ b/database/engine/cache.h
@@ -71,8 +71,8 @@ struct pgc_statistics {
PGC_CACHE_LINE_PADDING(3);
- size_t entries; // all the entries (includes clean, dirty, host)
- size_t size; // all the entries (includes clean, dirty, host)
+ size_t entries; // all the entries (includes clean, dirty, hot)
+ size_t size; // all the entries (includes clean, dirty, hot)
size_t evicting_entries;
size_t evicting_size;
diff --git a/database/engine/datafile.c b/database/engine/datafile.c
index d5c1285b..fcda84bd 100644
--- a/database/engine/datafile.c
+++ b/database/engine/datafile.c
@@ -112,7 +112,7 @@ bool datafile_acquire_for_deletion(struct rrdengine_datafile *df) {
"but it has %u lockers (oc:%u, pd:%u), "
"%zu clean and %zu hot open cache pages "
"- will be deleted shortly "
- "(scanned open cache in %llu usecs)",
+ "(scanned open cache in %"PRIu64" usecs)",
df->fileno, df->ctx->config.tier,
df->users.lockers,
df->users.lockers_by_reason[DATAFILE_ACQUIRE_OPEN_CACHE],
@@ -129,7 +129,7 @@ bool datafile_acquire_for_deletion(struct rrdengine_datafile *df) {
"but it has %u lockers (oc:%u, pd:%u), "
"%zu clean and %zu hot open cache pages "
"- will be deleted now "
- "(scanned open cache in %llu usecs)",
+ "(scanned open cache in %"PRIu64" usecs)",
df->fileno, df->ctx->config.tier,
df->users.lockers,
df->users.lockers_by_reason[DATAFILE_ACQUIRE_OPEN_CACHE],
@@ -143,7 +143,7 @@ bool datafile_acquire_for_deletion(struct rrdengine_datafile *df) {
internal_error(true, "DBENGINE: datafile %u of tier %d "
"has %u lockers (oc:%u, pd:%u), "
"%zu clean and %zu hot open cache pages "
- "(scanned open cache in %llu usecs)",
+ "(scanned open cache in %"PRIu64" usecs)",
df->fileno, df->ctx->config.tier,
df->users.lockers,
df->users.lockers_by_reason[DATAFILE_ACQUIRE_OPEN_CACHE],
diff --git a/database/engine/metric.c b/database/engine/metric.c
index 0b248c09..69b8f311 100644
--- a/database/engine/metric.c
+++ b/database/engine/metric.c
@@ -923,7 +923,7 @@ int mrg_unittest(void) {
netdata_log_info("DBENGINE METRIC: did %zu additions, %zu duplicate additions, "
"%zu deletions, %zu wrong deletions, "
"%zu successful searches, %zu wrong searches, "
- "in %llu usecs",
+ "in %"PRIu64" usecs",
stats.additions, stats.additions_duplicate,
stats.deletions, stats.delete_misses,
stats.search_hits, stats.search_misses,
diff --git a/database/engine/rrdengineapi.c b/database/engine/rrdengineapi.c
index c6b1fa2d..318a933f 100755
--- a/database/engine/rrdengineapi.c
+++ b/database/engine/rrdengineapi.c
@@ -534,7 +534,8 @@ static void rrdeng_store_metric_append_point(STORAGE_COLLECT_HANDLE *collection_
timing_step(TIMING_STEP_DBENGINE_MRG_UPDATE);
}
-static void store_metric_next_error_log(struct rrdeng_collect_handle *handle, usec_t point_in_time_ut, const char *msg) {
+static void store_metric_next_error_log(struct rrdeng_collect_handle *handle __maybe_unused, usec_t point_in_time_ut __maybe_unused, const char *msg __maybe_unused) {
+#ifdef NETDATA_INTERNAL_CHECKS
time_t point_in_time_s = (time_t)(point_in_time_ut / USEC_PER_SEC);
char uuid[UUID_STR_LEN + 1];
uuid_unparse(*mrg_metric_uuid(main_mrg, handle->metric), uuid);
@@ -562,6 +563,9 @@ static void store_metric_next_error_log(struct rrdeng_collect_handle *handle, us
);
buffer_free(wb);
+#else
+ ;
+#endif
}
void rrdeng_store_metric_next(STORAGE_COLLECT_HANDLE *collection_handle,
@@ -808,12 +812,14 @@ static bool rrdeng_load_page_next(struct storage_engine_query_handle *rrddim_han
if (unlikely(handle->now_s > rrddim_handle->end_time_s))
return false;
- size_t entries;
+ size_t entries = 0;
handle->page = pg_cache_lookup_next(ctx, handle->pdc, handle->now_s, handle->dt_s, &entries);
- if (unlikely(!handle->page))
- return false;
- internal_fatal(pgc_page_data(handle->page) == DBENGINE_EMPTY_PAGE, "Empty page returned");
+ internal_fatal(handle->page && (pgc_page_data(handle->page) == DBENGINE_EMPTY_PAGE || !entries),
+ "A page was returned, but it is empty - pg_cache_lookup_next() should be handling this case");
+
+ if (unlikely(!handle->page || pgc_page_data(handle->page) == DBENGINE_EMPTY_PAGE || !entries))
+ return false;
time_t page_start_time_s = pgc_page_start_time_s(handle->page);
time_t page_end_time_s = pgc_page_end_time_s(handle->page);
@@ -1002,12 +1008,12 @@ bool rrdeng_metric_retention_by_uuid(STORAGE_INSTANCE *db_instance, uuid_t *dim_
return true;
}
-size_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance) {
+uint64_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance) {
struct rrdengine_instance *ctx = (struct rrdengine_instance *)db_instance;
return ctx->config.max_disk_space;
}
-size_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance) {
+uint64_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance) {
struct rrdengine_instance *ctx = (struct rrdengine_instance *)db_instance;
return __atomic_load_n(&ctx->atomic.current_disk_space, __ATOMIC_RELAXED);
}
diff --git a/database/engine/rrdengineapi.h b/database/engine/rrdengineapi.h
index 12f1becd..61449426 100644
--- a/database/engine/rrdengineapi.h
+++ b/database/engine/rrdengineapi.h
@@ -222,7 +222,7 @@ RRDENG_SIZE_STATS rrdeng_size_statistics(struct rrdengine_instance *ctx);
size_t rrdeng_collectors_running(struct rrdengine_instance *ctx);
bool rrdeng_is_legacy(STORAGE_INSTANCE *db_instance);
-size_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance);
-size_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance);
+uint64_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance);
+uint64_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance);
#endif /* NETDATA_RRDENGINEAPI_H */