summaryrefslogtreecommitdiffstats
path: root/src/database/contexts/rrdcontext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/contexts/rrdcontext.c')
-rw-r--r--src/database/contexts/rrdcontext.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/database/contexts/rrdcontext.c b/src/database/contexts/rrdcontext.c
index f755e1f7e..a98bc98ef 100644
--- a/src/database/contexts/rrdcontext.c
+++ b/src/database/contexts/rrdcontext.c
@@ -198,21 +198,16 @@ int rrdcontext_foreach_instance_with_rrdset_in_context(RRDHOST *host, const char
// ----------------------------------------------------------------------------
// ACLK interface
-static bool rrdhost_check_our_claim_id(const char *claim_id) {
- if(!localhost->aclk_state.claimed_id) return false;
- return (strcasecmp(claim_id, localhost->aclk_state.claimed_id) == 0) ? true : false;
-}
-
void rrdcontext_hub_checkpoint_command(void *ptr) {
struct ctxs_checkpoint *cmd = ptr;
- if(!rrdhost_check_our_claim_id(cmd->claim_id)) {
+ if(!claim_id_matches(cmd->claim_id)) {
+ CLAIM_ID claim_id = claim_id_get();
nd_log(NDLS_DAEMON, NDLP_WARNING,
"RRDCONTEXT: received checkpoint command for claim_id '%s', node id '%s', "
"but this is not our claim id. Ours '%s', received '%s'. Ignoring command.",
cmd->claim_id, cmd->node_id,
- localhost->aclk_state.claimed_id?localhost->aclk_state.claimed_id:"NOT SET",
- cmd->claim_id);
+ claim_id.str, cmd->claim_id);
return;
}
@@ -245,11 +240,10 @@ void rrdcontext_hub_checkpoint_command(void *ptr) {
"Sending snapshot of all contexts.",
cmd->version_hash, rrdhost_hostname(host), our_version_hash);
-#ifdef ENABLE_ACLK
// prepare the snapshot
- char uuid[UUID_STR_LEN];
- uuid_unparse_lower(*host->node_id, uuid);
- contexts_snapshot_t bundle = contexts_snapshot_new(cmd->claim_id, uuid, our_version_hash);
+ char uuid_str[UUID_STR_LEN];
+ uuid_unparse_lower(host->node_id.uuid, uuid_str);
+ contexts_snapshot_t bundle = contexts_snapshot_new(cmd->claim_id, uuid_str, our_version_hash);
// do a deep scan on every metric of the host to make sure all our data are updated
rrdcontext_recalculate_host_retention(host, RRD_FLAG_NONE, false);
@@ -262,7 +256,6 @@ void rrdcontext_hub_checkpoint_command(void *ptr) {
// send it
aclk_send_contexts_snapshot(bundle);
-#endif
}
nd_log(NDLS_DAEMON, NDLP_DEBUG,
@@ -271,7 +264,7 @@ void rrdcontext_hub_checkpoint_command(void *ptr) {
rrdhost_flag_set(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS);
char node_str[UUID_STR_LEN];
- uuid_unparse_lower(*host->node_id, node_str);
+ uuid_unparse_lower(host->node_id.uuid, node_str);
nd_log(NDLS_ACCESS, NDLP_DEBUG,
"ACLK REQ [%s (%s)]: STREAM CONTEXTS ENABLED",
node_str, rrdhost_hostname(host));
@@ -280,13 +273,13 @@ void rrdcontext_hub_checkpoint_command(void *ptr) {
void rrdcontext_hub_stop_streaming_command(void *ptr) {
struct stop_streaming_ctxs *cmd = ptr;
- if(!rrdhost_check_our_claim_id(cmd->claim_id)) {
+ if(!claim_id_matches(cmd->claim_id)) {
+ CLAIM_ID claim_id = claim_id_get();
nd_log(NDLS_DAEMON, NDLP_WARNING,
"RRDCONTEXT: received stop streaming command for claim_id '%s', node id '%s', "
"but this is not our claim id. Ours '%s', received '%s'. Ignoring command.",
cmd->claim_id, cmd->node_id,
- localhost->aclk_state.claimed_id?localhost->aclk_state.claimed_id:"NOT SET",
- cmd->claim_id);
+ claim_id.str, cmd->claim_id);
return;
}