diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/analytics.c | 3 | ||||
-rw-r--r-- | daemon/global_statistics.c | 5 | ||||
-rw-r--r-- | daemon/main.c | 21 | ||||
-rw-r--r-- | daemon/unit_test.c | 7 |
4 files changed, 9 insertions, 27 deletions
diff --git a/daemon/analytics.c b/daemon/analytics.c index c779253485..6c02561d0c 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -2,9 +2,6 @@ #include "common.h" #include "buildinfo.h" -#ifdef ENABLE_DBENGINE -#include "database/engine/rrdengineapi.h" -#endif struct analytics_data analytics_data; extern void analytics_exporting_connectors (BUFFER *b); diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c index a5f7094d54..b5740b176f 100644 --- a/daemon/global_statistics.c +++ b/daemon/global_statistics.c @@ -1,9 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "common.h" -#ifdef ENABLE_DBENGINE -#include "database/engine/rrdengineapi.h" -#endif #define GLOBAL_STATS_RESET_WEB_USEC_MAX 0x01 @@ -459,7 +456,7 @@ static void dbengine_statistics_charts(void) { rrdhost_foreach_read(host) { if (host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && !rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) { - if (host->rrdeng_ctx == host->rrdeng_ctx->engine->context) { + if (&multidb_ctx == host->rrdeng_ctx) { if (counted_multihost_db) continue; /* Only count multi-host DB once */ counted_multihost_db = 1; diff --git a/daemon/main.c b/daemon/main.c index fd5a42d96c..6a07add1c9 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -3,10 +3,6 @@ #include "common.h" #include "buildinfo.h" #include "static_threads.h" -#include "database/storage_engine.h" -#ifdef ENABLE_DBENGINE -#include "database/engine/rrdengineapi.h" -#endif int netdata_zero_metrics_enabled; int netdata_anonymous_statistics_enabled; @@ -58,18 +54,13 @@ void netdata_cleanup_and_exit(int ret) { // free the database info("EXIT: freeing database memory..."); - for (STORAGE_ENGINE* eng = storage_engine_foreach_init(); eng; eng = storage_engine_foreach_next(eng)) { - if (eng->context) - eng->api.engine_ops.exit(eng->context); - } - +#ifdef ENABLE_DBENGINE + rrdeng_prepare_exit(&multidb_ctx); +#endif rrdhost_free_all(); - for (STORAGE_ENGINE* eng = storage_engine_foreach_init(); eng; eng = storage_engine_foreach_next(eng)) { - if (eng->context) { - eng->api.engine_ops.destroy(eng->context); - eng->context = NULL; - } - } +#ifdef ENABLE_DBENGINE + rrdeng_exit(&multidb_ctx); +#endif } sql_close_database(); diff --git a/daemon/unit_test.c b/daemon/unit_test.c index 2dc92dcb21..35f8613a2b 100644 --- a/daemon/unit_test.c +++ b/daemon/unit_test.c @@ -1,9 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "common.h" -#ifdef ENABLE_DBENGINE -#include "database/engine/rrdengineapi.h" -#endif static int check_number_printing(void) { struct { @@ -1160,7 +1157,7 @@ int run_test(struct test *test) RRDSET *st = rrdset_create_localhost("netdata", name, name, "netdata", NULL, "Unit Testing", "a value", "unittest", NULL, 1 , test->update_every, RRDSET_TYPE_LINE); RRDDIM *rd = rrddim_add(st, "dim1", NULL, test->multiplier, test->divisor, test->algorithm); - + RRDDIM *rd2 = NULL; if(test->feed2) rd2 = rrddim_add(st, "dim2", NULL, test->multiplier, test->divisor, test->algorithm); @@ -1176,7 +1173,7 @@ int run_test(struct test *test) if(c) { time_now += test->feed[c].microseconds; - fprintf(stderr, " > %s: feeding position %lu, after %0.3f seconds (%0.3f seconds from start), delta " CALCULATED_NUMBER_FORMAT ", rate " CALCULATED_NUMBER_FORMAT "\n", + fprintf(stderr, " > %s: feeding position %lu, after %0.3f seconds (%0.3f seconds from start), delta " CALCULATED_NUMBER_FORMAT ", rate " CALCULATED_NUMBER_FORMAT "\n", test->name, c+1, (float)test->feed[c].microseconds / 1000000.0, (float)time_now / 1000000.0, |