0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-21 16:27:14 +00:00

Fix coverity issues ()

* Add check for NULL wc->host

* Use sqlite3_exec, if it fails it will be retried on the next health log entries rotation
This commit is contained in:
Stelios Fragkakis 2021-11-19 16:56:51 +02:00 committed by GitHub
parent ceec6aec1d
commit 11b8588c94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 13 deletions
database/sqlite

View file

@ -572,18 +572,24 @@ void aclk_receive_chart_reset(struct aclk_database_worker_config *wc, struct acl
wc->chart_payload_count = 0;
RRDHOST *host = wc->host;
rrdhost_rdlock(host);
RRDSET *st;
rrdset_foreach_read(st, host) {
rrdset_rdlock(st);
rrdset_flag_clear(st, RRDSET_FLAG_ACLK);
RRDDIM *rd;
rrddim_foreach_read(rd, st) {
rd->state->aclk_live_status = (rd->state->aclk_live_status == 0);
if (likely(host)) {
rrdhost_rdlock(host);
RRDSET *st;
rrdset_foreach_read(st, host)
{
rrdset_rdlock(st);
rrdset_flag_clear(st, RRDSET_FLAG_ACLK);
RRDDIM *rd;
rrddim_foreach_read(rd, st)
{
rd->state->aclk_live_status = (rd->state->aclk_live_status == 0);
}
rrdset_unlock(st);
}
rrdset_unlock(st);
rrdhost_unlock(host);
}
rrdhost_unlock(host);
else
error_report("ACLK synchronization thread for %s is not linked to HOST", wc->host_guid);
}
else {
log_access("AC [%s (%s)]: Restarting chart sync from sequence %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", cmd.param1);