summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2023-06-21 15:39:43 +0300
committerGitHub <noreply@github.com>2023-06-21 15:39:43 +0300
commit6e1e97c5e8d136162368e16d27d7aa09b047f8c6 (patch)
tree4d20904c201c87d8a1670a83018aabaf0d4f3398 /daemon
parentd8661b8e0ce7648037bfa5dc7f535261d98ac7c9 (diff)
Use a single health log table (#15157)
* move old health log tables to one * change table in sqlite_health * remove check for off period of agent * changes in aclk_alert * fixes * add new field insert_mark_timestamp * cleanup * remove hostname, create the health log table during sqlite init * create the health_log during migration * move source from health_log to alert_hash. Remove class, component and type field from health_log * Register now_usec sqlite function * use global_id instead of insert_mark_timestamp. Use function now_usec to populate it * create functions earlier to have them during migration * small unit test fix * create additional health_log_detail table. Do the insert of an alert event on both * do the update on health_log_detail * change more queries * more indexes, fix inject removed * change last executed and select health log queries * random uuid for sqlite * do migration from old tables * queries to send alerts to cloud * cleanup queries * get an alarm id from db if not found in memory * small fix on query * add info when migration completes * dont pick health_log_detail during migration * check proper old health_log table * safer migration * proper log sent alerts. small fix in claimed cleanup * cleanups * extra check for cleanup * also get an alarm_event_id from sql * check for empty source * remove cleanup of main health log table --------- Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/unit_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/daemon/unit_test.c b/daemon/unit_test.c
index f22d94b9b5..e0be3f2768 100644
--- a/daemon/unit_test.c
+++ b/daemon/unit_test.c
@@ -1662,6 +1662,18 @@ int test_sqlite(void) {
return 1;
}
+ rc = sqlite3_create_function(db_meta, "now_usec", 1, SQLITE_ANY, 0, sqlite_now_usec, 0, 0);
+ if (unlikely(rc != SQLITE_OK)) {
+ fprintf(stderr, "Failed to register internal now_usec function");
+ return 1;
+ }
+
+ rc = sqlite3_exec_monitored(db_meta, "UPDATE MINE SET id1=now_usec(0);", 0, 0, NULL);
+ if (rc != SQLITE_OK) {
+ fprintf(stderr,"Failed to test SQLite: Update with now_usec() failed\n");
+ return 1;
+ }
+
BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE, NULL);
char *uuid_str = "0000_000";