Skip to content

Commit

Permalink
Do not register removed node on agent restart (netdata#19609)
Browse files Browse the repository at this point in the history
* If unregistered during startup and it was removed by cli or cleanup, do not register again

* Code cleanup
  • Loading branch information
stelfrag authored Feb 10, 2025
1 parent d72465d commit 250d1bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/database/sqlite/sqlite_aclk.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int create_host_callback(void *data, int argc, char **argv, char **column
char guid[UUID_STR_LEN];
uuid_unparse_lower(*(nd_uuid_t *)argv[IDX_HOST_ID], guid);

if (is_ephemeral && rrdhost_free_ephemeral_time_s && age > rrdhost_free_ephemeral_time_s) {
if (is_ephemeral && ((!is_registered && last_connected == 1) || (rrdhost_free_ephemeral_time_s && age > rrdhost_free_ephemeral_time_s))) {
netdata_log_info(
"%s ephemeral hostname \"%s\" with GUID \"%s\", age = %ld seconds (limit %ld seconds)",
is_registered ? "Loading registered" : "Skipping unregistered",
Expand All @@ -141,7 +141,7 @@ static int create_host_callback(void *data, int argc, char **argv, char **column
rrdhost_free_ephemeral_time_s);

if (!is_registered)
return 0;
goto done;
}

struct rrdhost_system_info *system_info = rrdhost_system_info_create();
Expand Down Expand Up @@ -196,6 +196,8 @@ static int create_host_callback(void *data, int argc, char **argv, char **column
internal_error(true, "Adding archived host \"%s\" with GUID \"%s\" node id = \"%s\" ephemeral=%d",
rrdhost_hostname(host), host->machine_guid, node_str, is_ephemeral);
#endif

done:
return 0;
}

Expand Down

0 comments on commit 250d1bd

Please sign in to comment.