!34 [sync] PR-32: recover check number printing and trim dbengine test frequency
From: @openeuler-sync-bot Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
3ca70a8bc4
@ -1,12 +0,0 @@
|
||||
diff --git a/daemon/unit_test.c b/daemon/unit_test.c
|
||||
index fa3fa84..bdf3e22 100644
|
||||
--- a/daemon/unit_test.c
|
||||
+++ b/daemon/unit_test.c
|
||||
@@ -81,7 +81,6 @@ static int check_number_printing(void) {
|
||||
{ .n = 8294967295.123456789, .correct = "8294967295.123457" },
|
||||
{ .n = 1.000000000000002e+19, .correct = "1.000000000000001998e+19" },
|
||||
{ .n = 9.2233720368547676e+18, .correct = "9.223372036854767584e+18" },
|
||||
- { .n = 18446744073709541376.0, .correct = "1.84467440737095424e+19" },
|
||||
{ .n = 18446744073709551616.0, .correct = "1.844674407370955136e+19" },
|
||||
{ .n = 12318446744073710600192.0, .correct = "1.231844674407371008e+22" },
|
||||
{ .n = 1677721499999999885312.0, .correct = "1.677721499999999872e+21" },
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
Name: netdata
|
||||
Version: 1.39.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: Real-time performance monitoring
|
||||
License: GPLv3 and GPLv3+ and ASL 2.0 and CC-BY-4.0 and MIT and WTFPL
|
||||
URL: https://github.com/%{name}/%{name}/
|
||||
@ -25,7 +25,7 @@ Source7: netdata-install-go-plugins.sh
|
||||
Patch0: netdata-fix-shebang-1.39.0.patch
|
||||
# Remove embedded font
|
||||
Patch10: netdata-remove-fonts-1.38.0.patch
|
||||
Patch11: adapted-openeuler-system-to-fix-testcase-fail.patch
|
||||
Patch11: trim-dbengine-test-frequency.patch
|
||||
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: git
|
||||
@ -275,6 +275,9 @@ echo "Netdata go plugin can be easily installed with %{_sbindir}/netdata-install
|
||||
%caps(cap_setuid=ep) %attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
|
||||
|
||||
%changelog
|
||||
* Thu Jan 04 2024 Ge Wang <wang__ge@126.com> - 1.39.1-3
|
||||
- recover check number printing and trim dbengine test frequency
|
||||
|
||||
* Thu Sep 28 2023 xu_ping <707078654@qq.com> - 1.39.1-2
|
||||
- fix testcase failed.
|
||||
|
||||
|
||||
150
trim-dbengine-test-frequency.patch
Normal file
150
trim-dbengine-test-frequency.patch
Normal file
@ -0,0 +1,150 @@
|
||||
From 3f935f49aee0ad81255a5f0d18648fd414ccea48 Mon Sep 17 00:00:00 2001
|
||||
From: wang--ge <wang__ge@126.com>
|
||||
Date: Thu, 4 Jan 2024 09:50:15 +0800
|
||||
Subject: [PATCH] trim dbengine test frequency
|
||||
|
||||
---
|
||||
daemon/unit_test.c | 99 +-------------------------------------------
|
||||
libnetdata/inlined.h | 2 +
|
||||
2 files changed, 4 insertions(+), 97 deletions(-)
|
||||
|
||||
diff --git a/daemon/unit_test.c b/daemon/unit_test.c
|
||||
index fa3fa84..b4e93c6 100644
|
||||
--- a/daemon/unit_test.c
|
||||
+++ b/daemon/unit_test.c
|
||||
@@ -2139,102 +2139,7 @@ int test_dbengine(void)
|
||||
|
||||
errors += test_dbengine_check_metrics(st, rd, current_region, time_start[current_region]);
|
||||
|
||||
- current_region = 1; //this is the second region of data
|
||||
- update_every = REGION_UPDATE_EVERY[current_region]; // set data collection frequency to 3 seconds
|
||||
- // Align pages for frequency change
|
||||
- for (i = 0 ; i < CHARTS ; ++i) {
|
||||
- st[i]->update_every = update_every;
|
||||
- for (j = 0; j < DIMS; ++j) {
|
||||
- rrdeng_store_metric_flush_current_page((rd[i][j])->tiers[0].db_collection_handle);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- time_start[current_region] = time_end[current_region - 1] + update_every;
|
||||
- if (0 != time_start[current_region] % update_every) // align to update_every
|
||||
- time_start[current_region] += update_every - time_start[current_region] % update_every;
|
||||
- time_end[current_region] = test_dbengine_create_metrics(st,rd, current_region, time_start[current_region]);
|
||||
-
|
||||
- errors += test_dbengine_check_metrics(st, rd, current_region, time_start[current_region]);
|
||||
-
|
||||
- current_region = 2; //this is the third region of data
|
||||
- update_every = REGION_UPDATE_EVERY[current_region]; // set data collection frequency to 1 seconds
|
||||
- // Align pages for frequency change
|
||||
- for (i = 0 ; i < CHARTS ; ++i) {
|
||||
- st[i]->update_every = update_every;
|
||||
- for (j = 0; j < DIMS; ++j) {
|
||||
- rrdeng_store_metric_flush_current_page((rd[i][j])->tiers[0].db_collection_handle);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- time_start[current_region] = time_end[current_region - 1] + update_every;
|
||||
- if (0 != time_start[current_region] % update_every) // align to update_every
|
||||
- time_start[current_region] += update_every - time_start[current_region] % update_every;
|
||||
- time_end[current_region] = test_dbengine_create_metrics(st,rd, current_region, time_start[current_region]);
|
||||
-
|
||||
- errors += test_dbengine_check_metrics(st, rd, current_region, time_start[current_region]);
|
||||
-
|
||||
- for (current_region = 0 ; current_region < REGIONS ; ++current_region) {
|
||||
- errors += test_dbengine_check_rrdr(st, rd, current_region, time_start[current_region], time_end[current_region]);
|
||||
- }
|
||||
-
|
||||
- current_region = 1;
|
||||
- update_every = REGION_UPDATE_EVERY[current_region]; // use the maximum update_every = 3
|
||||
- long points = (time_end[REGIONS - 1] - time_start[0]) / update_every; // cover all time regions with RRDR
|
||||
- long point_offset = (time_start[current_region] - time_start[0]) / update_every;
|
||||
- for (i = 0 ; i < CHARTS ; ++i) {
|
||||
- ONEWAYALLOC *owa = onewayalloc_create(0);
|
||||
- RRDR *r = rrd2rrdr_legacy(owa, st[i], points, time_start[0] + update_every,
|
||||
- time_end[REGIONS - 1], RRDR_GROUPING_AVERAGE, 0,
|
||||
- RRDR_OPTION_NATURAL_POINTS, NULL, NULL, 0, 0,
|
||||
- QUERY_SOURCE_UNITTEST, STORAGE_PRIORITY_NORMAL);
|
||||
-
|
||||
- if (!r) {
|
||||
- fprintf(stderr, " DB-engine unittest %s: empty RRDR ### E R R O R ###\n", rrdset_name(st[i]));
|
||||
- ++errors;
|
||||
- } else {
|
||||
- long c;
|
||||
-
|
||||
- assert(r->internal.qt->request.st == st[i]);
|
||||
- // test current region values only, since they must be left unchanged
|
||||
- for (c = point_offset ; c < (long)(point_offset + rrdr_rows(r) / REGIONS / 2) ; ++c) {
|
||||
- RRDDIM *d;
|
||||
- time_t time_now = time_start[current_region] + (c - point_offset + 2) * update_every;
|
||||
- time_t time_retrieved = r->t[c];
|
||||
-
|
||||
- // for each dimension
|
||||
- rrddim_foreach_read(d, r->internal.qt->request.st) {
|
||||
- if(unlikely(d_dfe.counter >= r->d)) break; // d_counter is provided by the dictionary dfe
|
||||
-
|
||||
- j = (int)d_dfe.counter;
|
||||
-
|
||||
- NETDATA_DOUBLE *cn = &r->v[ c * r->d ];
|
||||
- NETDATA_DOUBLE value = cn[j];
|
||||
- assert(rd[i][j] == d);
|
||||
-
|
||||
- collected_number last = i * DIMS * REGION_POINTS[current_region] + j * REGION_POINTS[current_region] + c - point_offset + 1;
|
||||
- NETDATA_DOUBLE expected = unpack_storage_number(pack_storage_number((NETDATA_DOUBLE)last, SN_DEFAULT_FLAGS));
|
||||
-
|
||||
- uint8_t same = (roundndd(value) == roundndd(expected)) ? 1 : 0;
|
||||
- if(!same) {
|
||||
- if(!value_errors)
|
||||
- fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT
|
||||
- ", RRDR found " NETDATA_DOUBLE_FORMAT ", ### E R R O R ###\n",
|
||||
- rrdset_name(st[i]), rrddim_name(rd[i][j]), (unsigned long)time_now, expected, value);
|
||||
- value_errors++;
|
||||
- }
|
||||
- if(time_retrieved != time_now) {
|
||||
- if(!time_errors)
|
||||
- fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found RRDR timestamp %lu ### E R R O R ###\n",
|
||||
- rrdset_name(st[i]), rrddim_name(rd[i][j]), (unsigned long)time_now, (unsigned long)time_retrieved);
|
||||
- time_errors++;
|
||||
- }
|
||||
- }
|
||||
- rrddim_foreach_done(d);
|
||||
- }
|
||||
- rrdr_free(owa, r);
|
||||
- }
|
||||
- onewayalloc_destroy(owa);
|
||||
- }
|
||||
+ errors += test_dbengine_check_rrdr(st, rd, current_region, time_start[current_region], time_end[current_region]);
|
||||
|
||||
rrd_wrlock();
|
||||
rrdeng_prepare_exit((struct rrdengine_instance *)host->db[0].instance);
|
||||
@@ -2242,7 +2147,7 @@ int test_dbengine(void)
|
||||
rrdeng_exit((struct rrdengine_instance *)host->db[0].instance);
|
||||
rrd_unlock();
|
||||
|
||||
- return errors + value_errors + time_errors;
|
||||
+ return errors;
|
||||
}
|
||||
|
||||
struct dbengine_chart_thread {
|
||||
diff --git a/libnetdata/inlined.h b/libnetdata/inlined.h
|
||||
index 2697b9a..906b0dd 100644
|
||||
--- a/libnetdata/inlined.h
|
||||
+++ b/libnetdata/inlined.h
|
||||
@@ -236,6 +236,7 @@ static inline uint64_t str2uint64_base64(const char *src, char **endptr) {
|
||||
return num;
|
||||
}
|
||||
|
||||
+static NETDATA_DOUBLE str2ndd_parse_double_decimal_digits_internal(const char *src, int *digits) __attribute__((optimize(0)));
|
||||
static inline NETDATA_DOUBLE str2ndd_parse_double_decimal_digits_internal(const char *src, int *digits) {
|
||||
const char *s = src;
|
||||
NETDATA_DOUBLE n = 0.0;
|
||||
@@ -257,6 +258,7 @@ static inline NETDATA_DOUBLE str2ndd_parse_double_decimal_digits_internal(const
|
||||
return n;
|
||||
}
|
||||
|
||||
+static NETDATA_DOUBLE str2ndd(const char *src, char **endptr) __attribute__((optimize(0)));
|
||||
static inline NETDATA_DOUBLE str2ndd(const char *src, char **endptr) {
|
||||
const char *s = src;
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user