Fix statistics calculation in 32bit systems (#16222)
Use uint64_t for calculations
Stelios Fragkakis committed
Oct 18, 2023 at 10:27 UTC
0801f5bdce26f85af0b99ab1f902a1b3b661b96d
3 files changed
+4
-4
database/engine/rrdengine.c
+2
-2
@@ -1427,8 +1427,8 @@ static void *query_prep_tp_worker(struct rrdengine_instance *ctx __maybe_unused,
1427
return data;
1428
}
1429
1430
-unsigned rrdeng_target_data_file_size(struct rrdengine_instance *ctx) {
1431
- unsigned target_size = ctx->config.max_disk_space / TARGET_DATAFILES;
1430
+uint64_t rrdeng_target_data_file_size(struct rrdengine_instance *ctx) {
1431
+ uint64_t target_size = ctx->config.max_disk_space / TARGET_DATAFILES;
1432
target_size = MIN(target_size, MAX_DATAFILE_SIZE);
1433
target_size = MAX(target_size, MIN_DATAFILE_SIZE);
1434
return target_size;
database/engine/rrdengine.h
+1
-1
@@ -476,7 +476,7 @@ void pdc_route_synchronously(struct rrdengine_instance *ctx, struct page_details
476
void pdc_acquire(PDC *pdc);
477
bool pdc_release_and_destroy_if_unreferenced(PDC *pdc, bool worker, bool router);
478
479
-unsigned rrdeng_target_data_file_size(struct rrdengine_instance *ctx);
479
+uint64_t rrdeng_target_data_file_size(struct rrdengine_instance *ctx);
480
481
struct page_descr_with_data *page_descriptor_get(void);
482
database/rrd.h
+1
-1
@@ -465,7 +465,7 @@ static inline uint64_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND back
465
}
466
467
uint64_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance);
468
-static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
468
+static inline uint64_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
469
#ifdef ENABLE_DBENGINE
470
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
471
return rrdeng_disk_space_used(db_instance);