]> arthur.barton.de Git - netdata.git/commitdiff
database size for mirrored hosts is now aligned to page size
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 13 Mar 2017 20:03:49 +0000 (22:03 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 13 Mar 2017 20:03:49 +0000 (22:03 +0200)
src/rrd.h
src/rrd2json.c
src/rrd2json_api_old.c
src/rrdhost.c
src/rrdpush.c

index 7843c80381e3c4fa10ae429f0ce8dda3fc777ac3..2f4f2127fffb202b7b94510770d2bbc250fd536e 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
@@ -376,7 +376,7 @@ struct rrdhost {
     uint32_t flags;                                 // flags about this RRDHOST
 
     int rrd_update_every;                           // the update frequency of the host
-    int rrd_history_entries;                        // the number of history entries for the host's charts
+    long rrd_history_entries;                       // the number of history entries for the host's charts
     RRD_MEMORY_MODE rrd_memory_mode;                // the memory more for the charts of this host
 
     char *cache_dir;                                // the directory to save RRD cache files
@@ -491,7 +491,7 @@ extern RRDHOST *rrdhost_find_or_create(
         , const char *guid
         , const char *os
         , int update_every
-        , int history
+        , long history
         , RRD_MEMORY_MODE mode
         , int health_enabled
         , int rrdpush_enabled
index 74ae1bb744df6f582600e361ed96a3cb18da6ddd..484b4bbb71e12e798c62cf89a6a4a82acbaace55 100644 (file)
@@ -90,7 +90,7 @@ void rrd_stats_api_v1_charts(RRDHOST *host, BUFFER *wb)
         ",\n\t\"version\": \"%s\""
         ",\n\t\"os\": \"%s\""
         ",\n\t\"update_every\": %d"
-        ",\n\t\"history\": %d"
+        ",\n\t\"history\": %ld"
         ",\n\t\"charts\": {"
         , host->hostname
         , program_version
index 3b0283088545c0ea047375c0519731cc1ecb1b16..6710f31cf9071450a17916d5a64b356a094e7113 100644 (file)
@@ -142,7 +142,7 @@ void rrd_all2json_api_old(RRDHOST *host, BUFFER *wb)
     buffer_sprintf(wb, "\n\t],\n"
                     "\t\"hostname\": \"%s\",\n"
                     "\t\"update_every\": %d,\n"
-                    "\t\"history\": %d,\n"
+                    "\t\"history\": %ld,\n"
                     "\t\"memory\": %lu\n"
                     "}\n"
                    , host->hostname
index 575b9ec0816860e47c52aad71785c0d6f88e1f0d..81ff96f892415a82a80f6a2ff2f330203a8e9caa 100644 (file)
@@ -83,7 +83,7 @@ RRDHOST *rrdhost_create(const char *hostname,
         const char *guid,
         const char *os,
         int update_every,
-        int entries,
+        long entries,
         RRD_MEMORY_MODE memory_mode,
         int health_enabled,
         int rrdpush_enabled,
@@ -98,7 +98,7 @@ RRDHOST *rrdhost_create(const char *hostname,
     RRDHOST *host = callocz(1, sizeof(RRDHOST));
 
     host->rrd_update_every    = update_every;
-    host->rrd_history_entries = entries;
+    host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries);
     host->rrd_memory_mode     = memory_mode;
     host->health_enabled      = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled;
     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,
                      ", os %s"
                      ", update every %d"
                      ", memory mode %s"
-                     ", history entries %d"
+                     ", history entries %ld"
                      ", streaming %s"
                      " (to '%s' with api key '%s')"
                      ", health %s"
@@ -270,7 +270,7 @@ RRDHOST *rrdhost_find_or_create(
         , const char *guid
         , const char *os
         , int update_every
-        , int history
+        , long history
         , RRD_MEMORY_MODE mode
         , int health_enabled
         , int rrdpush_enabled
@@ -310,7 +310,7 @@ RRDHOST *rrdhost_find_or_create(
             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);
 
         if(host->rrd_history_entries != history)
-            error("Host '%s' has history of %d entries, but the wanted one is %d entries.", host->hostname, host->rrd_history_entries, history);
+            error("Host '%s' has history of %ld entries, but the wanted one is %ld entries.", host->hostname, host->rrd_history_entries, history);
 
         if(host->rrd_memory_mode != mode)
             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));
index 40197a956d30fb72ccb6883ea396fabb74abf9c7..72e6d8a737bab8ca32688974b9ed34db1908af6e 100644 (file)
@@ -522,7 +522,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *m
     }
 
 #ifdef NETDATA_INTERNAL_CHECKS
-    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"
+    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"
          , hostname
          , client_ip
          , client_port