@cryptotaxi247 / netdata-1 / commits / f9f813cd4

Fix memory mode none not marking dimensions as obsolete. (#9912)

* Fix memory mode none not marking dimensions as obsolete.

Markos Fountoulakis committed Sep 11, 2020 at 10:16 UTC f9f813cd463173acda2f64b275bb6f3f365e5964
2 files changed +16 -41
database/rrddim.c
+2
@@ -596,6 +596,8 @@ inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) {
596 }
597 rrddim_flag_set(rd, RRDDIM_FLAG_OBSOLETE);
598 rrdset_flag_set(st, RRDSET_FLAG_OBSOLETE_DIMENSIONS);
599 + if (unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE))
600 + rd->updated = 0;
601 #ifdef ENABLE_ACLK
602 if (netdata_cloud_setting)
603 aclk_update_chart(st->rrdhost, st->id, ACLK_CMD_CHART);
database/rrdset.c
+14 -41
@@ -1134,34 +1134,6 @@ static inline usec_t rrdset_init_last_updated_time(RRDSET *st) {
1134 return last_updated_ut;
1135 }
1136
1137 -static inline void rrdset_done_push_exclusive(RRDSET *st) {
1138 -// usec_t update_every_ut = st->update_every * USEC_PER_SEC; // st->update_every in microseconds
1139 -//
1140 -// if(unlikely(st->usec_since_last_update > update_every_ut * remote_clock_resync_iterations)) {
1141 -// error("Chart '%s' was last collected %llu usec before. Resetting it.", st->id, st->usec_since_last_update);
1142 -// rrdset_reset(st);
1143 -// st->usec_since_last_update = update_every_ut;
1144 -// }
1145 -
1146 - if(unlikely(!st->last_collected_time.tv_sec)) {
1147 - // it is the first entry
1148 - // set the last_collected_time to now
1149 - rrdset_init_last_collected_time(st);
1150 - }
1151 - else {
1152 - // it is not the first entry
1153 - // calculate the proper last_collected_time, using usec_since_last_update
1154 - rrdset_update_last_collected_time(st);
1155 - }
1156 -
1157 - st->counter_done++;
1158 -
1159 - rrdset_rdlock(st);
1160 - rrdset_done_push(st);
1161 - rrdset_unlock(st);
1162 -}
1163 -
1164 -
1137 static inline size_t rrdset_done_interpolate(
1138 RRDSET *st
1139 , usec_t update_every_ut
@@ -1407,13 +1379,6 @@ static inline void rrdset_done_fill_the_gap(RRDSET *st) {
1379 void rrdset_done(RRDSET *st) {
1380 if(unlikely(netdata_exit)) return;
1381
1410 - if(unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE)) {
1411 - if(unlikely(st->rrdhost->rrdpush_send_enabled))
1412 - rrdset_done_push_exclusive(st);
1413 -
1414 - return;
1415 - }
1416 -
1382 debug(D_RRD_CALLS, "rrdset_done() for chart %s", st->name);
1383
1384 RRDDIM *rd;
@@ -1423,10 +1388,10 @@ void rrdset_done(RRDSET *st) {
1388 first_entry = 0; // boolean: 1 = this is the first entry seen for this chart, 0 = all other entries
1389
1390 usec_t
1426 - last_collect_ut, // the timestamp in microseconds, of the last collected value
1427 - now_collect_ut, // the timestamp in microseconds, of this collected value (this is NOW)
1428 - last_stored_ut, // the timestamp in microseconds, of the last stored entry in the db
1429 - next_store_ut, // the timestamp in microseconds, of the next entry to store in the db
1391 + last_collect_ut = 0, // the timestamp in microseconds, of the last collected value
1392 + now_collect_ut = 0, // the timestamp in microseconds, of this collected value (this is NOW)
1393 + last_stored_ut = 0, // the timestamp in microseconds, of the last stored entry in the db
1394 + next_store_ut = 0, // the timestamp in microseconds, of the next entry to store in the db
1395 update_every_ut = st->update_every * USEC_PER_SEC; // st->update_every in microseconds
1396
1397 netdata_thread_disable_cancelability();
@@ -1441,7 +1406,7 @@ void rrdset_done(RRDSET *st) {
1406
1407 // check if the chart has a long time to be updated
1408 if(unlikely(st->usec_since_last_update > st->entries * update_every_ut &&
1444 - st->rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE)) {
1409 + st->rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE && st->rrd_memory_mode != RRD_MEMORY_MODE_NONE)) {
1410 info("host '%s', chart %s: took too long to be updated (counter #%zu, update #%zu, %0.3" LONG_DOUBLE_MODIFIER " secs). Resetting it.", st->rrdhost->hostname, st->name, st->counter, st->counter_done, (LONG_DOUBLE)st->usec_since_last_update / USEC_PER_SEC);
1411 rrdset_reset(st);
1412 st->usec_since_last_update = update_every_ut;
@@ -1468,6 +1433,9 @@ void rrdset_done(RRDSET *st) {
1433 // calculate the proper last_collected_time, using usec_since_last_update
1434 last_collect_ut = rrdset_update_last_collected_time(st);
1435 }
1436 + if (unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE)) {
1437 + goto after_first_database_work;
1438 + }
1439
1440 // if this set has not been updated in the past
1441 // we fake the last_update time to be = now - usec_since_last_update
@@ -1551,10 +1519,14 @@ void rrdset_done(RRDSET *st) {
1519 #endif
1520 }
1521 }
1522 +after_first_database_work:
1523 st->counter_done++;
1524
1525 if(unlikely(st->rrdhost->rrdpush_send_enabled))
1526 rrdset_done_push(st);
1527 + if (unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE)) {
1528 + goto after_second_database_work;
1529 + }
1530
1531 #ifdef NETDATA_INTERNAL_CHECKS
1532 rrdset_debug(st, "last_collect_ut = %0.3" LONG_DOUBLE_MODIFIER " (last collection time)", (LONG_DOUBLE)last_collect_ut/USEC_PER_SEC);
@@ -1887,7 +1859,8 @@ void rrdset_done(RRDSET *st) {
1859
1860 // ALL DONE ABOUT THE DATA UPDATE
1861 // --------------------------------------------------------------------
1890 -
1862 +after_second_database_work:
1863 + ;
1864 // find if there are any obsolete dimensions
1865 time_t now = now_realtime_sec();
1866