summaryrefslogtreecommitdiffstats
path: root/database/sqlite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:35:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:35:07 +0000
commita14f1d0e7c54950d80236aba6c0e26217952d77f (patch)
treec19c1562f9ca0578e314dd9a35c766bb4d5e7607 /database/sqlite
parentReleasing debian version 1.43.1-1. (diff)
downloadnetdata-a14f1d0e7c54950d80236aba6c0e26217952d77f.tar.xz
netdata-a14f1d0e7c54950d80236aba6c0e26217952d77f.zip
Merging upstream version 1.43.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/sqlite')
-rw-r--r--database/sqlite/sqlite_aclk_alert.c4
-rw-r--r--database/sqlite/sqlite_functions.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c
index e25b0f0ec..60bf5dbdc 100644
--- a/database/sqlite/sqlite_aclk_alert.c
+++ b/database/sqlite/sqlite_aclk_alert.c
@@ -71,9 +71,9 @@ fail:
//decide if some events should be sent or not
#define SQL_SELECT_ALERT_BY_ID \
"SELECT hld.new_status, hl.config_hash_id, hld.unique_id FROM health_log hl, aclk_alert_%s aa, health_log_detail hld " \
- "WHERE hl.host_id = @host_id AND hld.unique_id = aa.filtered_alert_unique_id " \
+ "WHERE hl.host_id = @host_id AND +hld.unique_id = aa.filtered_alert_unique_id " \
"AND hld.alarm_id = @alarm_id AND hl.health_log_id = hld.health_log_id " \
- "ORDER BY hld.alarm_event_id DESC LIMIT 1;"
+ "ORDER BY hld.rowid DESC LIMIT 1;"
static bool should_send_to_cloud(RRDHOST *host, ALARM_ENTRY *ae)
{
diff --git a/database/sqlite/sqlite_functions.c b/database/sqlite/sqlite_functions.c
index e081fe9ae..393d6a238 100644
--- a/database/sqlite/sqlite_functions.c
+++ b/database/sqlite/sqlite_functions.c
@@ -60,6 +60,8 @@ const char *database_config[] = {
"CREATE INDEX IF NOT EXISTS health_log_d_ind_3 ON health_log_detail (transition_id);",
"CREATE INDEX IF NOT EXISTS health_log_d_ind_5 ON health_log_detail (health_log_id, unique_id DESC);",
"CREATE INDEX IF NOT EXISTS health_log_d_ind_6 on health_log_detail (health_log_id, when_key)",
+ "CREATE INDEX IF NOT EXISTS health_log_d_ind_7 on health_log_detail (alarm_id);",
+ "CREATE INDEX IF NOT EXISTS health_log_d_ind_8 on health_log_detail (new_status, updated_by_id);",
NULL
};