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
Emmanuel Vasilakis committed
Jul 28, 2022 at 11:10 UTC
fcd57482933fb7508211362371eeb0f288218246
1 file changed
+3
-2
database/sqlite/sqlite_aclk_alert.c
+3
-2
@@ -396,10 +396,11 @@ void sql_queue_existing_alerts_to_aclk(RRDHOST *host)
396
uuid_unparse_lower_fix(&host->host_uuid, uuid_str);
397
BUFFER *sql = buffer_create(1024);
398
399
- buffer_sprintf(sql,"insert into aclk_alert_%s (alert_unique_id, date_created) " \
399
+ buffer_sprintf(sql,"delete from aclk_alert_%s; " \
400
+ "insert into aclk_alert_%s (alert_unique_id, date_created) " \
401
"select unique_id alert_unique_id, unixepoch() from health_log_%s " \
402
"where new_status <> 0 and new_status <> -2 and config_hash_id is not null and updated_by_id = 0 " \
402
- "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str);
403
+ "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str, uuid_str);
404
405
db_execute(buffer_tostring(sql));
406