Jira (PUP-9371) Fix the confine caching to work at the provider level instead of the resource-instance level
Title: Message Title Enis Inan updated an issue Puppet / PUP-9371 Fix the confine caching to work at the provider level instead of the resource-instance level Change By: Enis Inan [Puppet::Confine.valid?|https://github.com/puppetlabs/puppet/blob/6.1.0/lib/puppet/confine.rb#L66-L78] ensures that any potentially cached values are reset after each call. We see this pattern in [Puppet::Confine::Variable|https://github.com/puppetlabs/puppet/blob/6.1.0/lib/puppet/confine/variable.rb#L38-L48]. Unfortunately, { { valid?} } is called for each resource instance per https://github.com/puppetlabs/puppet/blob/16220673acaa03f708f6b6410a659b4ba737ab7a/lib/puppet/graph/relationship_graph.rb#L115-L116 and https://github.com/puppetlabs/puppet/blob/16220673acaa03f708f6b6410a659b4ba737ab7a/lib/puppet/confiner.rb#L43-L45 so this would mean that cached values would get reset for every resource instance. Thus, they would not persist at the provider level (technically the provider-class level), which is undesirable and defeats the purpose of caching.We should re-architect how caching works for confinements so that it persists for the entire transaction instead of on every {{valid?}} call (i.e. instead of on a per-resource case). Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Jira (PUP-9371) Fix the confine caching to work at the provider level instead of the resource-instance level
Title: Message Title Enis Inan created an issue Puppet / PUP-9371 Fix the confine caching to work at the provider level instead of the resource-instance level Issue Type: Improvement Assignee: Unassigned Created: 2018/12/20 2:48 PM Priority: Normal Reporter: Enis Inan Puppet::Confine.valid? ensures that any potentially cached values are reset after each call. We see this pattern in Puppet::Confine::Variable. Unfortunately, {valid?} is called for each resource instance per https://github.com/puppetlabs/puppet/blob/16220673acaa03f708f6b6410a659b4ba737ab7a/lib/puppet/graph/relationship_graph.rb#L115-L116 and https://github.com/puppetlabs/puppet/blob/16220673acaa03f708f6b6410a659b4ba737ab7a/lib/puppet/confiner.rb#L43-L45 so this would mean that cached values would get reset for every resource instance. Thus, they would not persist at the provider level (technically the provider-class level), which is undesirable and defeats the purpose of caching. We should re-architect how caching works for confinements so that it persists for the entire transaction instead of on every valid? call (i.e. instead of on a per-resource case). Add Comment