Do not fail agent if DBENGINE is not available and memory mode is set to dbengine (#11207)
Use memory mode RAM instead
Stelios Fragkakis committed
Jun 1, 2021 at 13:00 UTC
baa53991266b786127aa103add685d2ad23e4271
2 files changed
+7
-4
daemon/main.c
+5
-2
@@ -542,7 +542,6 @@ static void get_netdata_configured_variables() {
542
// get default memory mode for the database
543
544
default_rrd_memory_mode = rrd_memory_mode_id(config_get(CONFIG_SECTION_GLOBAL, "memory mode", rrd_memory_mode_name(default_rrd_memory_mode)));
545
-
545
#ifdef ENABLE_DBENGINE
546
// ------------------------------------------------------------------------
547
// get default Database Engine page cache size in MiB
@@ -567,7 +566,11 @@ static void get_netdata_configured_variables() {
566
error("Invalid multidb disk space %d given. Defaulting to %d.", default_multidb_disk_quota_mb, default_rrdeng_disk_quota_mb);
567
default_multidb_disk_quota_mb = default_rrdeng_disk_quota_mb;
568
}
570
-
569
+#else
570
+ if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) {
571
+ error_report("RRD_MEMORY_MODE_DBENGINE is not supported in this platform. The agent will use memory mode ram instead.");
572
+ default_rrd_memory_mode = RRD_MEMORY_MODE_RAM;
573
+ }
574
#endif
575
// ------------------------------------------------------------------------
576
database/rrdhost.c
+2
-2
@@ -656,7 +656,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info) {
656
657
if (unlikely(sql_init_database())) {
658
if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE)
659
- return 1;
659
+ fatal("Failed to initialize SQLite");
660
info("Skipping SQLITE metadata initialization since memory mode is not db engine");
661
}
662
@@ -709,7 +709,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info) {
709
rrdhost_free(localhost);
710
localhost = NULL;
711
rrd_unlock();
712
- return 1;
712
+ fatal("Failed to initialize dbengine");
713
}
714
#endif
715
rrd_unlock();