diff options
author | vkalintiris <vasilis@netdata.cloud> | 2023-07-26 15:30:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 15:30:49 +0300 |
commit | 440bd51e08fdfa2a4daa191fb68643456028a753 (patch) | |
tree | 1d2cc2b0afc24b6b77f95f2cf3a1bdbaa544e278 /aclk/aclk.c | |
parent | 3829b4c48ade535aa2d0a1153d45b49184b27a4b (diff) |
Refactor RRD code. (#15423)
* Storage engine.
* Host indexes to rrdb
* Move globals to rrdb
* Move storage_tiers_backfill to rrdb
* default_rrd_update_every to rrdb
* default_rrd_history_entries to rrdb
* gap_when_lost_iterations_above to rrdb
* rrdset_free_obsolete_time_s to rrdb
* libuv_worker_threads to rrdb
* ieee754_doubles to rrdb
* rrdhost_free_orphan_time_s to rrdb
* rrd_rwlock to rrdb
* localhost to rrdb
* rm extern from func decls
* mv rrd macro under rrd.h
* default_rrdeng_page_cache_mb to rrdb
* default_rrdeng_extent_cache_mb to rrdb
* db_engine_journal_check to rrdb
* default_rrdeng_disk_quota_mb to rrdb
* default_multidb_disk_quota_mb to rrdb
* multidb_ctx to rrdb
* page_type_size to rrdb
* tier_page_size to rrdb
* No storage_engine_id in rrdim functions
* storage_engine_id is provided by st
* Update to fix merge conflict.
* Update field name
* Remove unnecessary macros from rrd.h
* Rm unused type decls
* Rm duplicate func decls
* make internal function static
* Make the rest of public dbengine funcs accept a storage_instance.
* No more rrdengine_instance :)
* rm rrdset_debug from rrd.h
* Use rrdb to access globals in ML and ACLK
Missed due to not having the submodules in the
worktree.
* rm total_number
* rm RRDVAR_TYPE_TOTAL
* rm unused inline
* Rm names from typedef'd enums
* rm unused header include
* Move include
* Rm unused header include
* s/rrdhost_find_or_create/rrdhost_get_or_create/g
* s/find_host_by_node_id/rrdhost_find_by_node_id/
Also, remove duplicate definition in rrdcontext.c
* rm macro used only once
* rm macro used only once
* Reduce rrd.h api by moving funcs into a collector specific utils header
* Remove unused func
* Move parser specific function out of rrd.h
* return storage_number instead of void pointer
* move code related to rrd initialization out of rrdhost.c
* Remove tier_grouping from rrdim_tier
Saves 8 * storage_tiers bytes per dimension.
* Fix rebase
* s/rrd_update_every/update_every/
* Mark functions as static and constify args
* Add license notes and file to build systems.
* Remove remaining non-log/config mentions of memory mode
* Move rrdlabels api to separate file.
Also, move localhost functions that loads
labels outside of database/ and into daemon/
* Remove function decl in rrd.h
* merge rrdhost_cache_dir_for_rrdset_alloc into rrdset_cache_dir
* Do not expose internal function from rrd.h
* Rm NETDATA_RRD_INTERNALS
Only one function decl is covered. We have more
database internal functions that we currently
expose for no good reason. These will be placed
in a separate internal header in follow up PRs.
* Add license note
* Include libnetdata.h instead of aral.h
* Use rrdb to access localhost
* Fix builds without dbengine
* Add header to build system files
* Add rrdlabels.h to build systems
* Move func def from rrd.h to rrdhost.c
* Fix macos build
* Rm non-existing function
* Rebase master
* Define buffer length macro in ad_charts.
* Fix FreeBSD builds.
* Mark functions static
* Rm func decls without definitions
* Rebase master
* Rebase master
* Properly initialize value of storage tiers.
* Fix build after rebase.
Diffstat (limited to 'aclk/aclk.c')
-rw-r--r-- | aclk/aclk.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/aclk/aclk.c b/aclk/aclk.c index 312db076ff..59c3106dfa 100644 --- a/aclk/aclk.c +++ b/aclk/aclk.c @@ -913,15 +913,15 @@ void aclk_host_state_update(RRDHOST *host, int cmd) // node_id not found aclk_query_t create_query; create_query = aclk_query_new(REGISTER_NODE); - rrdhost_aclk_state_lock(localhost); + rrdhost_aclk_state_lock(rrdb.localhost); node_instance_creation_t node_instance_creation = { - .claim_id = localhost->aclk_state.claimed_id, + .claim_id = rrdb.localhost->aclk_state.claimed_id, .hops = host->system_info->hops, .hostname = rrdhost_hostname(host), .machine_guid = host->machine_guid}; create_query->data.bin_payload.payload = generate_node_instance_creation(&create_query->data.bin_payload.size, &node_instance_creation); - rrdhost_aclk_state_unlock(localhost); + rrdhost_aclk_state_unlock(rrdb.localhost); create_query->data.bin_payload.topic = ACLK_TOPICID_CREATE_NODE; create_query->data.bin_payload.msg_name = "CreateNodeInstance"; netdata_log_info("Registering host=%s, hops=%u", host->machine_guid, host->system_info->hops); @@ -942,10 +942,10 @@ void aclk_host_state_update(RRDHOST *host, int cmd) node_state_update.capabilities = aclk_get_agent_capas(); - rrdhost_aclk_state_lock(localhost); - node_state_update.claim_id = localhost->aclk_state.claimed_id; + rrdhost_aclk_state_lock(rrdb.localhost); + node_state_update.claim_id = rrdb.localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); - rrdhost_aclk_state_unlock(localhost); + rrdhost_aclk_state_unlock(rrdb.localhost); netdata_log_info("Queuing status update for node=%s, live=%d, hops=%u",(char*)node_state_update.node_id, cmd, host->system_info->hops); @@ -986,10 +986,10 @@ void aclk_send_node_instances() } node_state_update.capabilities = aclk_get_node_instance_capas(host); - rrdhost_aclk_state_lock(localhost); - node_state_update.claim_id = localhost->aclk_state.claimed_id; + rrdhost_aclk_state_lock(rrdb.localhost); + node_state_update.claim_id = rrdb.localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); - rrdhost_aclk_state_unlock(localhost); + rrdhost_aclk_state_unlock(rrdb.localhost); netdata_log_info("Queuing status update for node=%s, live=%d, hops=%d",(char*)node_state_update.node_id, list->live, list->hops); @@ -1010,10 +1010,10 @@ void aclk_send_node_instances() uuid_unparse_lower(list->host_id, (char*)node_instance_creation.machine_guid); create_query->data.bin_payload.topic = ACLK_TOPICID_CREATE_NODE; create_query->data.bin_payload.msg_name = "CreateNodeInstance"; - rrdhost_aclk_state_lock(localhost); - node_instance_creation.claim_id = localhost->aclk_state.claimed_id, + rrdhost_aclk_state_lock(rrdb.localhost); + node_instance_creation.claim_id = rrdb.localhost->aclk_state.claimed_id, create_query->data.bin_payload.payload = generate_node_instance_creation(&create_query->data.bin_payload.size, &node_instance_creation); - rrdhost_aclk_state_unlock(localhost); + rrdhost_aclk_state_unlock(rrdb.localhost); netdata_log_info("Queuing registration for host=%s, hops=%d",(char*)node_instance_creation.machine_guid, list->hops); freez((void *)node_instance_creation.machine_guid); @@ -1124,9 +1124,9 @@ char *aclk_state(void) buffer_sprintf(wb, "\n\tNode ID: %s\n", node_id); } - buffer_sprintf(wb, "\tStreaming Hops: %d\n\tRelationship: %s", host->system_info->hops, host == localhost ? "self" : "child"); + buffer_sprintf(wb, "\tStreaming Hops: %d\n\tRelationship: %s", host->system_info->hops, host == rrdb.localhost ? "self" : "child"); - if (host != localhost) + if (host != rrdb.localhost) buffer_sprintf(wb, "\n\tStreaming Connection Live: %s", host->receiver ? "true" : "false"); buffer_strcat(wb, "\n\tAlert Streaming Status:"); @@ -1270,10 +1270,10 @@ char *aclk_state_json(void) tmp = json_object_new_int(host->system_info->hops); json_object_object_add(nodeinstance, "streaming-hops", tmp); - tmp = json_object_new_string(host == localhost ? "self" : "child"); + tmp = json_object_new_string(host == rrdb.localhost ? "self" : "child"); json_object_object_add(nodeinstance, "relationship", tmp); - tmp = json_object_new_boolean((host->receiver || host == localhost)); + tmp = json_object_new_boolean((host->receiver || host == rrdb.localhost)); json_object_object_add(nodeinstance, "streaming-online", tmp); tmp = json_object_new_object(); @@ -1292,7 +1292,7 @@ char *aclk_state_json(void) } void add_aclk_host_labels(void) { - DICTIONARY *labels = localhost->rrdlabels; + DICTIONARY *labels = rrdb.localhost->rrdlabels; #ifdef ENABLE_ACLK rrdlabels_add(labels, "_aclk_available", "true", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); @@ -1324,5 +1324,5 @@ void aclk_queue_node_info(RRDHOST *host, bool immediate) { struct aclk_sync_host_config *wc = (struct aclk_sync_host_config *) host->aclk_sync_host_config; if (likely(wc)) - wc->node_info_send_time = (host == localhost || immediate) ? 1 : now_realtime_sec(); + wc->node_info_send_time = (host == rrdb.localhost || immediate) ? 1 : now_realtime_sec(); } |