From fcd57482933fb7508211362371eeb0f288218246 Mon Sep 17 00:00:00 2001 From: Emmanuel Vasilakis Date: Thu, 28 Jul 2022 11:10:26 +0300 Subject: 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 --- database/sqlite/sqlite_aclk_alert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'database') 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)); -- cgit v1.2.3