Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Vegur's dynamic config relup-safe #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ferd
Copy link
Contributor

@ferd ferd commented Oct 11, 2018

When upgrading a release through a relup, the SASL release_handler
process goes through the application's config, and resets all of those
of currently running applications. The new value is based off, in order:

  1. command line arguments
  2. the values found in the current (new) sys.config
  3. the values found in the .app file's env tuple

All the values that were added and changed dynamically are dropped.

This changeset forces a separation between dynamic and static
configuration values. Static configuration values are set in the
'vegur' app and can be changed by sys.config and others. Dynamic
configuration values are set in the 'vegur_dynamic' app name -- since no
such app exists, they are safely ignored by SASL.

To keep the change backwards compatible for all usages, this patch
therefore makes a two-tiered config lookup:

  • check if a dynamic value exists at first (it has been set dynamically
    somewhere and is therefore important)
  • if it is not found, look for the static one that is a safe immutable
    (per version) default to use.

This may come at a slight performance hit (two lookups instead of one)
for some static values, but this has never been a bottleneck compared to
say, CamelCasing headers, and without this change, no live code upgrades
with relups can be performed in a system relying on vegur.

When upgrading a release through a relup, the SASL release_handler
process goes through the application's config, and resets all of those
of currently running applications. The new value is based off, in order:

1. command line arguments
2. the values found in the current (new) sys.config
3. the values found in the .app file's env tuple

All the values that were added and changed dynamically are dropped.

This changeset forces a separation between dynamic and static
configuration values. Static configuration values are set in the
'vegur' app and can be changed by sys.config and others. Dynamic
configuration values are set in the 'vegur_dynamic' app name -- since no
such app exists, they are safely ignored by SASL.

To keep the change backwards compatible for all usages, this patch
therefore makes a two-tiered config lookup:

- check if a dynamic value exists at first (it has been set dynamically
  somewhere and is therefore important)
- if it is not found, look for the static one that is a safe immutable
  (per version) default to use.

This may come at a slight performance hit (two lookups instead of one)
for some static values, but this has never been a bottleneck compared to
say, CamelCasing headers, and without this change, no live code upgrades
with relups can be performed in a system relying on vegur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant