summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2022-07-28 11:10:26 +0300
committerGitHub <noreply@github.com>2022-07-28 11:10:26 +0300
commitfcd57482933fb7508211362371eeb0f288218246 (patch)
tree83ab4078fefa9f21f6fbcd3d68d9b1d960435f5e /database
parent6b28177bdfcd5c17c87cdd09da9d2262843351ec (diff)
Delete aclk_alert table on start streaming from seq 1 batch 1 (#13438)
delete aclk_alert table on start streaming from seq 1 batch 1
Diffstat (limited to 'database')
-rw-r--r--database/sqlite/sqlite_aclk_alert.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c
index c5c06a4943..606bc6ff27 100644
--- a/database/sqlite/sqlite_aclk_alert.c
+++ b/database/sqlite/sqlite_aclk_alert.c
@@ -396,10 +396,11 @@ void sql_queue_existing_alerts_to_aclk(RRDHOST *host)
uuid_unparse_lower_fix(&host->host_uuid, uuid_str);
BUFFER *sql = buffer_create(1024);
- buffer_sprintf(sql,"insert into aclk_alert_%s (alert_unique_id, date_created) " \
+ buffer_sprintf(sql,"delete from aclk_alert_%s; " \
+ "insert into aclk_alert_%s (alert_unique_id, date_created) " \
"select unique_id alert_unique_id, unixepoch() from health_log_%s " \
"where new_status <> 0 and new_status <> -2 and config_hash_id is not null and updated_by_id = 0 " \
- "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str);
+ "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str, uuid_str);
db_execute(buffer_tostring(sql));