Skip to content

Conversation

@joelanford
Copy link
Member

Description of the change:

This commit refactors the registry.Querier load behavior such that:

  1. If any error occurs creating a Querier, any necessary cleanup happens and a nil Querier is returned.
  2. Querier.Close checks for a nil cache before attempting a close of the Querier's underlying cache.

Motivation for the change:

When certain errors occur loading a registry.Querier, it is possible for a Querier to be returned with a nil cache. This causes a panic when Close is later called on the Querier.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci openshift-ci bot requested review from anik120 and jmrodri January 3, 2023 01:50
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelanford

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 3, 2023
When certain errors occur loading a registry.Querier, it is possible for
a Querier to be returned with a nil cache. This causes a panic when
Close is later called on the Querier.

This commit refactors the behavior such that:
1. If any error occurs creating a Querier, any necessary cleanup happens
   and a nil Querier is returned.
2. Querier.Close checks for a nil cache before attempting a close of the
   Querier's underlying cache.

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Merging #1049 (e266ee6) into master (0080ea0) will increase coverage by 0.11%.
The diff coverage is 78.57%.

@@            Coverage Diff             @@
##           master    #1049      +/-   ##
==========================================
+ Coverage   52.06%   52.17%   +0.11%     
==========================================
  Files         102      102              
  Lines        9218     9246      +28     
==========================================
+ Hits         4799     4824      +25     
- Misses       3505     3511       +6     
+ Partials      914      911       -3     
Impacted Files Coverage Δ
pkg/registry/query.go 63.42% <78.57%> (+1.93%) ⬆️
alpha/declcfg/load.go 76.52% <0.00%> (-2.13%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@joelanford
Copy link
Member Author

Closing this one out. I'm taking at stab at #1050, and that work renders this change obsolete.

@joelanford joelanford closed this Jan 14, 2023
@joelanford joelanford mentioned this pull request Jan 16, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant