@cryptotaxi247 / netdata-1 / commits / 2cd349f94

database size for mirrored hosts is now aligned to page size

Costa Tsaousis (ktsaou) committed Mar 13, 2017 at 22:03 UTC 2cd349f942f8e973e12bc907c8b67c81ed78f2e9
5 files changed +10 -10
src/rrd.h
+2 -2
@@ -376,7 +376,7 @@ struct rrdhost {
376 uint32_t flags; // flags about this RRDHOST
377
378 int rrd_update_every; // the update frequency of the host
379 - int rrd_history_entries; // the number of history entries for the host's charts
379 + long rrd_history_entries; // the number of history entries for the host's charts
380 RRD_MEMORY_MODE rrd_memory_mode; // the memory more for the charts of this host
381
382 char *cache_dir; // the directory to save RRD cache files
@@ -491,7 +491,7 @@ extern RRDHOST *rrdhost_find_or_create(
491 , const char *guid
492 , const char *os
493 , int update_every
494 - , int history
494 + , long history
495 , RRD_MEMORY_MODE mode
496 , int health_enabled
497 , int rrdpush_enabled
src/rrd2json.c
+1 -1
@@ -90,7 +90,7 @@ void rrd_stats_api_v1_charts(RRDHOST *host, BUFFER *wb)
90 ",\n\t\"version\": \"%s\""
91 ",\n\t\"os\": \"%s\""
92 ",\n\t\"update_every\": %d"
93 - ",\n\t\"history\": %d"
93 + ",\n\t\"history\": %ld"
94 ",\n\t\"charts\": {"
95 , host->hostname
96 , program_version
src/rrd2json_api_old.c
+1 -1
@@ -142,7 +142,7 @@ void rrd_all2json_api_old(RRDHOST *host, BUFFER *wb)
142 buffer_sprintf(wb, "\n\t],\n"
143 "\t\"hostname\": \"%s\",\n"
144 "\t\"update_every\": %d,\n"
145 - "\t\"history\": %d,\n"
145 + "\t\"history\": %ld,\n"
146 "\t\"memory\": %lu\n"
147 "}\n"
148 , host->hostname
src/rrdhost.c
+5 -5
@@ -83,7 +83,7 @@ RRDHOST *rrdhost_create(const char *hostname,
83 const char *guid,
84 const char *os,
85 int update_every,
86 - int entries,
86 + long entries,
87 RRD_MEMORY_MODE memory_mode,
88 int health_enabled,
89 int rrdpush_enabled,
@@ -98,7 +98,7 @@ RRDHOST *rrdhost_create(const char *hostname,
98 RRDHOST *host = callocz(1, sizeof(RRDHOST));
99
100 host->rrd_update_every = update_every;
101 - host->rrd_history_entries = entries;
101 + host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries);
102 host->rrd_memory_mode = memory_mode;
103 host->health_enabled = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled;
104 host->rrdpush_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key);
@@ -233,7 +233,7 @@ RRDHOST *rrdhost_create(const char *hostname,
233 ", os %s"
234 ", update every %d"
235 ", memory mode %s"
236 - ", history entries %d"
236 + ", history entries %ld"
237 ", streaming %s"
238 " (to '%s' with api key '%s')"
239 ", health %s"
@@ -270,7 +270,7 @@ RRDHOST *rrdhost_find_or_create(
270 , const char *guid
271 , const char *os
272 , int update_every
273 - , int history
273 + , long history
274 , RRD_MEMORY_MODE mode
275 , int health_enabled
276 , int rrdpush_enabled
@@ -310,7 +310,7 @@ RRDHOST *rrdhost_find_or_create(
310 error("Host '%s' has an update frequency of %d seconds, but the wanted one is %d seconds.", host->hostname, host->rrd_update_every, update_every);
311
312 if(host->rrd_history_entries != history)
313 - error("Host '%s' has history of %d entries, but the wanted one is %d entries.", host->hostname, host->rrd_history_entries, history);
313 + error("Host '%s' has history of %ld entries, but the wanted one is %ld entries.", host->hostname, host->rrd_history_entries, history);
314
315 if(host->rrd_memory_mode != mode)
316 error("Host '%s' has memory mode '%s', but the wanted one is '%s'.", host->hostname, rrd_memory_mode_name(host->rrd_memory_mode), rrd_memory_mode_name(mode));
src/rrdpush.c
+1 -1
@@ -522,7 +522,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *m
522 }
523
524 #ifdef NETDATA_INTERNAL_CHECKS
525 - info("STREAM %s [receive from [%s]:%s]: client willing to stream metrics for host '%s' with machine_guid '%s': update every = %d, history = %d, memory mode = %s, health %s"
525 + info("STREAM %s [receive from [%s]:%s]: client willing to stream metrics for host '%s' with machine_guid '%s': update every = %d, history = %ld, memory mode = %s, health %s"
526 , hostname
527 , client_ip
528 , client_port