Question
· Dec 14, 2017

%SYS.Namespace.ListAll reports one namespace twice

Today %SYS.Namespace.ListAll started to report one namespace, for example USER, two times: once as "USER" and once as USER's database "^^c:\databases\user".

Details: my Cache instance has  50+ local namespaces. Today I have "touched" 3 of them (imported new classes), and now ListAll reports each of these 3 twice. Looks like ListAll is the only one who sees those strange duplicates, in all other places (Portal, Studio) only USER is shown.

Can someone explain what is happening?

Discussion (9)2
Log in or sign up to continue

John,

  • There were no changes neither to ns configuration nor to db configuration.
  • Looks like ns gets its twin as soon as updated routines are imported into this namespace.
  • The issue happens on production db only, we can't repeat it on test databases of same version.

If I see your explanations right, the issue is just a harmless result of some internal Cache's behaviour, so I should not really care, right? 

"^^c:\databases\user" is an implied namespace based on the directory name. 

You can enter an implied namespace yourself by issuing something like >ZN "^^"_$ZU(12,"USER")

Once you have entered an implied namespace, it looks like it appears in the array returned by ListAll()

I suspect that if you load classes, routines or globals in the Management Portal and choose "Database" instead of "Namespace" in the Explorer that you will then be making use of an implied namespace.

As noted by Keith Avery in his comment, the ListAll classmethod of %SYS.Namespace may also include implicit namespaces. This is mentioned in the class doc. I haven't verified, but I guess that you may get different results from ListAll() if you run it once immediately after Cache startup and again after Portal has been used to change namespace definitions (e.g. mappings).

ListAll() is implemented using calls to the undocumented $ZUTIL(90) function. I dug up some WRC information we received in 2010 about a change in behaviour in that function starting with Caché 2010.2. The summary was:

SML1081 - Support single namespace activation and reduce usage of mapping memory.