Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from netdata:master #17

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Update input skip patterns [\#16984](https://github.com/netdata/netdata/pull/16984) ([tkatsoulas](https://github.com/tkatsoulas))
- Update input paths for tj-actions/changed-files [\#16982](https://github.com/netdata/netdata/pull/16982) ([tkatsoulas](https://github.com/tkatsoulas))
- Update synology.md [\#16980](https://github.com/netdata/netdata/pull/16980) ([pschaer](https://github.com/pschaer))
- Detect machine GUID change [\#16979](https://github.com/netdata/netdata/pull/16979) ([stelfrag](https://github.com/stelfrag))
- Regenerate integrations.js [\#16974](https://github.com/netdata/netdata/pull/16974) ([netdatabot](https://github.com/netdatabot))
- Use C++14 by default when building on systems that support it. [\#16972](https://github.com/netdata/netdata/pull/16972) ([Ferroin](https://github.com/Ferroin))
- change edac ecc errors from incremental to absolute [\#16970](https://github.com/netdata/netdata/pull/16970) ([ilyam8](https://github.com/ilyam8))
Expand Down Expand Up @@ -398,8 +399,6 @@
- adaptec\_raid: fix parsing PD without NCQ status [\#16400](https://github.com/netdata/netdata/pull/16400) ([ilyam8](https://github.com/ilyam8))
- eBPF apps order [\#16395](https://github.com/netdata/netdata/pull/16395) ([thiagoftsm](https://github.com/thiagoftsm))
- fix systemd-units func expiration time [\#16393](https://github.com/netdata/netdata/pull/16393) ([ilyam8](https://github.com/ilyam8))
- docker: mount /etc/localtime [\#16392](https://github.com/netdata/netdata/pull/16392) ([ilyam8](https://github.com/ilyam8))
- fix "differ in signedness" warn in cgroup [\#16391](https://github.com/netdata/netdata/pull/16391) ([ilyam8](https://github.com/ilyam8))

## [v1.43.2](https://github.com/netdata/netdata/tree/v1.43.2) (2023-10-30)

Expand Down
2 changes: 1 addition & 1 deletion packaging/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.44.0-356-nightly
v1.44.0-358-nightly
2 changes: 1 addition & 1 deletion src/database/rrdhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info, bool unitt
rrdhost_function_progress);

if (likely(system_info)) {
migrate_localhost(&localhost->host_uuid);
detect_machine_guid_change(&localhost->host_uuid);
sql_aclk_sync_init();
web_client_api_v1_management_init();
}
Expand Down
12 changes: 4 additions & 8 deletions src/database/sqlite/sqlite_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
"INSERT OR REPLACE INTO host_info (host_id, system_key, system_value, date_created) VALUES " \
"(@uuid, @name, @value, UNIXEPOCH())"

#define MIGRATE_LOCALHOST_TO_NEW_MACHINE_GUID \
"UPDATE chart SET host_id = @host_id WHERE host_id in (SELECT host_id FROM host where host_id <> @host_id and hops = 0)"
#define DELETE_NON_EXISTING_LOCALHOST "DELETE FROM host WHERE hops = 0 AND host_id <> @host_id"
#define CONVERT_EXISTING_LOCALHOST "UPDATE host SET hops = 1 WHERE hops = 0 AND host_id <> @host_id"
#define DELETE_MISSING_NODE_INSTANCES "DELETE FROM node_instance WHERE host_id NOT IN (SELECT host_id FROM host)"

#define METADATA_MAINTENANCE_FIRST_CHECK (1800) // Maintenance first run after agent startup in seconds
Expand Down Expand Up @@ -231,14 +229,12 @@ static int check_and_update_chart_labels(RRDSET *st, BUFFER *work_buffer, size_t
return rc;
}

// Migrate all hosts with hops zero to this host_uuid
void migrate_localhost(uuid_t *host_uuid)
// If the machine guid has changed, then existing one with hops 0 will be marked as hops 1 (child)
void detect_machine_guid_change(uuid_t *host_uuid)
{
int rc;

rc = exec_statement_with_uuid(MIGRATE_LOCALHOST_TO_NEW_MACHINE_GUID, host_uuid);
if (!rc)
rc = exec_statement_with_uuid(DELETE_NON_EXISTING_LOCALHOST, host_uuid);
rc = exec_statement_with_uuid(CONVERT_EXISTING_LOCALHOST, host_uuid);
if (!rc) {
if (unlikely(db_execute(db_meta, DELETE_MISSING_NODE_INSTANCES)))
error_report("Failed to remove deleted hosts from node instances");
Expand Down
2 changes: 1 addition & 1 deletion src/database/sqlite/sqlite_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void metaqueue_delete_dimension_uuid(uuid_t *uuid);
void metaqueue_store_claim_id(uuid_t *host_uuid, uuid_t *claim_uuid);
void metaqueue_host_update_info(RRDHOST *host);
void metaqueue_ml_load_models(RRDDIM *rd);
void migrate_localhost(uuid_t *host_uuid);
void detect_machine_guid_change(uuid_t *host_uuid);
void metadata_queue_load_host_context(RRDHOST *host);
void metadata_delete_host_chart_labels(char *machine_guid);
void vacuum_database(sqlite3 *database, const char *db_alias, int threshold, int vacuum_pc);
Expand Down
Loading