// set to zero to disable this feature
extern int rrd_delete_unupdated_dimensions;
-#define RRD_ID_LENGTH_MAX 1024
+#define RRD_ID_LENGTH_MAX 400
#define RRDSET_MAGIC "NETDATA RRD SET FILE V018"
#define RRDDIMENSION_MAGIC "NETDATA RRD DIMENSION FILE V018"
// ----------------------------------------------------------------------------
// RRD CONTEXT
-struct rrdcontext {
+struct rrdfamily {
avl avl;
- const char *id;
- uint32_t hash;
+ const char *family;
+ uint32_t hash_family;
size_t use_count;
avl_tree_lock variables_root_index;
};
-typedef struct rrdcontext RRDCONTEXT;
+typedef struct rrdfamily RRDFAMILY;
// ----------------------------------------------------------------------------
// RRD DIMENSION
// FIXME
// we need the hash_name too!
+ // needed at rrdr_disable_not_selected_dimensions()
uint32_t flags;
// this is actual date time we updated the last_collected_value
// THIS IS DIFFERENT FROM THE SAME MEMBER OF RRDSET
- calculated_number calculated_value; // the current calculated value, after applying the algorithm
- calculated_number last_calculated_value; // the last calculated value
+ calculated_number calculated_value; // the current calculated value, after applying the algorithm - resets to zero after being used
+ calculated_number last_calculated_value; // the last calculated value processed
- collected_number collected_value; // the current value, as collected
- collected_number last_collected_value; // the last value that was collected
+ calculated_number last_stored_value; // the last value as stored in the database (after interpolation)
+
+ collected_number collected_value; // the current value, as collected - resets to 0 after being used
+ collected_number last_collected_value; // the last value that was collected, after being processed
// the *_volume members are used to calculate the accuracy of the rounding done by the
// storage number - they are printed to debug.log when debug is enabled for a set.
uint32_t hash_name; // a simple hash on the name
- unsigned long long usec_since_last_update; // the time in microseconds since the last collection of data
+ usec_t usec_since_last_update; // the time in microseconds since the last collection of data
struct timeval last_updated; // when this data set was last updated (updated every time the rrd_stats_done() function)
struct timeval last_collected_time; // when did this data set last collected values
total_number collected_total; // used internally to calculate percentages
total_number last_collected_total; // used internally to calculate percentages
- RRDCONTEXT *rrdcontext;
+ RRDFAMILY *rrdfamily;
struct rrdhost *rrdhost;
struct rrdset *next; // linking of rrdsets
avl_tree_lock variables_root_index;
RRDSETVAR *variables;
- RRDCALC *calculations;
+ RRDCALC *alarms;
// ------------------------------------------------------------------------
// members for checking the data when loading from disk
// ------------------------------------------------------------------------
// the dimensions
- avl_tree_lock dimensions_index; // the root of the dimensions index
+ avl_tree_lock dimensions_index; // the root of the dimensions index
RRDDIM *dimensions; // the actual data for every dimension
};
avl_tree_lock rrdset_root_index;
avl_tree_lock rrdset_root_index_name;
- avl_tree_lock rrdcontext_root_index;
+ avl_tree_lock rrdfamily_root_index;
avl_tree_lock variables_root_index;
// all RRDCALCs are primarily allocated and linked here
// RRDCALCs may be linked to charts at any point
// (charts may or may not exist when these are loaded)
- RRDCALC *calculations;
+ RRDCALC *alarms;
+ ALARM_LOG health_log;
RRDCALCTEMPLATE *templates;
-
- // all variable references are linked here
- // RRDVARs may be free'd, so every time this happens
- // we need to find all their references and invalidate them
- EVAL_VARIABLE *references;
};
typedef struct rrdhost RRDHOST;
extern RRDHOST localhost;
+extern void rrdhost_init(char *hostname);
#ifdef NETDATA_INTERNAL_CHECKS
#define rrdhost_check_wrlock(host) rrdhost_check_wrlock_int(host, __FILE__, __FUNCTION__, __LINE__)
+#define rrdhost_check_rdlock(host) rrdhost_check_rdlock_int(host, __FILE__, __FUNCTION__, __LINE__)
#else
+#define rrdhost_check_rdlock(host) (void)0
#define rrdhost_check_wrlock(host) (void)0
#endif
+
extern void rrdhost_check_wrlock_int(RRDHOST *host, const char *file, const char *function, const unsigned long line);
+extern void rrdhost_check_rdlock_int(RRDHOST *host, const char *file, const char *function, const unsigned long line);
+
+extern void rrdhost_rwlock(RRDHOST *host);
+extern void rrdhost_rdlock(RRDHOST *host);
+extern void rrdhost_unlock(RRDHOST *host);
// ----------------------------------------------------------------------------
// RRD SET functions
extern RRDSET *rrdset_find_bytype(const char *type, const char *id);
extern RRDSET *rrdset_find_byname(const char *name);
-extern void rrdset_next_usec(RRDSET *st, unsigned long long microseconds);
-extern void rrdset_next(RRDSET *st);
-extern void rrdset_next_plugins(RRDSET *st);
+extern void rrdset_next_usec_unfiltered(RRDSET *st, usec_t microseconds);
+extern void rrdset_next_usec(RRDSET *st, usec_t microseconds);
+#define rrdset_next(st) rrdset_next_usec(st, 0ULL)
-extern unsigned long long rrdset_done(RRDSET *st);
+extern usec_t rrdset_done(RRDSET *st);
// get the total duration in seconds of the round robin database
#define rrdset_duration(st) ((time_t)( (((st)->counter >= ((unsigned long)(st)->entries))?(unsigned long)(st)->entries:(st)->counter) * (st)->update_every ))