summaryrefslogtreecommitdiffstats
path: root/database/sqlite/sqlite_metadata.c
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2023-08-03 13:13:36 +0300
committerGitHub <noreply@github.com>2023-08-03 13:13:36 +0300
commit0e230a260ec7d8b4d6dc5c7165da6ab103d096b3 (patch)
treeb46528e5ace00358c342ea3d571d85bda5c546ed /database/sqlite/sqlite_metadata.c
parent72549b3a2247f763180925d7c84b0eee8086fa14 (diff)
Revert "Refactor RRD code. (#15423)" (#15723)
This reverts commit 440bd51e08fdfa2a4daa191fb68643456028a753. dbengine was still being used for non-zero tiers even on non-dbengine modes.
Diffstat (limited to 'database/sqlite/sqlite_metadata.c')
-rw-r--r--database/sqlite/sqlite_metadata.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/database/sqlite/sqlite_metadata.c b/database/sqlite/sqlite_metadata.c
index ffabedf60e..697772bf51 100644
--- a/database/sqlite/sqlite_metadata.c
+++ b/database/sqlite/sqlite_metadata.c
@@ -215,7 +215,7 @@ static int store_claim_id(uuid_t *host_id, uuid_t *claim_id)
int rc;
if (unlikely(!db_meta)) {
- if (default_storage_engine_id == STORAGE_ENGINE_DBENGINE)
+ if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE)
error_report("Database has not been initialized");
return 1;
}
@@ -287,7 +287,7 @@ static int store_host_metadata(RRDHOST *host)
int rc, param = 0;
if (unlikely(!db_meta)) {
- if (default_storage_engine_id != STORAGE_ENGINE_DBENGINE)
+ if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE)
return 0;
error_report("Database has not been initialized");
return 1;
@@ -313,7 +313,7 @@ static int store_host_metadata(RRDHOST *host)
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
- rc = sqlite3_bind_int(res, ++param, host->update_every);
+ rc = sqlite3_bind_int(res, ++param, host->rrd_update_every);
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
@@ -333,7 +333,7 @@ static int store_host_metadata(RRDHOST *host)
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
- rc = sqlite3_bind_int(res, ++param, host->storage_engine_id);
+ rc = sqlite3_bind_int(res, ++param, host->rrd_memory_mode);
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
@@ -384,7 +384,7 @@ static int add_host_sysinfo_key_value(const char *name, const char *value, uuid_
int rc, param = 0;
if (unlikely(!db_meta)) {
- if (default_storage_engine_id != STORAGE_ENGINE_DBENGINE)
+ if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE)
return 0;
error_report("Database has not been initialized");
return 0;
@@ -475,7 +475,7 @@ static int store_chart_metadata(RRDSET *st)
int rc, param = 0, store_rc = 0;
if (unlikely(!db_meta)) {
- if (default_storage_engine_id != STORAGE_ENGINE_DBENGINE)
+ if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE)
return 0;
error_report("Database has not been initialized");
return 1;
@@ -549,7 +549,7 @@ static int store_chart_metadata(RRDSET *st)
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
- rc = sqlite3_bind_int(res, ++param, st->storage_engine_id);
+ rc = sqlite3_bind_int(res, ++param, st->rrd_memory_mode);
if (unlikely(rc != SQLITE_OK))
goto bind_fail;
@@ -584,7 +584,7 @@ static int store_dimension_metadata(RRDDIM *rd)
int rc, param = 0;
if (unlikely(!db_meta)) {
- if (default_storage_engine_id != STORAGE_ENGINE_DBENGINE)
+ if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE)
return 0;
error_report("Database has not been initialized");
return 1;
@@ -653,13 +653,13 @@ bind_fail:
static bool dimension_can_be_deleted(uuid_t *dim_uuid __maybe_unused)
{
#ifdef ENABLE_DBENGINE
- if (rrdb.dbengine_enabled) {
+ if(dbengine_enabled) {
bool no_retention = true;
- for (size_t tier = 0; tier < rrdb.storage_tiers; tier++) {
- if (!rrdb.multidb_ctx[tier])
+ for (size_t tier = 0; tier < storage_tiers; tier++) {
+ if (!multidb_ctx[tier])
continue;
time_t first_time_t = 0, last_time_t = 0;
- if (rrdeng_metric_retention_by_uuid((void *) rrdb.multidb_ctx[tier], dim_uuid, &first_time_t, &last_time_t)) {
+ if (rrdeng_metric_retention_by_uuid((void *) multidb_ctx[tier], dim_uuid, &first_time_t, &last_time_t)) {
if (first_time_t > 0) {
no_retention = false;
break;
@@ -728,7 +728,7 @@ skip_run:
static void cleanup_health_log(void)
{
RRDHOST *host;
- dfe_start_reentrant(rrdb.rrdhost_root_index, host) {
+ dfe_start_reentrant(rrdhost_root_index, host) {
if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED))
continue;
sql_health_alarm_log_cleanup(host);
@@ -990,7 +990,7 @@ static void start_all_host_load_context(uv_work_t *req __maybe_unused)
struct host_context_load_thread *hclt = callocz(max_threads, sizeof(*hclt));
size_t thread_index;
- dfe_start_reentrant(rrdb.rrdhost_root_index, host) {
+ dfe_start_reentrant(rrdhost_root_index, host) {
if (rrdhost_flag_check(host, RRDHOST_FLAG_CONTEXT_LOAD_IN_PROGRESS) ||
!rrdhost_flag_check(host, RRDHOST_FLAG_PENDING_CONTEXT_LOAD))
continue;
@@ -1141,7 +1141,7 @@ static void start_metadata_hosts(uv_work_t *req __maybe_unused)
if (!data->max_count)
transaction_started = !db_execute(db_meta, "BEGIN TRANSACTION;");
- dfe_start_reentrant(rrdb.rrdhost_root_index, host) {
+ dfe_start_reentrant(rrdhost_root_index, host) {
if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED) || !rrdhost_flag_check(host, RRDHOST_FLAG_METADATA_UPDATE))
continue;
@@ -1335,7 +1335,7 @@ static void metadata_event_loop(void *arg)
if (unlikely(metadata_flag_check(wc, METADATA_FLAG_SCANNING_HOSTS)))
break;
- if (rrdb.unittest_running)
+ if (unittest_running)
break;
data = mallocz(sizeof(*data));
@@ -1363,7 +1363,7 @@ static void metadata_event_loop(void *arg)
}
break;
case METADATA_LOAD_HOST_CONTEXT:;
- if (rrdb.unittest_running)
+ if (unittest_running)
break;
data = callocz(1,sizeof(*data));