Revert OL changes

This commit is contained in:
eabdullin 2024-09-20 14:39:57 +03:00
parent 36b34a2103
commit 37bc8623f0
2 changed files with 1 additions and 115 deletions

View File

@ -1,108 +0,0 @@
From f8dc87ed130a0cfe1077242a4da2d621c4016bfb Mon Sep 17 00:00:00 2001
From: Ken McDonell <kenj@kenj.id.au>
Date: Thu, 4 Apr 2024 11:34:41 +1100
Subject: [PATCH] libpcp: small derived metrics bug fix
This is a partial fix for
https://github.com/performancecopilot/pcp/issues/1921
If the operand has the semantics of PM_SEM_COUNTER and the
value goes backwards from one fetch to the next, then return
no values for rate().
There is QA to come, but this needs a final blessing from Oracle
before the reproducer archive can be included.
cherry-picked:- f8dc87ed130a0cfe1077242a4da2d621c4016bfb
[Orabug: 36538820]
Signed-off-by: sagar sagar <sagar.sagar@oracle.com>
---
man/man3/pmregisterderived.3 | 13 +++++++++----
src/libpcp/src/derive_fetch.c | 23 ++++++++++++++++++++++-
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/man/man3/pmregisterderived.3 b/man/man3/pmregisterderived.3
index d8719f373..32963c3b3 100644
--- a/man/man3/pmregisterderived.3
+++ b/man/man3/pmregisterderived.3
@@ -485,15 +485,20 @@ metric x with the dimension in the
.B time
domain decreased by one and scaling if required in the time utilization case
where the operand is in units of time, and the derived metric is unitless.
-This mimics the rate conversion applied to counter metrics by tools
+There is one value in the result
+for each instance that appears in both the current and the previous
+sample, except in the case where the metric x has
+the semantics of a counter, i.e. PM_SEM_COUNTER, and
+current value of an instance is smaller than the previous value
+of the same instance then no value is
+returned for this instance (this corresponds to a ``counter wrap'' or a ``counter reset'').
+These rules
+mimic the rate conversion applied to counter metrics by tools
such as
.BR pmval (1),
.BR pmie (1)
and
.BR pmchart (1).
-There is one value in the result
-for each instance that appears in both the current and the previous
-sample.
T}
_
instant(x) T{
diff --git a/src/libpcp/src/derive_fetch.c b/src/libpcp/src/derive_fetch.c
index 62921ece4..ed5f6ebcf 100644
--- a/src/libpcp/src/derive_fetch.c
+++ b/src/libpcp/src/derive_fetch.c
@@ -847,7 +847,13 @@ eval_expr(__pmContext *ctxp, node_t *np, struct timespec *stamp, int numpmid,
}
}
else {
- /* rate() conversion, type will be DOUBLE */
+ /*
+ * rate() conversion, type will be DOUBLE
+ *
+ * For COUNTER metrics, return "no value" if the counter is
+ * NOT monotonic increasing ... this matches what pmval(1)
+ * and pmie(1) do in the same circumstances.
+ */
struct timespec stampdiff;
stampdiff = np->data.info->stamp;
@@ -857,18 +863,33 @@ eval_expr(__pmContext *ctxp, node_t *np, struct timespec *stamp, int numpmid,
np->data.info->ivlist[k].value.d = (double)(np->left->data.info->ivlist[i].value.l - np->left->data.info->last_ivlist[j].value.l);
break;
case PM_TYPE_U32:
+ if (np->left->desc.sem == PM_SEM_COUNTER &&
+ np->left->data.info->ivlist[i].value.ul < np->left->data.info->last_ivlist[j].value.ul)
+ continue;
np->data.info->ivlist[k].value.d = (double)(np->left->data.info->ivlist[i].value.ul - np->left->data.info->last_ivlist[j].value.ul);
break;
case PM_TYPE_64:
+ if (np->left->desc.sem == PM_SEM_COUNTER &&
+ np->left->data.info->ivlist[i].value.ll < np->left->data.info->last_ivlist[j].value.ll)
+ continue;
np->data.info->ivlist[k].value.d = (double)(np->left->data.info->ivlist[i].value.ll - np->left->data.info->last_ivlist[j].value.ll);
break;
case PM_TYPE_U64:
+ if (np->left->desc.sem == PM_SEM_COUNTER &&
+ np->left->data.info->ivlist[i].value.ull < np->left->data.info->last_ivlist[j].value.ull)
+ continue;
np->data.info->ivlist[k].value.d = (double)(np->left->data.info->ivlist[i].value.ull - np->left->data.info->last_ivlist[j].value.ull);
break;
case PM_TYPE_FLOAT:
+ if (np->left->desc.sem == PM_SEM_COUNTER &&
+ np->left->data.info->ivlist[i].value.f < np->left->data.info->last_ivlist[j].value.f)
+ continue;
np->data.info->ivlist[k].value.d = (double)(np->left->data.info->ivlist[i].value.f - np->left->data.info->last_ivlist[j].value.f);
break;
case PM_TYPE_DOUBLE:
+ if (np->left->desc.sem == PM_SEM_COUNTER &&
+ np->left->data.info->ivlist[i].value.d < np->left->data.info->last_ivlist[j].value.d)
+ continue;
np->data.info->ivlist[k].value.d = np->left->data.info->ivlist[i].value.d - np->left->data.info->last_ivlist[j].value.d;
break;
default:
--
2.39.3

View File

@ -1,6 +1,6 @@
Name: pcp Name: pcp
Version: 6.2.0 Version: 6.2.0
Release: 5.0.1%{?dist} Release: 5%{?dist}
Summary: System-level performance monitoring and performance management Summary: System-level performance monitoring and performance management
License: GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0 License: GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
URL: https://pcp.io URL: https://pcp.io
@ -14,9 +14,6 @@ Patch4: redhat-issues-RHEL-57799-pmpost-symlink-handling.patch
Patch5: redhat-issues-RHEL-34586-pmproxy-pmcd-fd-leak.patch Patch5: redhat-issues-RHEL-34586-pmproxy-pmcd-fd-leak.patch
Patch6: redhat-issues-RHEL-57788-pmdahacluster-update.patch Patch6: redhat-issues-RHEL-57788-pmdahacluster-update.patch
#Oracle patches
Patch1001: 1001-libpcp-small-derived-metrics-bug-fix.patch
%if 0%{?fedora} >= 40 || 0%{?rhel} >= 10 %if 0%{?fedora} >= 40 || 0%{?rhel} >= 10
ExcludeArch: %{ix86} ExcludeArch: %{ix86}
@ -3501,9 +3498,6 @@ fi
%files zeroconf -f pcp-zeroconf-files.rpm %files zeroconf -f pcp-zeroconf-files.rpm
%changelog %changelog
* Thu Sep 19 2024 EL Errata <el-errata_ww@oracle.com> - 6.2.0-5.0.1
- Fixed libpcp derived metric issue for ol9 [Orabug: 36538820]
* Tue Sep 17 2024 Nathan Scott <nathans@redhat.com> - 6.2.0-5 * Tue Sep 17 2024 Nathan Scott <nathans@redhat.com> - 6.2.0-5
- Fix buffer sizing checks in pmstore PDU handling (RHEL-57805) - Fix buffer sizing checks in pmstore PDU handling (RHEL-57805)
- Guard against symlink attacks in pmpost program (RHEL-57810) - Guard against symlink attacks in pmpost program (RHEL-57810)