This message was deleted.
# puppet-enterprise
s
This message was deleted.
c
Looks like the answer is that the fact count is only incremented for Hash entries: https://github.com/puppetlabs/puppet/blob/main/lib/puppet/configurer.rb#L197 No idea why Array entries aren't counted as well.
s
hmm. okay. so, that Hashes are counted at the top-level makes sense to me because I assumed it was to combat some bad PuppetDB-related performance issues with the fact path handling. e.g. a fact that is a Hash with thousands of entries creates thousands of fact paths based on the keys of the Hash but, afaik, Arrays don't do that
but what I don't understand is why Hashes in Arrays would count, if that is the case (as I don't think the Hash keys would contribute to fact paths in PuppetDB in that case). OR, perhaps you are right and Array entries of all types should count.
but the PE _packages fact is an array of arrays
so I always assumed arrays at the top-level were "safe"
c
The logic I linked above does iterate over arrays and recurse into any objects, it just doesn't increment the count if the Array entries are scalars --- which seems somewhat wrong. As far as I know, PuppetDB treats the array index as a fact path component -- so those are just as "expensive" as hashes.
s
for a bit of background, I tried to combat this warning when I saw it by converting my single fact that was a Hash with thousands of hash entries to an Array containing thousands of Hashes and I was a bit surprised when it didn't "solve" the problem
c
_packages
should be excluded. That data is popped out of the factset by PE and stored specially --- precisely to mitigate performance concerns from deeply nested paths.
s
ah, that does make a bit more sense then. hmm.
it isn't a huge deal, I can adjust puppet.conf on the one host where I see these (for a fact-heavy Puppet device mode run) but I can't fundamentally remove them.
c
_packages
is sort of the archetypical example of the sort of data that is risky to report as a fact: it can be large, it changes often, it has deeply nested data, it isn't really used in catalog compilation (if it is used, only a small percentage of the data reported is actually useful for config decisions). Because of that, PE has logic for storing it outside of the factset data.
s
makes sense. I knew there was some magic there, but never really dug into it.
still leaves me wondering why an array of scalars doesn't count toward the total tho
oversight or intentional design? the code doesn't provide insight there.
c
I'm not sure either. If my recollection is correct and scalars in Arrays still contribute to complexity in PuppetDB fact path storage --- then they should be counted.
j
@seanmil could you file a PUP ticket if you haven’t already?
s
@josh I haven't, but I can. ooc, what is the correct behavior there? should hashes in an array count or not?
and, also, should scalars in an array count?
@josh I got sidetracked last week, but issue created: PUP-11685