[pcp] PMNS scope globality
kenj at internode.on.net
Wed Apr 4 19:06:38 CDT 2012
On Wed, 2012-04-04 at 16:25 -0400, Frank Ch. Eigler wrote:
> Hi -
> Can someone explain how come PMNS data is stored in libpcp on a
> per-process basis (in libpcp/src/pmns.c:curr_pmns) rather than
> per-context? Does this not make it impossible to operate with
> different PMNS setups with different contexts, e.g. if one makes one
> connection to a remote server, and another to a local archive-v2 file?
OK Frank, brace yourself for some ancient history ...
In current versions of the protocols (aka with the distributed
namespace), for live use the only person to load the PMNS is pmcd and
pmcd is single-threaded and pmcd presents the _same_ PMNS to all clients
irrespective of the context they are using ... this one PMNS is loaded
and reloaded into the address space of pmcd as PMDAs come and go.
If a client calls pmLoadNameSpace (this is the old style and generally
does not happen these days outside QA), then there is a single PMNS that
is loaded and this is used for _all_ non-archive contexts ... so very
bizarre results may happen if you use more than one host context and
call pmLoadNameSpace() ... unless all the hosts have the same real
If the client does not call pmLoadNameSpace() and uses a local context
then the default PMNS is loaded when the context is created using the
same logic as the old style, i.e. the one global PMNS is setup for the
For an archive context there is one PMNS per archive (accessed via
ctxp->c_archctl->ac_log->l_pmns) ... this PMNS comes from the metadata
in the archive.
As a result curr_pmns is serving multiple purposes
- _the_ PMNS for pmcd
- _the_ PMNS for local contexts
- _the_ PMNS for all host contexts if pmLoadNameSpace() is explicitly
So the scenario you foreshadow does work ... with one PMNS from each the
remote pmcd context (in pmcd) and one PMNS for each archive context (in
I know this is a convoluted answer, the short verion is that for all
"normal" (tm) uses, there is one PMNS per context.
Hope this helps ... 8^)>
More information about the pcp