diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-08-22 20:00:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 20:00:44 +0300 |
commit | 35ae7175420304a6ef151bca223f74ee234868b2 (patch) | |
tree | 8c216c739c6f05587578f9b8e5a5b9ad14fe5bdb /database/sqlite/sqlite_metadata.c | |
parent | ebf521102476e4f9efbd017596ff70f48364b12e (diff) |
Misc code cleanup (#15665)
* Cleanup code
* Add SQLITE3_COLUMN_STRDUPZ_OR_NULL for readability
* Bind unique id properly
* Cleanup with is_claimed parameter to decide which cleanup to use
Unify cleanup function sql_health_alarm_log_cleanup
Add SQLITE3_BIND_STRING_OR_NULL and SQLITE3_COLUMN_STRINGDUP_OR_NULL
sql_health_alarm_log_count returns number of rows instead of updating host->health.health_log_entries_written
Reformat queries for clarity
* Try to fix codacy issue
* Try to fix codacy issue -- issue small warning
* Change label from fail to done
* Drop index on unique_id and health_log_id and create one on both
* Update database/sqlite/sqlite_aclk_alert.c
Co-authored-by: Emmanuel Vasilakis <mrzammler@gmail.com>
* Fix double bind
---------
Co-authored-by: Emmanuel Vasilakis <mrzammler@gmail.com>
Diffstat (limited to 'database/sqlite/sqlite_metadata.c')
-rw-r--r-- | database/sqlite/sqlite_metadata.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/database/sqlite/sqlite_metadata.c b/database/sqlite/sqlite_metadata.c index 697772bf51..d96eddb840 100644 --- a/database/sqlite/sqlite_metadata.c +++ b/database/sqlite/sqlite_metadata.c @@ -728,10 +728,12 @@ skip_run: static void cleanup_health_log(void) { RRDHOST *host; - dfe_start_reentrant(rrdhost_root_index, host) { + + bool is_claimed = claimed(); + dfe_start_reentrant(rrdhost_root_index, host){ if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) continue; - sql_health_alarm_log_cleanup(host); + sql_health_alarm_log_cleanup(host, is_claimed); } dfe_done(host); } |