diff options
author | vkalintiris <vasilis@netdata.cloud> | 2024-01-11 19:38:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 19:38:01 +0200 |
commit | 2165279a87314fb74e8c4de735231a78de73aa54 (patch) | |
tree | f8f7c5b55179ca536f1a84a29da9a5cd0860a3a1 | |
parent | 9d0f8a9034ea26b1f6a83b5e3347964486ddb7f1 (diff) |
Delete memory mode "map" and "save". (#16604)
* Delete memory modes "map" and "save".
* Remove unmaintained exporting tests
* Remove references of map/save modes in docs.
* Remove more references to map/save from docs.
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.c | 2 | ||||
-rw-r--r-- | collectors/plugins.d/pluginsd_replication.c | 2 | ||||
-rw-r--r-- | daemon/buildinfo.c | 20 | ||||
-rw-r--r-- | daemon/commands.c | 16 | ||||
-rw-r--r-- | daemon/commands.h | 1 | ||||
-rw-r--r-- | daemon/config/README.md | 4 | ||||
-rw-r--r-- | daemon/main.c | 6 | ||||
-rw-r--r-- | daemon/service.c | 45 | ||||
-rw-r--r-- | daemon/signals.c | 9 | ||||
-rw-r--r-- | daemon/unit_test.c | 2 | ||||
-rw-r--r-- | database/README.md | 15 | ||||
-rw-r--r-- | database/rrd.c | 34 | ||||
-rw-r--r-- | database/rrd.h | 37 | ||||
-rw-r--r-- | database/rrddim.c | 193 | ||||
-rw-r--r-- | database/rrdhost.c | 123 | ||||
-rw-r--r-- | database/rrdset.c | 290 | ||||
-rw-r--r-- | database/storage_engine.c | 24 | ||||
-rw-r--r-- | exporting/tests/exporting_doubles.c | 405 | ||||
-rw-r--r-- | exporting/tests/exporting_fixtures.c | 184 | ||||
-rw-r--r-- | exporting/tests/netdata_doubles.c | 255 | ||||
-rw-r--r-- | exporting/tests/system_doubles.c | 61 | ||||
-rw-r--r-- | exporting/tests/test_exporting_engine.c | 2068 | ||||
-rw-r--r-- | exporting/tests/test_exporting_engine.h | 209 | ||||
-rw-r--r-- | libnetdata/libnetdata.c | 95 | ||||
-rw-r--r-- | libnetdata/libnetdata.h | 4 | ||||
-rw-r--r-- | streaming/README.md | 15 |
26 files changed, 27 insertions, 4092 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index 1ec173b1d4..c7ecd2b765 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -856,7 +856,7 @@ static inline PARSER_RC pluginsd_begin_v2(char **words, size_t num_words, PARSER st->counter++; st->counter_done++; - // these are only needed for db mode RAM, SAVE, MAP, ALLOC + // these are only needed for db mode RAM, ALLOC st->db.current_entry++; if(st->db.current_entry >= st->db.entries) st->db.current_entry -= st->db.entries; diff --git a/collectors/plugins.d/pluginsd_replication.c b/collectors/plugins.d/pluginsd_replication.c index 8b58a286d4..8d09752109 100644 --- a/collectors/plugins.d/pluginsd_replication.c +++ b/collectors/plugins.d/pluginsd_replication.c @@ -71,7 +71,7 @@ PARSER_RC pluginsd_replay_begin(char **words, size_t num_words, PARSER *parser) st->counter++; st->counter_done++; - // these are only needed for db mode RAM, SAVE, MAP, ALLOC + // these are only needed for db mode RAM, ALLOC st->db.current_entry++; if(st->db.current_entry >= st->db.entries) st->db.current_entry -= st->db.entries; diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index d7603393f4..a84620f53c 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -57,8 +57,6 @@ typedef enum __attribute__((packed)) { BIB_DB_DBENGINE, BIB_DB_ALLOC, BIB_DB_RAM, - BIB_DB_MAP, - BIB_DB_SAVE, BIB_DB_NONE, BIB_CONNECTIVITY_ACLK, BIB_CONNECTIVITY_HTTPD_STATIC, @@ -554,22 +552,6 @@ static struct { .json = "ram", .value = NULL, }, - [BIB_DB_MAP] = { - .category = BIC_DATABASE, - .type = BIT_BOOLEAN, - .analytics = NULL, - .print = "map", - .json = "map", - .value = NULL, - }, - [BIB_DB_SAVE] = { - .category = BIC_DATABASE, - .type = BIT_BOOLEAN, - .analytics = NULL, - .print = "save", - .json = "save", - .value = NULL, - }, [BIB_DB_NONE] = { .category = BIC_DATABASE, .type = BIT_BOOLEAN, @@ -1101,8 +1083,6 @@ __attribute__((constructor)) void initialize_build_info(void) { #endif build_info_set_status(BIB_DB_ALLOC, true); build_info_set_status(BIB_DB_RAM, true); - build_info_set_status(BIB_DB_MAP, true); - build_info_set_status(BIB_DB_SAVE, true); build_info_set_status(BIB_DB_NONE, true); build_info_set_status(BIB_CONNECTIVITY_HTTPD_STATIC, true); diff --git a/daemon/commands.c b/daemon/commands.c index 75cccf7c4f..9cfc581c60 100644 --- a/daemon/commands.c +++ b/daemon/commands.c @@ -36,7 +36,6 @@ struct command_context { /* Forward declarations */ static cmd_status_t cmd_help_execute(char *args, char **message); static cmd_status_t cmd_reload_health_execute(char *args, char **message); -static cmd_status_t cmd_save_database_execute(char *args, char **message); static cmd_status_t cmd_reopen_logs_execute(char *args, char **message); static cmd_status_t cmd_exit_execute(char *args, char **message); static cmd_status_t cmd_fatal_execute(char *args, char **message); @@ -52,7 +51,6 @@ static cmd_status_t cmd_dumpconfig(char *args, char **message); static command_info_t command_info_array[] = { {"help", cmd_help_execute, CMD_TYPE_HIGH_PRIORITY}, // show help menu {"reload-health", cmd_reload_health_execute, CMD_TYPE_ORTHOGONAL}, // reload health configuration - {"save-database", cmd_save_database_execute, CMD_TYPE_ORTHOGONAL}, // save database for memory mode save {"reopen-logs", cmd_reopen_logs_execute, CMD_TYPE_ORTHOGONAL}, // Close and reopen log files {"shutdown-agent", cmd_exit_execute, CMD_TYPE_EXCLUSIVE}, // exit cleanly {"fatal-agent", cmd_fatal_execute, CMD_TYPE_HIGH_PRIORITY}, // exit with fatal error @@ -150,20 +148,6 @@ static cmd_status_t cmd_reload_health_execute(char *args, char **message) return CMD_STATUS_SUCCESS; } -static cmd_status_t cmd_save_database_execute(char *args, char **message) -{ - (void)args; - (void)message; - - nd_log_limits_unlimited(); - netdata_log_info("COMMAND: Saving databases."); - rrdhost_save_all(); - netdata_log_info("COMMAND: Databases saved."); - nd_log_limits_reset(); - - return CMD_STATUS_SUCCESS; -} - static cmd_status_t cmd_reopen_logs_execute(char *args, char **message) { (void)args; diff --git a/daemon/commands.h b/daemon/commands.h index 368a70a0f4..45a76110ca 100644 --- a/daemon/commands.h +++ b/daemon/commands.h @@ -9,7 +9,6 @@ typedef enum cmd { CMD_HELP = 0, CMD_RELOAD_HEALTH, - CMD_SAVE_DATABASE, CMD_REOPEN_LOGS, CMD_EXIT, CMD_FATAL, diff --git a/daemon/config/README.md b/daemon/config/README.md index 11ba2a1bc7..0642330f47 100644 --- a/daemon/config/README.md +++ b/daemon/config/README.md @@ -88,8 +88,8 @@ Please note that your data history will be lost if you have modified `history` p | setting | default | info | |:---------------------------------------------:|:----------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| mode | `dbengine` | `dbengine`: The default for long-term metrics storage with efficient RAM and disk usage. Can be extended with `dbengine page cache size MB` and `dbengine disk space MB`. <br />`save`: Netdata will save its round robin database on exit and load it on startup. <br />`map`: Cache files will be updated in real-time. Not ideal for systems with high load or slow disks (check `man mmap`). <br />`ram`: The round-robin database will be temporary and it will be lost when Netdata exits. <br />`alloc`: Similar to `ram`, but can significantly reduce memory usage, when combined with a low retention and does not support KSM. <br />`none`: Disables the database at this host, and disables health monitoring entirely, as that requires a database of metrics. Not to be used together with streaming. | -| retention | `3600` | Used with `mode = save/map/ram/alloc`, not the default `mode = dbengine`. This number reflects the number of entries the `netdata` daemon will by default keep in memory for each chart dimension. Check [Memory Requirements](https://github.com/netdata/netdata/blob/master/database/README.md) for more information. | +| mode | `dbengine` | `dbengine`: The default for long-term metrics storage with efficient RAM and disk usage. Can be extended with `dbengine page cache size MB` and `dbengine disk space MB`. <br />`ram`: The round-robin database will be temporary and it will be lost when Netdata exits. <br />`alloc`: Similar to `ram`, but can significantly reduce memory usage, when combined with a low retention and does not support KSM. <br />`none`: Disables the database at this host, and disables health monitoring entirely, as that requires a database of metrics. Not to be used together with streaming. | +| retention | `3600` | Used with `mode = ram/alloc`, not the default `mode = dbengine`. This number reflects the number of entries the `netdata` daemon will by default keep in memory for each chart dimension. Check [Memory Requirements](https://github.com/netdata/netdata/blob/master/database/README.md) for more information. | | storage tiers | `1` | The number of storage tiers you want to have in your dbengine. Check the tiering mechanism in the [dbengine's reference](https://github.com/netdata/netdata/blob/master/database/engine/README.md#tiering). You can have up to 5 tiers of data (including the _Tier 0_). This number ranges between 1 and 5. | | dbengine page cache size MB | `32` | Determines the amount of RAM in MiB that is dedicated to caching for _Tier 0_ Netdata metric values. | | dbengine tier **`N`** page cache size MB | `32` | Determines the amount of RAM in MiB that is dedicated for caching Netdata metric values of the **`N`** tier. <br /> `N belongs to [1..4]` | diff --git a/daemon/main.c b/daemon/main.c index 3a9e009491..a88fef5e1f 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -404,10 +404,6 @@ void netdata_cleanup_and_exit(int ret, const char *action, const char *action_re web_client_cache_destroy(); - delta_shutdown_time("clean rrdhost database"); - - rrdhost_cleanup_all(); - delta_shutdown_time("stop aclk threads"); timeout = !service_wait_exit( @@ -1229,7 +1225,7 @@ static void get_netdata_configured_variables() { #else if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { error_report("RRD_MEMORY_MODE_DBENGINE is not supported in this platform. The agent will use db mode 'save' instead."); - default_rrd_memory_mode = RRD_MEMORY_MODE_SAVE; + default_rrd_memory_mode = RRD_MEMORY_MODE_RAM; } #endif diff --git a/daemon/service.c b/daemon/service.c index 3f47a8fa27..e87d8ed40b 100644 --- a/daemon/service.c +++ b/daemon/service.c @@ -16,11 +16,7 @@ #define WORKER_JOB_CLEANUP_ORPHAN_HOSTS 6 #define WORKER_JOB_CLEANUP_OBSOLETE_CHARTS_ON_HOSTS 7 #define WORKER_JOB_FREE_HOST 9 -#define WORKER_JOB_SAVE_HOST_CHARTS 10 -#define WORKER_JOB_DELETE_HOST_CHARTS 11 #define WORKER_JOB_FREE_CHART 12 -#define WORKER_JOB_SAVE_CHART 13 -#define WORKER_JOB_DELETE_CHART 14 #define WORKER_JOB_FREE_DIMENSION 15 #define WORKER_JOB_PGC_MAIN_EVICT 16 #define WORKER_JOB_PGC_MAIN_FLUSH 17 @@ -38,13 +34,6 @@ static void svc_rrddim_obsolete_to_archive(RRDDIM *rd) { rrddim_flag_set(rd, RRDDIM_FLAG_ARCHIVED); rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE); - const char *cache_filename = rrddim_cache_filename(rd); - if(cache_filename) { - netdata_log_info("Deleting dimension file '%s'.", cache_filename); - if (unlikely(unlink(cache_filename) == -1)) - netdata_log_error("Cannot delete dimension file '%s'", cache_filename); - } - if (rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { rrddimvar_delete_all(rd); @@ -133,17 +122,6 @@ static void svc_rrdset_obsolete_to_free(RRDSET *st) { // has to be run after all dimensions are archived - or use-after-free will occur rrdvar_delete_all(st->rrdvars); - if(st->rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) { - if(rrdhost_option_check(st->rrdhost, RRDHOST_OPTION_DELETE_OBSOLETE_CHARTS)) { - worker_is_busy(WORKER_JOB_DELETE_CHART); - rrdset_delete_files(st); - } - else { - worker_is_busy(WORKER_JOB_SAVE_CHART); - rrdset_save(st); - } - } - rrdset_free(st); } @@ -269,28 +247,11 @@ restart_after_removal: if(!rrdhost_should_be_removed(host, protected_host, now)) continue; - bool is_archived = rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED); - if (!is_archived) { - netdata_log_info("Host '%s' with machine guid '%s' is obsolete - cleaning up.", rrdhost_hostname(host), host->machine_guid); - - if (rrdhost_option_check(host, RRDHOST_OPTION_DELETE_ORPHAN_HOST) - /* don't delete multi-host DB host files */ - && !(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && is_storage_engine_shared(host->db[0].si)) - ) { - worker_is_busy(WORKER_JOB_DELETE_HOST_CHARTS); - rrdhost_delete_charts(host); - } - else { - worker_is_busy(WORKER_JOB_SAVE_HOST_CHARTS); - rrdhost_save_charts(host); - } - } - bool force = false; - if (rrdhost_option_check(host, RRDHOST_OPTION_EPHEMERAL_HOST) && now - host->last_connected > rrdhost_free_ephemeral_time_s) force = true; + bool is_archived = rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED); if (!force && is_archived) continue; @@ -339,11 +300,7 @@ void *service_main(void *ptr) worker_register_job_name(WORKER_JOB_CLEANUP_ORPHAN_HOSTS, "cleanup orphan hosts"); worker_register_job_name(WORKER_JOB_CLEANUP_OBSOLETE_CHARTS_ON_HOSTS, "cleanup obsolete charts on all hosts"); worker_register_job_name(WORKER_JOB_FREE_HOST, "free host"); - worker_register_job_name(WORKER_JOB_SAVE_HOST_CHARTS, "save host charts"); - worker_register_job_name(WORKER_JOB_DELETE_HOST_CHARTS, "delete host charts"); worker_register_job_name(WORKER_JOB_FREE_CHART, "free chart"); - worker_register_job_name(WORKER_JOB_SAVE_CHART, "save chart"); - worker_register_job_name(WORKER_JOB_DELETE_CHART, "delete chart"); worker_register_job_name(WORKER_JOB_FREE_DIMENSION, "free dimension"); worker_register_job_name(WORKER_JOB_PGC_MAIN_EVICT, "main cache evictions"); worker_register_job_name(WORKER_JOB_PGC_MAIN_FLUSH, "main cache flushes"); diff --git a/daemon/signals.c b/daemon/signals.c index dcc09b892a..c014452b7d 100644 --- a/daemon/signals.c +++ b/daemon/signals.c @@ -6,7 +6,6 @@ typedef enum signal_action { NETDATA_SIGNAL_END_OF_LIST, NETDATA_SIGNAL_IGNORE, NETDATA_SIGNAL_EXIT_CLEANLY, - NETDATA_SIGNAL_SAVE_DATABASE, NETDATA_SIGNAL_REOPEN_LOGS, NETDATA_SIGNAL_RELOAD_HEALTH, NETDATA_SIGNAL_FATAL, @@ -24,7 +23,6 @@ static struct { { SIGQUIT, "SIGQUIT", 0, NETDATA_SIGNAL_EXIT_CLEANLY }, { SIGTERM, "SIGTERM", 0, NETDATA_SIGNAL_EXIT_CLEANLY }, { SIGHUP, "SIGHUP", 0, NETDATA_SIGNAL_REOPEN_LOGS }, - { SIGUSR1, "SIGUSR1", 0, NETDATA_SIGNAL_SAVE_DATABASE }, { SIGUSR2, "SIGUSR2", 0, NETDATA_SIGNAL_RELOAD_HEALTH }, { SIGBUS, "SIGBUS", 0, NETDATA_SIGNAL_FATAL }, { SIGCHLD, "SIGCHLD", 0, NETDATA_SIGNAL_CHILD }, @@ -209,13 +207,6 @@ void signals_handle(void) { execute_command(CMD_RELOAD_HEALTH, NULL, NULL); break; - case NETDATA_SIGNAL_SAVE_DATABASE: - nd_log_limits_unlimited(); - netdata_log_info("SIGNAL: Received %s. Saving databases...", name); - nd_log_limits_reset(); - execute_command(CMD_SAVE_DATABASE, NULL, NULL); - break; - case NETDATA_SIGNAL_REOPEN_LOGS: nd_log_limits_unlimited(); netdata_log_info("SIGNAL: Received %s. Reopening all log files...", name); diff --git a/daemon/unit_test.c b/daemon/unit_test.c index 7407876723..4951d66c99 100644 --- a/daemon/unit_test.c +++ b/daemon/unit_test.c @@ -2238,7 +2238,6 @@ int test_dbengine(void) rrd_wrlock(); rrdeng_prepare_exit((struct rrdengine_instance *)host->db[0].si); - rrdhost_delete_charts(host); rrdeng_exit((struct rrdengine_instance *)host->db[0].si); rrdeng_enq_cmd(NULL, RRDENG_OPCODE_SHUTDOWN_EVLOOP, NULL, NULL, STORAGE_PRIORITY_BEST_EFFORT, NULL, NULL); rrd_unlock(); @@ -2648,7 +2647,6 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi freez(query_threads); rrd_wrlock(); rrdeng_prepare_exit((struct rrdengine_instance *)host->db[0].si); - rrdhost_delete_charts(host); rrdeng_exit((struct rrdengine_instance *)host->db[0].si); rrdeng_enq_cmd(NULL, RRDENG_OPCODE_SHUTDOWN_EVLOOP, NULL, NULL, STORAGE_PRIORITY_BEST_EFFORT, NULL, NULL); rrd_unlock(); diff --git a/database/README.md b/database/README.md index c5750e1147..b0a8e176ce 100644 --- a/database/README.md +++ b/database/README.md @@ -12,19 +12,10 @@ Netdata is fully capable of long-term metrics storage, at per-second granularity 2. `ram`, data are purely in memory. Data are never saved on disk. This mode uses `mmap()` and supports [KSM](#ksm). -3. `save`, data are only in RAM while Netdata runs and are saved to / loaded from disk on Netdata restart. It also - uses `mmap()` and supports [KSM](#ksm). - -4. `map`, data are in memory mapped files. This works like the swap. When Netdata writes data on its memory, the Linux - kernel marks the related memory pages as dirty and automatically starts updating them on disk. Unfortunately we - cannot control how frequently this works. The Linux kernel uses exactly the same algorithm it uses for its swap - memory. This mode uses `mmap()` but does not support [KSM](#ksm). _Keep in mind though, this option will have a - constant write on your disk._ - -5. `alloc`, like `ram` but it uses `calloc()` and does not support [KSM](#ksm). This mode is the fallback for all others +3. `alloc`, like `ram` but it uses `calloc()` and does not support [KSM](#ksm). This mode is the fallback for all others except `none`. -6. `none`, without a database (collected metrics can only be streamed to another Netdata). +4. `none`, without a database (collected metrics can only be streamed to another Netdata). ## Which database mode to use @@ -47,7 +38,7 @@ You can select the database mode by editing `netdata.conf` and setting: ```conf [db] - # dbengine (default), ram, save (the default if dbengine not available), map (swap like), none, alloc + # dbengine (default), ram (the default if dbengine not available), alloc, none mode = dbengine ``` diff --git a/database/rrd.c b/database/rrd.c index 5b7752a5ea..b664ad3ae8 100644 --- a/database/rrd.c +++ b/database/rrd.c @@ -19,7 +19,7 @@ int default_rrd_history_entries = RRD_DEFAULT_HISTORY_ENTRIES; #ifdef ENABLE_DBENGINE RRD_MEMORY_MODE default_rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; #else -RRD_MEMORY_MODE default_rrd_memory_mode = RRD_MEMORY_MODE_SAVE; +RRD_MEMORY_MODE default_rrd_memory_mode = RRD_MEMORY_MODE_RAM; #endif int gap_when_lost_iterations_above = 1; @@ -32,15 +32,9 @@ inline const char *rrd_memory_mode_name(RRD_MEMORY_MODE id) { case RRD_MEMORY_MODE_RAM: return RRD_MEMORY_MODE_RAM_NAME; - case RRD_MEMORY_MODE_MAP: - return RRD_MEMORY_MODE_MAP_NAME; - case RRD_MEMORY_MODE_NONE: return RRD_MEMORY_MODE_NONE_NAME; - case RRD_MEMORY_MODE_SAVE: - return RRD_MEMORY_MODE_SAVE_NAME; - case RRD_MEMORY_MODE_ALLOC: return RRD_MEMORY_MODE_ALLOC_NAME; @@ -53,7 +47,7 @@ inline const char *rrd_memory_mode_name(RRD_MEMORY_MODE id) { return eng->name; } - return RRD_MEMORY_MODE_SAVE_NAME; + return RRD_MEMORY_MODE_RAM_NAME; } RRD_MEMORY_MODE rrd_memory_mode_id(const char *name) { @@ -62,7 +56,7 @@ RRD_MEMORY_MODE rrd_memory_mode_id(const char *name) { return eng->id; } - return RRD_MEMORY_MODE_SAVE; + return RRD_MEMORY_MODE_RAM; } @@ -133,28 +127,6 @@ const char *rrdset_type_name(RRDSET_TYPE chart_type) { } // ---------------------------------------------------------------------------- -// RRD - cache directory - -char *rrdhost_cache_dir_for_rrdset_alloc(RRDHOST *host, const char *id) { - char *ret = NULL; - - char b[FILENAME_MAX + 1]; - char n[FILENAME_MAX + 1]; - rrdset_strncpyz_name(b, id, FILENAME_MAX); - - snprintfz(n, FILENAME_MAX, "%s/%s", host->cache_dir, b); - ret = strdupz(n); - - if(host->rrd_memory_mode == RRD_MEMORY_MODE_MAP || host->rrd_memory_mode == RRD_MEMORY_MODE_SAVE) { - int r = mkdir(ret, 0775); - if(r != 0 && errno != EEXIST) - netdata_log_error("Cannot create directory '%s'", ret); - } - - return ret; -} - -// ---------------------------------------------------------------------------- // RRD - string management STRING *rrd_string_strdupz(const char *s) { diff --git a/database/rrd.h b/database/rrd.h index b63a7e8340..1a98e5eef2 100644 --- a/database/rrd.h +++ b/database/rrd.h @@ -79,8 +79,6 @@ struct pg_cache_page_index; typedef enum __attribute__ ((__packed__)) rrd_memory_mode { RRD_MEMORY_MODE_NONE = 0, RRD_MEMORY_MODE_RAM = 1, - RRD_MEMORY_MODE_MAP = 2, - RRD_MEMORY_MODE_SAVE = 3, RRD_MEMORY_MODE_ALLOC = 4, RRD_MEMORY_MODE_DBENGINE = 5, @@ -89,8 +87,6 @@ typedef enum __attribute__ ((__packed__)) rrd_memory_mode { #define RRD_MEMORY_MODE_NONE_NAME "none" #define RRD_MEMORY_MODE_RAM_NAME "ram" -#define RRD_MEMORY_MODE_MAP_NAME "map" -#define RRD_MEMORY_MODE_SAVE_NAME "save" #define RRD_MEMORY_MODE_ALLOC_NAME "alloc" #define RRD_MEMORY_MODE_DBENGINE_NAME "dbengine" @@ -325,13 +321,12 @@ struct rrddim { #endif // ------------------------------------------------------------------------ - // db mode RAM, SAVE, MAP, ALLOC, NONE specifics + // db mode RAM, ALLOC, NONE specifics // TODO - they should be managed by storage engine // (RRDDIM_DB_STATE ptr to an undefined structure, and a call to clean this up during destruction) struct { size_t memsize; // the memory allocated for this dimension (without RRDDIM) - void *rd_on_file; // pointer to the header written on disk storage_number *data; // the array of values } db; @@ -381,22 +376,6 @@ size_t rrddim_size(void); #define rrddim_set_updated(rd) (rd)->collector.options |= RRDDIM_OPTION_UPDATED #define rrddim_clear_updated(rd) (rd)->collector.options &= ~RRDDIM_OPTION_UPDATED -// returns the RRDDIM cache filename, or NULL if it does not exist -const char *rrddim_cache_filename(RRDDIM *rd); - -// updated the header with the latest RRDDIM value, for memory mode MAP and SAVE -void rrddim_memory_file_update(RRDDIM *rd); - -// free the memory file structures for memory mode MAP and SAVE -void rrddim_memory_file_free(RRDDIM *rd); - -bool rrddim_memory_load_or_create_map_save(RRDSET *st, RRDDIM *rd, RRD_MEMORY_MODE memory_mode); - -// return the v019 header size of RRDDIM files -size_t rrddim_memory_file_header_size(void); - -void rrddim_memory_file_save(RRDDIM *rd); - // ------------------------------------------------------------------------ // DATA COLLECTION STORAGE OPS @@ -960,12 +939,6 @@ STRING *rrd_string_strdupz(const char *s); #define rrdset_number_of_dimensions(st) \ dictionary_entries((st)->rrddim_root_index) -void rrdset_memory_file_save(RRDSET *st); -void rrdset_memory_file_free(RRDSET *st); -void rrdset_memory_file_update(RRDSET *st); -const char *rrdset_cache_filename(RRDSET *st); -bool rrdset_memory_load_or_create_map_save(RRDSET *st_on_file, RRD_MEMORY_MODE memory_mode); - #include "rrdcollector.h" #include "rrdfunctions.h" @@ -1488,13 +1461,9 @@ RRDSET *rrdset_create_custom(RRDHOST *host rrdset_create(localhost, type, id, name, family, context, title, units, plugin, module, priority, update_every, chart_type) void rrdhost_free_all(void); -void rrdhost_save_all(void); -void rrdhost_cleanup_all(void); void rrdhost_system_info_free(struct rrdhost_system_info *system_info); void rrdhost_free___while_having_rrd_wrlock(RRDHOST *host, bool force); -void rrdhost_save_charts(RRDHOST *host); -void rrdhost_delete_charts(RRDHOST *host); int rrdhost_should_be_removed(RRDHOST *host, RRDHOST *protected_host, time_t now_s); @@ -1623,8 +1592,6 @@ void rrdhost_set_is_parent_label(void); // ---------------------------------------------------------------------------- // RRD internal functions -void rrdset_delete_files(RRDSET *st); -void rrdset_save(RRDSET *st); void rrdset_free(RRDSET *st); void rrddim_free(RRDSET *st, RRDDIM *rd); @@ -1632,10 +1599,8 @@ void rrddim_free(RRDSET *st, RRDDIM *rd); #ifdef NETDATA_RRD_INTERNALS char *rrdhost_cache_dir_for_rrdset_alloc(RRDHOST *host, const char *id); -const char *rrdset_cache_dir(RRDSET *st); void rrdset_reset(RRDSET *st); -void rrdset_delete_obsolete_dimensions(RRDSET *st); #endif /* NETDATA_RRD_INTERNALS */ diff --git a/database/rrddim.c b/database/rrddim.c index fe1bbc8546..2f56815a94 100644 --- a/database/rrddim.c +++ b/database/rrddim.c @@ -58,13 +58,6 @@ static void rrddim_insert_callback(const DICTIONARY_ITEM *item __maybe_unused, v if(rrdset_flag_check(st, RRDSET_FLAG_STORE_FIRST)) rd->collector.counter = 1; - if(ctr->memory_mode == RRD_MEMORY_MODE_MAP || ctr->memory_mode == RRD_MEMORY_MODE_SAVE) { - if(!rrddim_memory_load_or_create_map_save(st, rd, ctr->memory_mode)) { - netdata_log_info("Failed to use memory mode %s for chart '%s', dimension '%s', falling back to ram", (ctr->memory_mode == RRD_MEMORY_MODE_MAP)?"map":"save", rrdset_name(st), rrddim_name(rd)); - ctr->memory_mode = RRD_MEMORY_MODE_RAM; - } - } - if(ctr->memory_mode == RRD_MEMORY_MODE_RAM) { size_t entries = st->db.entries; if(!entries) entries = 5; @@ -212,15 +205,6 @@ static void rrddim_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v rrddimvar_delete_all(rd); - // free(rd->annotations); - //#ifdef ENABLE_ACLK - // if (!netdata_exit) - // aclk_send_dimension_update(rd); - //#endif - - // this will free MEMORY_MODE_SAVE and MEMORY_MODE_MAP structures - rrddim_memory_file_free(rd); - for(size_t tier = 0; tier < storage_tiers ;tier++) { if(!rd->tiers[tier].smh) continue; @@ -589,180 +573,3 @@ collected_number rrddim_set(RRDSET *st, const char *id, collected_number value) return rrddim_set_by_pointer(st, rd, value); } - - -// ---------------------------------------------------------------------------- -// compatibility layer for RRDDIM files v019 - -#define RRDDIMENSION_MAGIC_V019 "NETDATA RRD DIMENSION FILE V019" - -struct avl_element_v019 { - void *avl_link[2]; - signed char avl_balance; -}; - -struct rrddim_map_save_v019 { - struct avl_element_v019 avl; // ignored - void *id; // ignored - void *name; // ignored - uint32_t algorithm; // print warning on mismatch - update on load - uint32_t rrd_memory_mode; // ignored - long long multiplier; // print warning on mismatch - update on load - long long divisor; |