Fix tier statistics (#17849)
* Do not query disk space for non dbengine tier * No need to check tier quota for non dbengine tiers
Stelios Fragkakis committed
Jun 9, 2024 at 23:12 UTC
f2617f1076209a89b98901fc19b753442d360699
2 files changed
+4
-1
src/database/contexts/api_v2.c
+1
-1
@@ -1183,7 +1183,7 @@ void buffer_json_agents_v2(BUFFER *wb, struct query_timings *timings, time_t now
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)
1186
+ if (!max && eng->seb == STORAGE_ENGINE_BACKEND_DBENGINE)
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);
src/database/engine/rrdengine.c
+3
@@ -1649,6 +1649,9 @@ void retention_timer_cb(uv_timer_t *handle)
1649
uv_update_time(handle->loop);
1650
1651
for (size_t tier = 0; tier < storage_tiers; tier++) {
1652
+ STORAGE_ENGINE *eng = localhost->db[tier].eng;
1653
+ if (!eng || eng->seb != STORAGE_ENGINE_BACKEND_DBENGINE)
1654
+ continue;
1655
bool cleanup = rrdeng_ctx_tier_cap_exceeded(multidb_ctx[tier]);
1656
if (cleanup)
1657
rrdeng_enq_cmd(multidb_ctx[tier], RRDENG_OPCODE_DATABASE_ROTATE, NULL, NULL, STORAGE_PRIORITY_INTERNAL_DBENGINE, NULL, NULL);