summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-09-13 00:24:40 +0300
committerGitHub <noreply@github.com>2023-09-13 00:24:40 +0300
commite70e50815ba740edc64d9b3df31e5b79afbffd71 (patch)
tree13107ddf7f3c65f5e1e3bab84138a4427ee5b917 /database
parent69894b1bd32de8c32c8f4880efff993fa9f496f0 (diff)
streaming logs (#15948)
Diffstat (limited to 'database')
-rwxr-xr-xdatabase/engine/rrdengineapi.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/database/engine/rrdengineapi.c b/database/engine/rrdengineapi.c
index c6b1fa2dde..10b8e8e456 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);