Do not call finalize on shutdown (#19241)
* Do not call finalize on shutdown * Do not create removed state on shutdown, check is done on restart
Stelios Fragkakis committed
Dec 17, 2024 at 23:47 UTC
6140ea50b0224bf0d03a0db46b351282f5ad3221
2 files changed
+23
-20
src/database/engine/rrdengineapi.c
+2
-1
@@ -1234,7 +1234,8 @@ int rrdeng_exit(struct rrdengine_instance *ctx) {
1234
completion_wait_for(&completion);
1235
completion_destroy(&completion);
1236
1237
- finalize_rrd_files(ctx);
1237
+ // No need to release the datafiles list
1238
+ //finalize_rrd_files(ctx);
1239
1240
if (unittest_running) //(ctx->config.unittest)
1241
freez(ctx);
src/health/rrdcalc.c
+21
-19
@@ -258,25 +258,27 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
258
return;
259
}
260
261
- RRDHOST *host = st->rrdhost;
262
-
263
- time_t now = now_realtime_sec();
264
-
265
- if (likely(rc->status != RRDCALC_STATUS_REMOVED)) {
266
- ALARM_ENTRY *ae = health_create_alarm_entry(
267
- host,
268
- rc,
269
- now,
270
- now - rc->last_status_change,
271
- rc->old_value,
272
- rc->value,
273
- rc->status,
274
- RRDCALC_STATUS_REMOVED,
275
- 0,
276
- 0);
277
-
278
- health_log_alert(host, ae);
279
- health_alarm_log_add_entry(host, ae);
261
+ if (!netdata_exit) {
262
+ RRDHOST *host = st->rrdhost;
263
+
264
+ time_t now = now_realtime_sec();
265
+
266
+ if (likely(rc->status != RRDCALC_STATUS_REMOVED)) {
267
+ ALARM_ENTRY *ae = health_create_alarm_entry(
268
+ host,
269
+ rc,
270
+ now,
271
+ now - rc->last_status_change,
272
+ rc->old_value,
273
+ rc->value,
274
+ rc->status,
275
+ RRDCALC_STATUS_REMOVED,
276
+ 0,
277
+ 0);
278
+
279
+ health_log_alert(host, ae);
280
+ health_alarm_log_add_entry(host, ae);
281
+ }
282
}
283
284
// unlink it