summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2020-07-28 15:04:39 +0300
committerGitHub <noreply@github.com>2020-07-28 15:04:39 +0300
commiteda12f579f97b123ef9b890b01528223a89a70aa (patch)
tree49fe4fd2adbf7fac9ef0f0e959d767ec4daa7849 /daemon
parent3d4314bc4ded8ce68385665754fb3b2134906422 (diff)
Implemented multihost database (#9556)
* Hard code a node for non-legacy multidb test Skip dbengine initialization for new incoming children Add code to switch to multidb ctx when accessing the dbengine * When a non-legacy streaming connection is detected, use the multidb metadata log context * Clear the superblock memory to avoid random data written in the metadata log * Activate the host detection during compaction Activate the host detection during metadata log chart updates Keep the host in the user object during replay of the HOST command * Add defaults for health / rrdpush on HOST metadata replay Check for legacy status on host creation by checking is_archived and if not conclusive, call is_legacy_child() Use defaults from the stream.conf * Count hosts only if not archived When host switches from archived to active update rrd_hosts_available Remove archived hosts from charts and info * Change parameter from "multidb disk space" to "dbengine multihost disk space" Remove unused variables Fix compilation error when dbengine is disabled Fix condition for machine_guid directory creation under cache_dir * Enable multidb disk space file creation. * Stop deleting dimensions when rotating archived metrics if the dimension is active in a different database engine. * Fix old bug in the code that confused obsolete hosts with orphan hosts. * Do not delete multi-host DB host files. * Discard dbengine state when a legacy memory mode instantiates to avoid inconsistencies. * Identify metadata that collide with non-dbengine memory mode hosts and ignore them. * Handle non-dbengine localhost with dbengine archived charts in localhost and streaming. * Ignore archived hosts in streaming. * Add documentation before merging to master. Co-authored-by: Markos Fountoulakis <markos.fountoulakis.senior@gmail.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 122bfaaf49..4b24c85bfa 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -41,7 +41,13 @@ void netdata_cleanup_and_exit(int ret) {
// free the database
info("EXIT: freeing database memory...");
+#ifdef ENABLE_DBENGINE
+ rrdeng_prepare_exit(&multidb_ctx);
+#endif
rrdhost_free_all();
+#ifdef ENABLE_DBENGINE
+ rrdeng_exit(&multidb_ctx);
+#endif
}
// unlink the pid
@@ -568,10 +574,10 @@ static void get_netdata_configured_variables() {
default_rrdeng_disk_quota_mb = RRDENG_MIN_DISK_SPACE_MB;
}
- default_multidb_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_GLOBAL, "multidb disk space", compute_multidb_diskspace());
+ default_multidb_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_GLOBAL, "dbengine multihost disk space", compute_multidb_diskspace());
if(default_multidb_disk_quota_mb < RRDENG_MIN_DISK_SPACE_MB) {
- error("Invalid multidb disk space %d given. Defaulting to %d.", default_multidb_disk_quota_mb, RRDENG_MIN_DISK_SPACE_MB);
- default_multidb_disk_quota_mb = RRDENG_MIN_DISK_SPACE_MB;
+ error("Invalid multidb disk space %d given. Defaulting to %d.", default_multidb_disk_quota_mb, default_rrdeng_disk_quota_mb);
+ default_multidb_disk_quota_mb = default_rrdeng_disk_quota_mb;
}
#endif
@@ -1456,7 +1462,8 @@ int main(int argc, char **argv) {
// Load host labels
reload_host_labels();
#ifdef ENABLE_DBENGINE
- metalog_commit_update_host(localhost);
+ if (localhost->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE)
+ metalog_commit_update_host(localhost);
#endif
// ------------------------------------------------------------------------