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

Specifying more than one index that do not exist during a swap operation does not return the variant message of index_not_found returning the list of non-existent indexes. #2973

Closed
gmourier opened this issue Oct 26, 2022 · 5 comments · Fixed by #2976
Assignees
Labels
bug Something isn't working as expected v0.30.0 PRs/issues solved in v0.30.0 released on 2022-11-28
Milestone

Comments

@gmourier
Copy link
Member

Describe the bug

Specifying more than an index that does not exist during a swap operation does not return the variant of index_not_found returning the list of non-existent indexes.

To Reproduce

Try to exchange several indexes that do not exist.

Query

POST- swap-indexes

test2 and test do not exist.

[
    {
        "swap": ["test2", "test"]
    }
]

Task error

The asynchronous error is using the variant for a single missing index.

"error": {
                "message": "Index `test2` not found.",
                "code": "index_not_found",
                "type": "invalid_request",
                "link": "https://docs.meilisearch.com/errors#index_not_found"
 },

Expected behavior

I should receive the message variant listing the indexes that do not exist.

"error": {
                "message": "Indexes `test2`, `test` not found.",
                "code": "index_not_found",
                "type": "invalid_request",
                "link": "https://docs.meilisearch.com/errors#index_not_found"
 },

Meilisearch version: v0.30.0-new-index-scheduler.beta.1

@gmourier gmourier added the bug Something isn't working as expected label Oct 26, 2022
@loiclec
Copy link
Contributor

loiclec commented Oct 26, 2022

Thanks for the bug report. The problem is that the error happens asynchronously at all. I am on it :)

@loiclec loiclec self-assigned this Oct 26, 2022
@gmourier
Copy link
Member Author

Thanks @loiclec !

@loiclec
Copy link
Contributor

loiclec commented Oct 27, 2022

My bad, I have just realised the error should indeed be asynchronous, since we can't know whether the index exists before the index swap is actually processed (there might be an index creation task sent in between the register of the index swap and its processing!). I made a new PR to fix it: https://github.com/meilisearch/meilisearch/compare/index-scheduler...index-swap-error-handling?expand=1

@curquiza
Copy link
Member

Fixed by #2763

@Kerollmops Kerollmops reopened this Oct 27, 2022
@Kerollmops
Copy link
Member

Kerollmops commented Oct 27, 2022

Will be fixed appropriately by #2981

bors bot added a commit that referenced this issue Oct 27, 2022
2981: Move index swap error handling from meilisearch-http to index-scheduler r=irevoire a=loiclec

And make index_not_found error asynchronous, since we can't know whether the index will exist by the time the index swap task is processed.

Improve the index-swap test to verify that future tasks are not swapped and to test the new error messages that were introduced.

## Related issue
#2973


2996: Get rids of the unecessary tasks when an index_uid is specified r=Kerollmops a=irevoire



Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
Co-authored-by: Tamo <tamo@meilisearch.com>
Co-authored-by: Irevoire <tamo@meilisearch.com>
@loiclec loiclec closed this as completed Nov 8, 2022
@meili-bot meili-bot added the v0.30.0 PRs/issues solved in v0.30.0 released on 2022-11-28 label Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected v0.30.0 PRs/issues solved in v0.30.0 released on 2022-11-28
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants