Jira (PUP-10266) Environment cache should store previous versions of environments

11 views
Skip to first unread message

Maggie Dreyer (JIRA)

unread,
Feb 25, 2020, 1:09:04 PM2/25/20
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
 
Puppet / Bug PUP-10266
Environment cache should store previous versions of environments
Change By: Maggie Dreyer
Summary: Ensure environment Environment cache is not invalidated during a lockless deploy should store previous versions of environments
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Maggie Dreyer (JIRA)

unread,
Feb 25, 2020, 1:21:04 PM2/25/20
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
We Once we do PUP-10312 or introduce a workflow where the agent can otherwise request specific versions of environments, we need to ensure that an environment cache entry persists throughout an agent run.

The environment cache gets invalidated (in all JRubies/all threads) by Puppet Server when a DELETE request is sent to the {{environment_cache}} endpoint. File-sync hits this endpoint when it finishes doing a deploy, to ensure that Puppet will pick up the newest version of the code.

If we are not locking the JRuby pool anymore when this happens, there is the potential for agent runs to still be in progress that are using an existing version of the env. So we don't want to flush out that version until we're sure that it is no longer in use.

Furthermore, we want to be able to use the same caching mechanism when running both with and without versioned environments/lockless deploys, to avoid unnecessary conditional logic that will have to be ripped out later when we eventually stop supporting unversioned environments.

This will probably involve a restructure of the environment cache defined [here|https://github.com/puppetlabs/puppet/blob/master/lib/puppet/environments.rb#L304]. It is currently a mapping of {{<env name>}} to {{Environment}} objects. If we are going to support saving multiple versions, keying solely off of name is probably insufficient.

Ideas:
* overloaded versions of {{get}} that either take just the name (and return the "latest" env) or the name and desired version, and have the cache be a nested hash. The most recent version of the env should be stored both in a "latest" key so it can be used as a default, and under a key with its version.
* change the key to no longer just be the name, but perhaps a different string like the name and version concatenated, and keep the same internal data structure we have now. This requires that if an environment is cached without a version, nothing later will try to access it with a version, and vice versa.

Only places associated with an agent run are likely to need to know what version of the env to use. So it seems like the first option might be better, though this will also impact the {{get_conf}} family of methods, since they call through to {{get}}.

Nick Walker (Jira)

unread,
May 22, 2020, 2:01:04 PM5/22/20
to puppe...@googlegroups.com
Nick Walker updated an issue
Change By: Nick Walker
Epic Link: PE CODEMGMT - 26632 1270
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Maggie Dreyer (Jira)

unread,
Feb 5, 2021, 11:28:02 AM2/5/21
to puppe...@googlegroups.com

Maggie Dreyer (Jira)

unread,
Feb 5, 2021, 11:28:03 AM2/5/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages