Jira (PUP-10650) Remove TypeSetType from RichData

8 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Aug 27, 2020, 7:04:02 PM8/27/20
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Task PUP-10650
Remove TypeSetType from RichData
Issue Type: Task Task
Assignee: Unassigned
Created: 2020/08/27 4:03 PM
Priority: Normal Normal
Reporter: Josh Cooper

The PTypeSetType class defines a namespace for a set of PCore types. Internally puppet uses PTypeSetType when registering all of the AST model classes. See
Puppet::Pops::Mode.register_pcore_types. At one point we considered serializing type information, for example the catalog could contain all of the rich data and the type information needed by the receiver to deserialize. However, the type information was too verbose. So when serializing, we just send the type names, e.g. Sensitive, and assume the receiver knows how to deserialize.

Commit 0a195ef6d6 defined RichData as:

        Variant[Scalar,SemVerRange,Binary,Sensitive,Type,TypeSet,Undef,Hash[RichDataKey,RichData],Array[RichData]]

The TypeSet above refers to the PTypeSetType class. The commit also changed the lookup DataProvider to accept all RichData. However, lookup also validates that the data it receives from the data provider contains only RichData. As a result, puppet could perform full type interference on the entire hash. That was optimized in PUP-10628, but it's based on a heuristic, detecting if the pcore_version key exists. There's no reason currently to include TypeSet in RichData, so we should remove that to avoid performance issues.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Aug 27, 2020, 7:04:03 PM8/27/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Labels: platform_7

Josh Cooper (Jira)

unread,
Aug 27, 2020, 7:04:03 PM8/27/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.0.0

Josh Cooper (Jira)

unread,
Aug 27, 2020, 7:25:04 PM8/27/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
The {{PTypeSetType}} class defines a namespace for a set of PCore types. Internally puppet uses {{PTypeSetType}} when registering all of the AST model classes. See
{{Puppet::Pops::Mode.register_pcore_types}}. At one point we considered serializing type information, for example the catalog could contain all of the rich data and the type information needed by the receiver to deserialize. However, the type information was too verbose.  So when serializing, we just send the type names, e.g. {{Sensitive}}, and assume the receiver knows how to deserialize.

Commit
[ 0a195ef6d6 |https://github.com/puppetlabs/puppet/commit/0a195ef6d6] defined {{RichData}} as:

{code:ruby}        Variant[Scalar,SemVerRange,Binary,Sensitive,Type,TypeSet,Undef,Hash[RichDataKey,RichData],Array[RichData]]
{code}

The {{TypeSet}} above refers to the {{PTypeSetType}} class. The commit also changed the lookup {{DataProvider}} to accept all {{RichData}}. However, lookup also validates that the data it receives from the data provider contains only {{RichData}}. As a result, puppet could perform full type interference on the entire hash. That was optimized in PUP-10628, but it's based on a heuristic, detecting if the {{pcore_version}} key exists. There's no reason currently to include {{TypeSet}} in {{RichData}}, so we should remove that to avoid performance issues.

Josh Cooper (Jira)

unread,
Aug 28, 2020, 1:32:03 AM8/28/20
to puppe...@googlegroups.com

Henrik Lindberg (Jira)

unread,
Aug 28, 2020, 8:04:02 AM8/28/20
to puppe...@googlegroups.com
Henrik Lindberg commented on Task PUP-10650
 
Re: Remove TypeSetType from RichData

See comments on the PR. Basically the instance? method on TypeSet should only accept a typeset instance and not use the default instance? version (in super) that first infers the type and then compares that against that against a target type.

Josh Cooper (Jira)

unread,
Sep 1, 2020, 12:30:03 PM9/1/20
to puppe...@googlegroups.com
Josh Cooper commented on Task PUP-10650

PUP-10628 will eliminate the type inference, so the presence of Type and TypeSet in RichData should not harm anything. If needed we can revisit restricting lookup keys and values to a subset of RichData.

Reply all
Reply to author
Forward
0 new messages