diff options
author | Markos Fountoulakis <44345837+mfundul@users.noreply.github.com> | 2019-10-11 17:39:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 17:39:17 +0300 |
commit | 6c2bab0543ee8df1df0ef4b4f4633841f6de9d7f (patch) | |
tree | 8d9007204479be3cbb3840a22711c952ecf574e8 /database/rrdset.c | |
parent | af1596e8357d2116f5faf690e1d7f01e2d701eb5 (diff) |
Fix dbengine not working when mmap fails (#7065)
Diffstat (limited to 'database/rrdset.c')
-rw-r--r-- | database/rrdset.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/database/rrdset.c b/database/rrdset.c index 26df8d737d..e96d707bed 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 { |