@cryptotaxi247 / netdata-1 / commits / a21119469

Fix broken dbengine stress tests. (#10502)

Markos Fountoulakis committed Jan 15, 2021 at 12:41 UTC a21119469b21513a84933780d534b9105d10daff
2 files changed +8 -4
daemon/unit_test.c
+4 -4
@@ -2099,7 +2099,7 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi
2099 struct dbengine_chart_thread **chart_threads;
2100 struct dbengine_query_thread **query_threads;
2101 unsigned i, j;
2102 - time_t time_start, time_end;
2102 + time_t time_start, test_duration;
2103
2104 error_log_limit_unlimited();
2105
@@ -2195,8 +2195,8 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi
2195 for (i = 0 ; i < QUERY_THREADS ; ++i) {
2196 assert(0 == uv_thread_join(&query_threads[i]->thread));
2197 }
2198 - time_end = now_realtime_sec();
2199 - fprintf(stderr, "\nDB-engine stress test finished in %ld seconds.\n", time_end - time_start);
2198 + test_duration = now_realtime_sec() - (time_start - HISTORY_SECONDS);
2199 + fprintf(stderr, "\nDB-engine stress test finished in %ld seconds.\n", test_duration);
2200 unsigned long stored_metrics_nr = 0;
2201 for (i = 0 ; i < DSET_CHARTS ; ++i) {
2202 stored_metrics_nr += chart_threads[i]->stored_metrics_nr;
@@ -2213,7 +2213,7 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi
2213 fprintf(stderr, "Query starting time is randomly chosen from the beginning of the time-series up to the time of\n"
2214 "the latest data point, and ending time from 1 second up to 1 hour after the starting time.\n");
2215 fprintf(stderr, "Performance is %lu written data points/sec and %lu read data points/sec.\n",
2216 - stored_metrics_nr / (time_end - time_start), queried_metrics_nr / (time_end - time_start));
2216 + stored_metrics_nr / test_duration, queried_metrics_nr / test_duration);
2217
2218 for (i = 0 ; i < DSET_CHARTS ; ++i) {
2219 freez(chart_threads[i]);
database/engine/rrdenginelib.c
+4
@@ -214,6 +214,10 @@ int is_legacy_child(const char *machine_guid)
214 uuid_t uuid;
215 char dbengine_file[FILENAME_MAX+1];
216
217 + if (unlikely(!strcmp(machine_guid, "unittest-dbengine") || !strcmp(machine_guid, "dbengine-dataset") ||
218 + !strcmp(machine_guid, "dbengine-stress-test"))) {
219 + return 1;
220 + }
221 if (!uuid_parse(machine_guid, uuid)) {
222 uv_fs_t stat_req;
223 snprintfz(dbengine_file, FILENAME_MAX, "%s/%s/dbengine", netdata_configured_cache_dir, machine_guid);