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 /database/sqlite/sqlite_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 'database/sqlite/sqlite_aclk.c')
-rw-r--r-- | database/sqlite/sqlite_aclk.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index fedce50eba..d35e0453dc 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -104,7 +104,7 @@ static int create_host_callback(void *data, int argc, char **argv, char **column sql_build_host_system_info((uuid_t *)argv[IDX_HOST_ID], system_info); - RRDHOST *host = rrdhost_find_or_create( + RRDHOST *host = rrdhost_get_or_create( (const char *) argv[IDX_HOSTNAME] , (const char *) argv[IDX_REGISTRY] , guid @@ -117,7 +117,7 @@ static int create_host_callback(void *data, int argc, char **argv, char **column , (const char *) (argv[IDX_PROGRAM_VERSION] ? argv[IDX_PROGRAM_VERSION] : "unknown") , argv[IDX_UPDATE_EVERY] ? str2i(argv[IDX_UPDATE_EVERY]) : 1 , argv[IDX_ENTRIES] ? str2i(argv[IDX_ENTRIES]) : 0 - , default_rrd_memory_mode + , default_storage_engine_id , 0 // health , 0 // rrdpush enabled , NULL //destination @@ -181,7 +181,7 @@ static int is_host_available(uuid_t *host_id) int rc; if (unlikely(!db_meta)) { - if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) + if (default_storage_engine_id == STORAGE_ENGINE_DBENGINE) error_report("Database has not been initialized"); return 1; } @@ -319,7 +319,7 @@ static int aclk_config_parameters(void *data __maybe_unused, int argc __maybe_un uuid_unparse_lower(*((uuid_t *) argv[0]), uuid_str); RRDHOST *host = rrdhost_find_by_guid(uuid_str); - if (host == localhost) + if (host == rrdb.localhost) return 0; sql_create_aclk_table(host, (uuid_t *) argv[0], (uuid_t *) argv[1]); @@ -424,7 +424,7 @@ static void aclk_synchronization(void *arg __maybe_unused) // NODE STATE case ACLK_DATABASE_NODE_STATE:; RRDHOST *host = cmd.param[0]; - int live = (host == localhost || host->receiver || !(rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN))) ? 1 : 0; + int live = (host == rrdb.localhost || host->receiver || !(rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN))) ? 1 : 0; struct aclk_sync_host_config *ahc = host->aclk_sync_host_config; if (unlikely(!ahc)) sql_create_aclk_table(host, &host->host_uuid, host->node_id); @@ -520,7 +520,7 @@ void sql_create_aclk_table(RRDHOST *host __maybe_unused, uuid_t *host_uuid __may strcpy(wc->uuid_str, uuid_str); wc->alert_updates = 0; time_t now = now_realtime_sec(); - wc->node_info_send_time = (host == localhost || NULL == localhost) ? now - 25 : now; + wc->node_info_send_time = (host == rrdb.localhost || NULL == rrdb.localhost) ? now - 25 : now; #endif } @@ -536,7 +536,7 @@ void sql_aclk_sync_init(void) int rc; if (unlikely(!db_meta)) { - if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) { + if (default_storage_engine_id != STORAGE_ENGINE_DBENGINE) { return; } error_report("Database has not been initialized"); @@ -558,7 +558,7 @@ void sql_aclk_sync_init(void) #ifdef ENABLE_ACLK if (!number_of_children) - aclk_queue_node_info(localhost, true); + aclk_queue_node_info(rrdb.localhost, true); rc = sqlite3_exec_monitored(db_meta, SQL_FETCH_ALL_INSTANCES,aclk_config_parameters, NULL,&err_msg); |