pcp
[Top] [All Lists]

mark records in archive INTERP mode

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: mark records in archive INTERP mode
From: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Date: Tue, 1 Dec 2015 16:06:32 -0500
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mutt/1.4.2.2i
Hi -

Talking in context of pmrep and multi-archives, and browsing
random sources, I came across this bit in pmwebapi/pmgraphite.cxx,
done after a pmFetch on an archive in PM_MODE_INTERP.

assert ((size_t)result->numpmid == unique_pmids.size()); // PMAPI guarantee?

In other words, this asserts that pmFetch in INTERP mode never returns
MARK records.  I'm concerned that, just reading documentation or
skimming libpcp/src/interp.c, I can't tell whether this guarantee is
there or not.  The "mark record" term isn't in the man3 pages at all.

If the guarantee is real, we should document it; 
if the guarantee isn't real, it should still be documented,
   and pmwebd would need a patch like [attached]

- FChE



diff --git a/src/pmwebapi/pmgraphite.cxx b/src/pmwebapi/pmgraphite.cxx
index 8d8e0cdb407a..afbfa2fd13d3 100644
--- a/src/pmwebapi/pmgraphite.cxx
+++ b/src/pmwebapi/pmgraphite.cxx
@@ -1026,8 +1026,6 @@ void pmgraphite_fetch_series (fetch_series_jobspec *spec)
                             << result->vset[0]->numval << " ";
                 }
 
-                assert ((size_t)result->numpmid == unique_pmids.size()); // 
PMAPI guarantee?
-
                 // search them all for matching pmid/inst tuples
                 for (unsigned i=0; i<spec->targets.size(); i++) {
 
@@ -1037,7 +1035,8 @@ void pmgraphite_fetch_series (fetch_series_jobspec *spec)
                     x.what = nanf ("");        // initialize to a NaN
 
                     for (unsigned j=0; j<unique_pmids.size(); j++) { // for 
indexing over result->vset
-                        if (result->vset[j]->pmid != pmids[i])
+                        if (result->numpmid < (int)j || /* MARK record? */
+                            result->vset[j]->pmid != pmids[i])
                             continue;
 
                         for (int k=0; k<result->vset[j]->numval; k++) {

<Prev in Thread] Current Thread [Next in Thread>