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

Fix rhui_alias resolution during cache flush [RHELDST-26143] #733

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

rohanpm
Copy link
Member

@rohanpm rohanpm commented Aug 13, 2024

It was intended to take RHUI aliases into account during cache flush, but this was not implemented correctly.

The main issue was that alias resolution was only implemented in the direction of (src => dest), but in the case of RHUI, we are always publishing content on the destination (non-RHUI) side of the alias. Hence we need to also consider the aliases in the (dest => src) direction to figure out that the src (RHUI) side of the alias is relevant for cache flush.

A second issue was that, if multiple aliases were involved in a path, we would not flush cache for all of them. This couldn't work because the uri_alias function was designed to return only a single value, after resolution of all aliases. When multiple aliases are in play, content is actually accessible at all the paths calculated during each step of the resolution, so we need to keep track of intermediate paths and flush cache for all of them.

This now behaves correctly in the typical case of both $releasever and RHUI aliases being in play, e.g. for /content/dist/rhel9/9/foo, it will now correctly calculate the 4 typical paths under which content is accessible:

  • /content/dist/rhel9/9/foo
  • /content/dist/rhel9/9.4/foo
  • /content/dist/rhel9/rhui/9/foo
  • /content/dist/rhel9/rhui/9.4/foo

It was intended to take RHUI aliases into account during cache flush,
but this was not implemented correctly.

The main issue was that alias resolution was only implemented in the
direction of (src => dest), but in the case of RHUI, we are always
publishing content on the destination (non-RHUI) side of the alias.
Hence we need to also consider the aliases in the (dest => src)
direction to figure out that the src (RHUI) side of the alias is
relevant for cache flush.

A second issue was that, if multiple aliases were involved in a path, we
would not flush cache for all of them. This couldn't work because the
uri_alias function was designed to return only a single value, after
resolution of all aliases. When multiple aliases are in play, content
is actually accessible at all the paths calculated during each step of
the resolution, so we need to keep track of intermediate paths and
flush cache for all of them.

This now behaves correctly in the typical case of both $releasever and
RHUI aliases being in play, e.g. for /content/dist/rhel9/9/foo, it will
now correctly calculate the 4 typical paths under which content is
accessible:

- /content/dist/rhel9/9/foo
- /content/dist/rhel9/9.4/foo
- /content/dist/rhel9/rhui/9/foo
- /content/dist/rhel9/rhui/9.4/foo
@rohanpm rohanpm marked this pull request as ready for review August 13, 2024 04:25
@rohanpm rohanpm merged commit e418e6e into release-engineering:master Aug 13, 2024
3 checks passed
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.

3 participants