diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-26 08:29:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-26 08:29:53 +0000 |
commit | d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01 (patch) | |
tree | 8c283d1c81d718e64d87d9a2d1132c89f3915939 /database | |
parent | Releasing debian version 1.18.0-1. (diff) | |
download | netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.tar.xz netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.zip |
Merging upstream version 1.18.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database')
-rw-r--r-- | database/rrddim.c | 15 | ||||
-rw-r--r-- | database/rrdset.c | 8 |
2 files changed, 13 insertions, 10 deletions
diff --git a/database/rrddim.c b/database/rrddim.c index 8ab5a723..0032940c 100644 --- a/database/rrddim.c +++ b/database/rrddim.c @@ -160,7 +160,7 @@ void rrdcalc_link_to_rrddim(RRDDIM *rd, RRDSET *st, RRDHOST *host) { RRDCALC *rrdc; for (rrdc = host->alarms_with_foreach; rrdc ; rrdc = rrdc->next) { if (simple_pattern_matches(rrdc->spdim, rd->id) || simple_pattern_matches(rrdc->spdim, rd->name)) { - if (!strcmp(rrdc->chart, st->name)) { + if (rrdc->hash_chart == st->hash_name || !strcmp(rrdc->chart, st->name) || !strcmp(rrdc->chart, st->id)) { char *usename = alarm_name_with_dim(rrdc->name, strlen(rrdc->name), rd->name, strlen(rd->name)); if (usename) { if(rrdcalc_exists(host, st->name, usename, 0, 0)){ @@ -217,9 +217,9 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte snprintfz(fullfilename, FILENAME_MAX, "%s/%s.db", st->cache_dir, filename); if(memory_mode == RRD_MEMORY_MODE_SAVE || memory_mode == RRD_MEMORY_MODE_MAP || - memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE) { + memory_mode == RRD_MEMORY_MODE_RAM) { rd = (RRDDIM *)mymmap( - (memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE)?NULL:fullfilename + (memory_mode == RRD_MEMORY_MODE_RAM) ? NULL : fullfilename , size , ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE) , 1 @@ -240,7 +240,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte struct timeval now; now_realtime_timeval(&now); - if(memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE) { + if(memory_mode == RRD_MEMORY_MODE_RAM) { memset(rd, 0, size); } else { @@ -292,7 +292,10 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte if(unlikely(!rd)) { // if we didn't manage to get a mmap'd dimension, just create one rd = callocz(1, size); - rd->rrd_memory_mode = (memory_mode == RRD_MEMORY_MODE_NONE) ? RRD_MEMORY_MODE_NONE : RRD_MEMORY_MODE_ALLOC; + if (memory_mode == RRD_MEMORY_MODE_DBENGINE) + rd->rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; + else + rd->rrd_memory_mode = (memory_mode == RRD_MEMORY_MODE_NONE) ? RRD_MEMORY_MODE_NONE : RRD_MEMORY_MODE_ALLOC; } rd->memsize = size; @@ -460,7 +463,6 @@ void rrddim_free(RRDSET *st, RRDDIM *rd) case RRD_MEMORY_MODE_SAVE: case RRD_MEMORY_MODE_MAP: case RRD_MEMORY_MODE_RAM: - case RRD_MEMORY_MODE_DBENGINE: debug(D_RRD_CALLS, "Unmapping dimension '%s'.", rd->name); freez((void *)rd->id); freez(rd->cache_filename); @@ -469,6 +471,7 @@ void rrddim_free(RRDSET *st, RRDDIM *rd) case RRD_MEMORY_MODE_ALLOC: case RRD_MEMORY_MODE_NONE: + case RRD_MEMORY_MODE_DBENGINE: debug(D_RRD_CALLS, "Removing dimension '%s'.", rd->name); freez((void *)rd->id); freez(rd->cache_filename); diff --git a/database/rrdset.c b/database/rrdset.c index 26df8d73..e96d707b 100644 --- a/database/rrdset.c +++ b/database/rrdset.c @@ -369,13 +369,13 @@ void rrdset_free(RRDSET *st) { case RRD_MEMORY_MODE_SAVE: case RRD_MEMORY_MODE_MAP: case RRD_MEMORY_MODE_RAM: - case RRD_MEMORY_MODE_DBENGINE: debug(D_RRD_CALLS, "Unmapping stats '%s'.", st->name); munmap(st, st->memsize); break; case RRD_MEMORY_MODE_ALLOC: case RRD_MEMORY_MODE_NONE: + case RRD_MEMORY_MODE_DBENGINE: freez(st); break; } @@ -569,9 +569,9 @@ RRDSET *rrdset_create_custom( snprintfz(fullfilename, FILENAME_MAX, "%s/main.db", cache_dir); if(memory_mode == RRD_MEMORY_MODE_SAVE || memory_mode == RRD_MEMORY_MODE_MAP || - memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE) { + memory_mode == RRD_MEMORY_MODE_RAM) { st = (RRDSET *) mymmap( - (memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE)?NULL:fullfilename + (memory_mode == RRD_MEMORY_MODE_RAM) ? NULL : fullfilename , size , ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE) , 0 @@ -602,7 +602,7 @@ RRDSET *rrdset_create_custom( st->alarms = NULL; st->flags = 0x00000000; - if(memory_mode == RRD_MEMORY_MODE_RAM || memory_mode == RRD_MEMORY_MODE_DBENGINE) { + if(memory_mode == RRD_MEMORY_MODE_RAM) { memset(st, 0, size); } else { |