Fix compilation without dbengine (#17843)
Stelios Fragkakis committed
Jun 7, 2024 at 20:55 UTC
46bc24373023d032d6bf1553c38d0a46f4af3cbd
4 files changed
+18
-1
src/daemon/main.c
+2
@@ -1119,11 +1119,13 @@ static int get_hostname(char *buf, size_t buf_size) {
1119
1120
static void get_netdata_configured_variables()
1121
{
1122
+#ifdef ENABLE_DBENGINE
1123
legacy_multihost_db_space = config_exists(CONFIG_SECTION_DB, "dbengine multihost disk space MB");
1124
if (!legacy_multihost_db_space)
1125
legacy_multihost_db_space = config_exists(CONFIG_SECTION_GLOBAL, "dbengine multihost disk space");
1126
if (!legacy_multihost_db_space)
1127
legacy_multihost_db_space = config_exists(CONFIG_SECTION_GLOBAL, "dbengine disk space");
1128
+#endif
1129
1130
backwards_compatible_config();
1131
src/daemon/service.c
+2
@@ -314,7 +314,9 @@ void *service_main(void *ptr)
314
}
315
real_step = USEC_PER_SEC;
316
317
+#ifdef ENABLE_DBENGINE
318
dbengine_retention_statistics();
319
+#endif
320
321
svc_rrd_cleanup_obsolete_charts_from_all_hosts();
322
src/database/contexts/api_v2.c
+6
-1
@@ -1182,8 +1182,10 @@ void buffer_json_agents_v2(BUFFER *wb, struct query_timings *timings, time_t now
1182
1183
group_seconds *= storage_tiers_grouping_iterations[tier];
1184
uint64_t max = storage_engine_disk_space_max(eng->seb, localhost->db[tier].si);
1185
+#ifdef ENABLE_DBENGINE
1186
if (!max)
1187
max = get_directory_free_bytes_space(multidb_ctx[tier]);
1188
+#endif
1189
uint64_t used = storage_engine_disk_space_used(eng->seb, localhost->db[tier].si);
1190
time_t first_time_s = storage_engine_global_first_time_s(eng->seb, localhost->db[tier].si);
1191
size_t currently_collected_metrics = storage_engine_collected_metrics(eng->seb, localhost->db[tier].si);
@@ -1220,7 +1222,10 @@ void buffer_json_agents_v2(BUFFER *wb, struct query_timings *timings, time_t now
1222
buffer_json_member_add_string(wb, "retention_human", human_retention);
1223
1224
if(used || max) { // we have disk space information
1223
- time_t time_retention = multidb_ctx[tier]->config.max_retention_s;
1225
+ time_t time_retention = 0;
1226
+#ifdef ENABLE_DBENGINE
1227
+ time_retention = multidb_ctx[tier]->config.max_retention_s;
1228
+#endif
1229
time_t space_retention = (time_t)((NETDATA_DOUBLE)(now_s - first_time_s) * 100.0 / percent);
1230
time_t actual_retention = MIN(space_retention, time_retention ? time_retention : space_retention);
1231
src/web/api/queries/query.c
+8
@@ -1966,7 +1966,11 @@ void store_metric_at_tier(RRDDIM *rd, size_t tier, struct rrddim_tier *t, STORAG
1966
1967
void rrdr_fill_tier_gap_from_smaller_tiers(RRDDIM *rd, size_t tier, time_t now_s) {
1968
if(unlikely(tier >= storage_tiers)) return;
1969
+#ifdef ENABLE_DBENGINE
1970
if(default_backfill == RRD_BACKFILL_NONE) return;
1971
+#else
1972
+ return;
1973
+#endif
1974
1975
struct rrddim_tier *t = &rd->tiers[tier];
1976
if(unlikely(!t)) return;
@@ -1976,7 +1980,11 @@ void rrdr_fill_tier_gap_from_smaller_tiers(RRDDIM *rd, size_t tier, time_t now_s
1980
time_t time_diff = now_s - latest_time_s;
1981
1982
// if the user wants only NEW backfilling, and we don't have any data
1983
+#ifdef ENABLE_DBENGINE
1984
if(default_backfill == RRD_BACKFILL_NEW && latest_time_s <= 0) return;
1985
+#else
1986
+ return;
1987
+#endif
1988
1989
// there is really nothing we can do
1990
if(now_s <= latest_time_s || time_diff < granularity) return;