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

Check filtered index feature flag before querying in SearchContext #2408

Merged
merged 3 commits into from
Jun 15, 2023

Conversation

sarayourfriend
Copy link
Collaborator

Fixes

Fixes #2407 by @sarayourfriend

Description

Checks the feature flag before querying the filtered index.

Testing Instructions

First, confirm you know how to reproduce the issue on main. Checkout main and update api/env to set ENABLE_FILTERED_INDEX_QUERIES=False to match the live environment configuration. Next, delete the image-filtered alias in your local Elasticsearch cluster:

$ curl -X DELETE http://0.0.0.0:50292/image-init-filtered/_alias/image-filtered

Confirm the index is deleted by sending:

$ curl http://0.0.0.0:50292/image-init-filtered/_alias

And confirm the response matches (empty aliases object):

{"image-init-filtered":{"aliases":{}}}

Now make a request to http://localhost:50280/v1/images/ and confirm you get a 500 about image-filtered not existing.

Now, check out this branch and just down && just api/up and make the same http://localhost:50280/v1/images/ request again, and you should no longer have the 500, just a successful image search.

Confirm the additional unit test sufficiently covers the changes.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • [N/A] I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend requested a review from a team as a code owner June 15, 2023 04:49
@sarayourfriend sarayourfriend requested review from obulat and dhruvkb June 15, 2023 04:49
@github-actions github-actions bot added the 🧱 stack: api Related to the Django API label Jun 15, 2023
@openverse-bot openverse-bot added 🟥 priority: critical Must be addressed ASAP 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository labels Jun 15, 2023
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well locally, and the changes make sense.

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phenomenal test instructions. Was able to reproduce the issue on main easily and the PR fixed the problem as described.

❯ curl -X DELETE http://0.0.0.0:50292/image-init-filtered/_alias/image-filtered
{"acknowledged":true}%

❯ curl http://0.0.0.0:50292/image-init-filtered/_alias
{"image-init-filtered":{"aliases":{}}}%
CleanShot 2023-06-15 at 08 21 50@2x

and then:

CleanShot 2023-06-15 at 08 23 00@2x

@zackkrida zackkrida merged commit dd45893 into main Jun 15, 2023
@zackkrida zackkrida deleted the fix/check-feature-flag-search-context branch June 15, 2023 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SearchContext::build does not check filtered index feature flag before querying filtered indexes
4 participants