Commit Graph

862 Commits

Author SHA1 Message Date
Loïc Lecrenier
52b38bee9d Make rustfmt happy
>:-(
2022-11-08 15:45:53 +01:00
Loïc Lecrenier
f5454dfa60 Make clippy happy
They're a happy clip now.
2022-11-08 15:31:08 +01:00
Loïc Lecrenier
6126fc8d98 Rename original_query to original_filters everywhere 2022-11-08 13:18:18 +01:00
Loïc Lecrenier
20fa103992 Add canceledBy task filter 2022-11-08 13:18:18 +01:00
Loïc Lecrenier
d5638d2c27 Use more precise error codes/message for the task routes
+ Allow star operator in delete/cancel tasks
+ rename originalQuery to originalFilters
+ Display error/canceled_by in task view even when they are = null
+ Rename task filter fields by using their plural forms
+ Prepare an error code for canceledBy filter
+ Only return global tasks if the API key action `index.*` is there
2022-11-08 13:18:17 +01:00
Clément Renault
932414bf72 WIP Introduce the invalid_task_uid error code 2022-11-08 13:17:56 +01:00
Tamo
c9f89d38e3
Merge branch 'main' into index-swap-error-handling 2022-10-27 18:06:45 +02:00
bors[bot]
d16ea755d8
Merge #2982
2982: Adapt task queries to account for special index swap rules r=irevoire a=loiclec

# Pull Request

## Related issue
Fixes https://github.com/meilisearch/meilisearch/issues/2970 

## What does this PR do?
- Replace the `get_tasks` method with a `get_tasks_from_authorized_indexes` which returns the list of tasks matched by the query **from the point of view of the user**. That is, it takes into consideration the list of authorised indexes as well as the special case of `IndexSwap` which should not be returned if an index_uid is specified or if any of its associated indexes are not authorised.
- Adapt the code in other places following this change
- Add some tests
- Also the method `get_task_ids_from_authorized_indexes` now takes a read transaction as argument. This is because we want to make sure that the implementation of `get_tasks_from_authorized_indexes` only uses one read transaction. Otherwise, we could (1) get a list of task ids matching the query, then (2) one of these task ids is deleted by a taskDeletion task, and finally (3) we try to get the `Task`s associated with each returned task ids, and get a `CorruptedTaskQueue` error.



Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
2022-10-27 14:28:04 +00:00
Loïc Lecrenier
8dd7942656 Cargo fmt 2022-10-27 16:24:09 +02:00
Irevoire
4d9e9f4a9d
isolate the search in another task
In case there is a failure on milli's side that should avoid blocking the tokio main thread
2022-10-27 13:12:42 +02:00
Loïc Lecrenier
4f4fc20acf Make clippy happy 2022-10-27 13:00:30 +02:00
Loïc Lecrenier
78ffa00f98 Move index swap error handling from meilisearch-http to index-scheduler
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.
2022-10-27 11:45:38 +02:00
Loïc Lecrenier
7b93ba40bd Reimplement task queries to account for special index swap rules 2022-10-27 11:44:51 +02:00
Irevoire
6c2ecec4d0
fix the return of the task cancelation and task deletion 2022-10-27 11:35:23 +02:00
Irevoire
6280bd51a9
actually fix the test and the swap_indexes name resolution 2022-10-27 11:35:23 +02:00
Irevoire
3cf8aaa4d0
reformat 2022-10-27 11:35:23 +02:00
Kerollmops
0dd8e00929
Reapply #2601 2022-10-27 11:35:22 +02:00
Irevoire
a99ddf85f7
fix clippy once again 2022-10-27 11:35:22 +02:00
Irevoire
8ec3681cf8
fix clippy part1 2022-10-27 11:35:20 +02:00
Kerollmops
861a07792e
Remove useless task module 2022-10-27 11:35:20 +02:00
Kerollmops
ee6597da60
Fix all the tests 2022-10-27 11:35:20 +02:00
Loïc Lecrenier
e641d08846
Cargo fmt 2022-10-27 11:35:18 +02:00
Loïc Lecrenier
36c9f05998
Revert "Display more than one indexUid in a task view if necessary"
This reverts commit 1f2e253bb6.
2022-10-27 11:35:18 +02:00
Loïc Lecrenier
3b158bb966
Return invalid API key error in /swap-indexes 2022-10-27 11:35:18 +02:00
Loïc Lecrenier
08b5123380
Display more than one indexUid in a task view if necessary 2022-10-27 11:35:17 +02:00
Loïc Lecrenier
1f75caae88
Fix a few index swap bugs.
1. Details of the indexSwap task
2. Query tasks with type=indexUid
3. Synchronous error message for multiple index not found
2022-10-27 11:35:17 +02:00
Irevoire
a16604af80
fix all the tests 2022-10-27 11:35:17 +02:00
Irevoire
1d014a538e
comment out a test that makes the CI crash 2022-10-27 11:35:17 +02:00
Kerollmops
2f577b6fcd
Patch the IndexScheduler in meilisearch-http to use the options struct 2022-10-27 11:35:16 +02:00
Tamo
eccbdb74cf
remove useless print
Co-authored-by: Clément Renault <clement@meilisearch.com>
2022-10-27 11:35:16 +02:00
Irevoire
a85d5b4981
test the details of all tasks type 2022-10-27 11:35:16 +02:00
Kerollmops
4736e00253
Handle the CLI options related to snapshots 2022-10-27 11:35:15 +02:00
Kerollmops
942b7c338b
Compress the snapshot in a tarball 2022-10-27 11:35:15 +02:00
Kerollmops
4cafc63561
Reintroduce the versioning functions 2022-10-27 11:35:14 +02:00
Kerollmops
89e127e4f4
Declare the auth path in the index scheduler 2022-10-27 11:35:14 +02:00
Kerollmops
c063f154fb
Add the snapshots directory path to the IndexScheduler 2022-10-27 11:35:14 +02:00
Kerollmops
c641888a23
Patch the delete and cancel tasks routes 2022-10-27 11:35:13 +02:00
Irevoire
12669bf07c
rename received_documents_ids to matched_documents 2022-10-27 11:35:12 +02:00
Irevoire
0aca5e84b9
rename received_document_ids to matched_documents in the DocumentDeletion task type (reimplementation of #2826) 2022-10-27 11:35:12 +02:00
Irevoire
ecf4e43b3d
rename the dumpExport to dumpCreation 2022-10-27 11:35:10 +02:00
Irevoire
3ea489421e
move the error types to meilisearch-http 2022-10-27 11:35:10 +02:00
Loïc Lecrenier
2808be9d45
Fix the /swap-indexes route API
1. payload
2. error messages
3. auth errors
2022-10-27 11:35:10 +02:00
Irevoire
8a23e707c1
fix the task view and forward the task db size 2022-10-27 11:35:09 +02:00
Irevoire
735a5da257
reformat 2022-10-27 11:35:09 +02:00
Irevoire
e9055f5572
fix clippy 2022-10-27 11:35:08 +02:00
Irevoire
f6963f9662
ensure the indexUid is valid in most cases 2022-10-27 11:35:07 +02:00
Irevoire
b3265a8e1f
ensure the index_uid is valid when creating an index 2022-10-27 11:35:07 +02:00
Irevoire
cb48a02f94
fix the invalid index uid errors 2022-10-27 11:35:06 +02:00
Irevoire
99144b1419
fix most content file error 2022-10-27 11:35:06 +02:00
Irevoire
e107f1b282
fix the payload too large error 2022-10-27 11:35:06 +02:00