@cryptotaxi247 / netdata-1 / commits / d9e8b31ac

Fix meta unittest (#16221)

Fix log message (queue has no limit now) Fix unittest

Stelios Fragkakis committed Oct 17, 2023 at 16:55 UTC d9e8b31ac6634b33560e26334a6e0b83c8ee26c7
1 file changed +5 -4
database/sqlite/sqlite_metadata.c
+5 -4
@@ -55,7 +55,6 @@
55 #define DELETE_NON_EXISTING_LOCALHOST "DELETE FROM host WHERE hops = 0 AND host_id <> @host_id;"
56 #define DELETE_MISSING_NODE_INSTANCES "DELETE FROM node_instance WHERE host_id NOT IN (SELECT host_id FROM host);"
57
58 -#define METADATA_CMD_Q_MAX_SIZE (2048) // Max queue size; callers will block until there is room
58 #define METADATA_MAINTENANCE_FIRST_CHECK (1800) // Maintenance first run after agent startup in seconds
59 #define METADATA_MAINTENANCE_REPEAT (60) // Repeat if last run for dimensions, charts, labels needs more work
60 #define METADATA_HEALTH_LOG_INTERVAL (3600) // Repeat maintenance for health
@@ -1593,7 +1592,7 @@ static void metadata_event_loop(void *arg)
1592 wc->timer_req.data = wc;
1593 fatal_assert(0 == uv_timer_start(&wc->timer_req, timer_cb, TIMER_INITIAL_PERIOD_MS, TIMER_REPEAT_PERIOD_MS));
1594
1596 - netdata_log_info("Starting metadata sync thread with %d entries command queue", METADATA_CMD_Q_MAX_SIZE);
1595 + netdata_log_info("Starting metadata sync thread");
1596
1597 struct metadata_cmd cmd;
1598 memset(&cmd, 0, sizeof(cmd));
@@ -1757,8 +1756,10 @@ static void metadata_event_loop(void *arg)
1756
1757 netdata_log_info("METADATA: Shutting down event loop");
1758 completion_mark_complete(&wc->init_complete);
1760 - completion_destroy(wc->scan_complete);
1761 - freez(wc->scan_complete);
1759 + if (wc->scan_complete) {
1760 + completion_destroy(wc->scan_complete);
1761 + freez(wc->scan_complete);
1762 + }
1763 metadata_free_cmd_queue(wc);
1764 return;
1765