Skip to content

Commit 3c52b44

Browse files
bors[bot]dichotommymaryamsulemani97
authored
Merge #1752
1752: v0.28 dumps r=maryamsulemani97 a=dichotommy Changes related to the dump API in v0.28. For a full description of these changes, see the [associated issue](#1703). To do: - [ ] Fix links (only if necessary for merge, as the links are not actually broken, just dependent on changes made in another PR) Co-authored-by: Tommy Melvin <[email protected]> Co-authored-by: Tommy <[email protected]> Co-authored-by: Maryam <[email protected]> Co-authored-by: Maryam Sulemani <[email protected]>
2 parents 45b5f82 + edb981a commit 3c52b44

File tree

8 files changed

+80
-116
lines changed

8 files changed

+80
-116
lines changed

.code-samples.meilisearch.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,6 @@ faceted_search_walkthrough_filter_1: |-
678678
post_dump_1: |-
679679
curl \
680680
-X POST 'http://localhost:7700/dumps'
681-
get_dump_status_1: |-
682-
curl \
683-
-X GET 'http://localhost:7700/dumps/20201101-110357260/status'
684681
phrase_search_1: |-
685682
curl \
686683
-X POST 'http://localhost:7700/indexes/movies/search' \
@@ -930,11 +927,6 @@ updating_guide_create_dump: |-
930927
curl \
931928
-X POST 'http://localhost:7700/dumps' \
932929
-H 'Authorization: Bearer API_KEY'
933-
updating_guide_get_dump_status: |-
934-
# replace {dump_uid} with the uid returned by the previous command
935-
curl \
936-
-X GET 'http://localhost:7700/dumps/{dump_uid}/status' \
937-
-H 'Authorization: Bearer API_KEY'
938930
updating_guide_get_settings_old: |-
939931
# the -o option saves the output as a local file
940932
curl \

.vuepress/public/sample-template.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ faceted_search_facets_distribution_1: |-
9696
faceted_search_walkthrough_filter_1: |-
9797
add_movies_json_1: |-
9898
post_dump_1: |-
99-
get_dump_status_1: |-
10099
phrase_search_1: |-
101100
sorting_guide_update_sortable_attributes_1: |-
102101
sorting_guide_update_ranking_rules_1: |-
@@ -142,7 +141,6 @@ updating_guide_get_displayed_attributes_old: |-
142141
updating_guide_reset_displayed_attributes_old: |-
143142
updating_guide_reset_displayed_attributes_new: |-
144143
updating_guide_create_dump: |-
145-
updating_guide_get_dump_status: |-
146144
updating_guide_get_settings_old: |-
147145
updating_guide_retrieve_documents_old: |-
148146
updating_guide_update_settings_old: |-

learn/advanced/asynchronous_operations.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Currently, these are Meilisearch's asynchronous operations:
1717
- Adding documents to an index
1818
- Updating documents in an index
1919
- Deleting documents from an index
20-
- [Creating a dump](#dumps)
20+
- Creating a dump
2121

2222
## Understanding tasks
2323

@@ -27,32 +27,32 @@ All of Meilisearch's asynchronous operations belong to a category called "tasks"
2727

2828
The response from the [task API](/reference/api/tasks.md) will always include the following fields in the stated order:
2929

30-
| Field | Type | Description |
31-
|--------------|---------|----------------------------------------------------------------------------------------------|
32-
| `uid` | integer | The unique sequential identifier of the task |
33-
| `indexUid` | string | The unique index identifier |
34-
| `status` | string | The status of the task. Possible values are `enqueued`, `processing`, `succeeded`, `failed` |
35-
| `type` | string | The type of task. Possible values are `indexCreation`, `indexUpdate`, `indexDeletion`, `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate` |
36-
| `details` | object | Detailed information on the task payload |
37-
| `error` | object | Error details and context. Only present when a task has the `failed` status |
38-
| `duration` | string | The total elapsed time the task spent in the `processing` state, in ISO 8601 format |
39-
| `enqueuedAt` | string | The date and time when the task was first `enqueued`, in RFC 3339 format |
40-
| `startedAt` | string | The date and time when the task began `processing`, in RFC 3339 format |
41-
| `finishedAt` | string | The date and time when the task finished processing, whether `failed` or `succeeded`, in RFC 3339 format. |
30+
| Field | Type | Description |
31+
|--------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------|
32+
| `uid` | integer | The unique sequential identifier of the task |
33+
| `indexUid` | string | The unique index identifier (always `null` for dumps) |
34+
| `status` | string | The status of the task. Possible values are `enqueued`, `processing`, `succeeded`, `failed` |
35+
| `type` | string | The type of task. Possible values are `indexCreation`, `indexUpdate`, `indexDeletion`, `documentAdditionOrUpdate`, `documentPartial`, `documentDeletion`, `settingsUpdate`, `clearAll`, `dumpCreation` |
36+
| `details` | object | Detailed information on the task payload |
37+
| `error` | object | Error details and context. Only present when a task has the `failed` status |
38+
| `duration` | string | The total elapsed time the task spent in the `processing` state, in ISO 8601 format |
39+
| `enqueuedAt` | string | The date and time when the task was first `enqueued`, in RFC 3339 format |
40+
| `startedAt` | string | The date and time when the task began `processing`, in RFC 3339 format |
41+
| `finishedAt` | string | The date and time when the task finished processing, whether `failed` or `succeeded`, in RFC 3339 format. |
4242

4343
If a task fails due to an error, all error fields will be appended to the task response in an `error` object.
4444

4545
### Summarized task objects
4646

4747
All asynchronous operations return a summarized version of [the full `task` object](#task-api-response). It contains the following fields in the stated order:
4848

49-
| Field | Type | Description |
50-
|--------------|---------|---------------------------------------------------------------------------------------|
51-
| `taskUid` | integer | Unique sequential identifier |
52-
| `indexUid` | string | Unique index identifier |
53-
| `status` | string | Status of the task. Value is `enqueued` |
54-
| `type` | string | Type of task |
55-
| `enqueuedAt` | string | Represents the date and time in the RFC 3339 format when the task has been `enqueued` |
49+
| Field | Type | Description |
50+
|------------|---------|--------------------------------- |
51+
| `uid` | integer | Unique sequential identifier |
52+
| `indexUid` | string | Unique index identifier (always `null` for dumps) |
53+
| `status` | string | Status of the task. Value is `enqueued` |
54+
| `type` | string | Type of task |
55+
| `enqueuedAt` | string | Represents the date and time in the RFC 3339 format when the task has been `enqueued` |
5656

5757
You can use this `taskUid` to get more details on [the status of the task](/reference/api/tasks.md#get-one-task).
5858

@@ -139,11 +139,7 @@ Had the task failed, the response would have included an `error` object:
139139
3. Once the task has completed processing, Meilisearch marks it as `succeeded`, if it was successful, or `failed`, if there was an error.
140140
4. Tasks marked as `succeeded` or `failed` are not deleted and will remain visible in [the task list](/reference/api/tasks.md#get-tasks)
141141

142-
### Dumps
143-
144-
While dumps and tasks are both asynchronous operations, they use separate queues and behave differently. For instance, creating a new dump will freeze the task queue until the dump has been generated.
145-
146-
[You can read more about dumps in our dedicated guide.](/learn/advanced/dumps.md)
142+
Tasks are processed in the order they were enqueued, with one exception: `dumpCreation`. Dumps are prioritized over all other tasks in the queue. Their task `uid` still reflects when they were enqueued relative to other tasks.
147143

148144
## Terminate Meilisearch while a task is being processed
149145

learn/advanced/dumps.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,61 @@
11
# Dumps
22

3-
A dump is a compressed file containing an export of your Meilisearch instance. It contains all your indexes, documents, and settings, but in a raw unprocessed form. A dump isn't an exact copy of your database—it is closer to a blueprint that allows you to create an identical dataset. A dump can be imported when launching Meilisearch, but be advised that it may take some time to index all the documents within.
3+
A dump is a compressed file containing an export of your Meilisearch instance. It contains all your indexes, documents, and settings, but in a raw unprocessed form. A dump isn't an exact copy of your database—it is closer to a blueprint that allows you to create an identical dataset.
4+
5+
A dump can be imported when launching Meilisearch, but be advised that it may take some time to index.
46

57
## Creating a dump
68

79
To create a dump of your dataset, you need to use the appropriate HTTP route: [`POST /dumps`](/reference/api/dump.md#create-a-dump). The dump creation process is an asynchronous task that takes time proportional to the size of your dataset.
810

911
<CodeSamples id="post_dump_1" />
1012

11-
The above code triggers a dump creation process. It also returns an object containing information about the dump:
13+
The above code triggers a dump creation process. It also returns a [summarized task object](/learn/advanced/asynchronous_operations.md#summarized-task-objects) that you can use to check the status of your dump.
1214

13-
```
15+
```json
1416
{
15-
"uid": "20200929-114144097",
16-
"status": "in_progress",
17-
"startedAt": "2020-09-29T11:41:44.392327Z"
17+
"taskUid": 1,
18+
"indexUid": null,
19+
"status": "enqueued",
20+
"type": "dumpCreation",
21+
"enqueuedAt": "2022-06-21T16:10:29.217688Z"
1822
}
1923
```
2024

21-
You can use the returned `uid` (unique identifier indicating when the dump was triggered) to track its progress with the [get dump status route](/reference/api/dump.md#get-dump-status). The returned status could be:
22-
23-
- `in_progress`: Dump creation is in progress
24-
- `failed`: An error occurred during dump process, and the task was aborted
25-
- `done`: Dump creation is finished and was successful
25+
In the below command, replace `1` with the `taskUid` returned by the previous command.
2626

27-
<CodeSamples id="get_dump_status_1" />
27+
<CodeSamples id="get_task_1" />
2828

29-
The above code sample returns an object with the following details about the dump:
29+
This command should return an object with detailed information about the dump operation:
3030

31-
```
31+
```json
3232
{
33-
"uid": "20200929-114144097",
34-
"status": "done",
35-
"startedAt": "2020-09-29T11:41:44.392327Z",
36-
"finishedAt": "2020-09-29T11:41:50.792147Z"
33+
"uid": 1,
34+
"indexUid": null,
35+
"status": "succeeded",
36+
"type": "dumpCreation",
37+
"details": {
38+
"dumpUid": "20220621-161029217"
39+
},
40+
"duration": "PT0.025872S",
41+
"enqueuedAt": "2022-06-21T16:10:29.217688Z",
42+
"startedAt": "2022-06-21T16:10:29.218297Z",
43+
"finishedAt": "2022-06-21T16:10:29.244169Z"
3744
}
3845
```
3946

40-
After dump creation is finished, the dump file is added to the dump directory. By default, this folder is named `dumps` and can be found in the same directory as your Meilisearch binary. You can customize [this using the `--dumps-dir` configuration option](/learn/configuration/instance_options.md#dumps-destination). **If the dump directory does not already exist when the dump creation process is called, Meilisearch will create it.**
47+
After dump creation is finished—when `status` is `succeeded`the dump file is added to the dump directory. By default, this folder is named `dumps` and can be found in the same directory as your Meilisearch binary. You can customize [this using the `--dumps-dir` configuration option](/learn/configuration/instance_options.md#dumps-destination). **If the dump directory does not already exist when the dump creation process is called, Meilisearch will create it.**
4148

4249
If a dump file is visible in the file system, the dump process was successfully completed. **Meilisearch will never create a partial dump file**, even if you interrupt an instance while it is generating a dump.
4350

44-
::: note
45-
Unlike [tasks](/learn/advanced/asynchronous_operations.md), dumps have no queue. **Meilisearch only processes one dump at a time.** If you attempt to create a dump while another dump is still processing, Meilisearch will throw an [error](/reference/api/error_codes.md#dump-already-processing).
46-
47-
Meilisearch does not process tasks during dump creation, but you can still add new requests to the task queue. This is also true for [snapshots](/learn/advanced/snapshots.md#snapshots).
48-
:::
49-
50-
::: warning
51-
If you restart Meilisearch after creating a dump, you will not be able to use the dumps endpoint to find out that dump's `status`. This has no effect on the dump file itself.
52-
:::
53-
5451
## Importing a dump
5552

5653
When a dump is being imported, the API is not available to the task queue. As a result, no read or write operations can be performed until the importing process is complete.
5754

58-
Dumps in v0.20.0 and below are no longer compatible with the new versions. Before you start importing, check your [Meilisearch version](/reference/api/version.md#example) and proceed accordingly.
55+
Dumps from v0.20.0 and below are no longer compatible with the new versions. Before you start importing, check your [Meilisearch version](/reference/api/version.md#example) and proceed accordingly.
5956

6057
::: note
61-
We do not recommend using dumps from a new Meilisearch version to import an older version.
58+
We do not recommend using dumps to migrate from a new Meilisearch version to an older one.
6259

6360
For example, you can import a dump from Meilisearch v0.21 into v0.22 without any problems. Importing a dump generated in v0.22 into a v0.21 instance, however, can lead to unexpected behavior.
6461
:::
@@ -79,4 +76,4 @@ If you are using Meilisearch v0.20 or below, migration should be done in two ste
7976

8077
## Use cases
8178

82-
Dumps are used to restore your database after [updating Meilisearch](/learn/advanced/updating.md) or to copy your database to other Meilisearch instances without having to worry about their respective versions.
79+
Dumps are used to restore your database after [updating Meilisearch](/learn/advanced/updating.md) or to copy your database to other Meilisearch instances without having to worry about their respective versions. For more on this subject, see a [comparison of snapshots and dumps](/learn/advanced/snapshots_vs_dumps.md).

learn/advanced/updating.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,31 @@ The server should return a response that looks like this:
206206

207207
```json
208208
{
209-
"uid": "20210212-151153878",
210-
"status": "in_progress",
211-
"startedAt": "2021-02-12T15:11:53.402327Z"
209+
"taskUid": 1,
210+
"indexUid": null,
211+
"status": "enqueued",
212+
"type": "dumpCreation",
213+
"enqueuedAt": "2022-06-21T16:10:29.217688Z"
212214
}
213215
```
214216

215-
This process can take some time. Since dump creation is an [asynchronous operation](/learn/advanced/asynchronous_operations.md), you can use the returned `uid` to [track its status](/reference/api/dump.md#get-dump-status).
217+
This command returns a `taskUid`. You can use this to [track the status](/reference/api/tasks.md#get-one-task) of your dump. Keep in mind that the process can take some time to complete.
216218

217-
<CodeSamples id="updating_guide_get_dump_status" />
218-
219-
Once the response to the previous command looks like this (`"status": "done"`), move on.
219+
Once the `dumpCreation` task shows `"status": "succeeded"`, you're ready to move on.
220220

221221
```json
222222
{
223-
"uid": "20200929-114144097",
224-
"status": "done",
225-
"startedAt": "2020-09-29T11:41:44.392327Z",
226-
"finishedAt": "2020-09-29T11:41:50.792147Z"
223+
"uid": 1,
224+
"indexUid": null,
225+
"status": "succeeded",
226+
"type": "dumpCreation",
227+
"details": {
228+
"dumpUid": "20220621-161029217"
229+
},
230+
"duration": "PT0.025872S",
231+
"enqueuedAt": "2022-06-21T16:10:29.217688Z",
232+
"startedAt": "2022-06-21T16:10:29.218297Z",
233+
"finishedAt": "2022-06-21T16:10:29.244169Z"
227234
}
228235
```
229236

reference/api/dump.md

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ Creating a dump is also referred to as exporting it, whereas launching Meilisear
66

77
During a [dump export](/reference/api/dump.md#create-a-dump), all indexes of the current instance are exported—together with their documents and settings—and saved as a single `.dump` file.
88

9-
During a dump import, all indexes contained in the indicated `.dump` file are imported along with their associated documents and settings. Any existing index with the same uid as an index in the dump file will be overwritten.
9+
During a dump import, all indexes contained in the indicated `.dump` file are imported along with their associated documents and settings. Any existing index with the same `uid` as an index in the dump file will be overwritten.
1010

1111
Dump imports must be performed when launching a Meilisearch instance [using the `import-dump` command-line option](/learn/configuration/instance_options.md#import-dump).
1212

13+
[Learn more about dumps](/learn/advanced/dumps.md).
14+
1315
## Create a dump
1416

1517
<RouteHighlighter method="POST" route="/dumps"/>
1618

17-
Triggers a dump creation process. Once the process is complete, a dump is created in the [dumps directory](/learn/configuration/instance_options.md#dumps-destination). If the dumps directory does not exist yet, it will be created.
19+
Triggers a dump creation task. Once the process is complete, a dump is created in the [dumps directory](/learn/configuration/instance_options.md#dumps-destination). If the dumps directory does not exist yet, it will be created.
1820

19-
**Meilisearch only processes one dump at a time.** If you attempt to create a dump while another dump is still processing, Meilisearch will throw a [`dump_already_processing` error](/reference/api/error_codes.md#dump-already-processing).
21+
Dump tasks take priority over all other tasks in the queue. This means that a newly created dump task will be processed as soon as the current task is finished.
2022

21-
The task queue will not process any further tasks during dump creation, but you can still add new requests to the queue.
23+
[Learn more about asynchronous operations](/learn/advanced/asynchronous_operations.md).
2224

2325
### Example
2426

@@ -28,35 +30,12 @@ The task queue will not process any further tasks during dump creation, but you
2830

2931
```json
3032
{
31-
"uid": "20200929-114144097",
32-
"status": "in_progress",
33-
"startedAt": "2020-09-29T11:41:44.392327Z"
33+
"taskUid": 1,
34+
"indexUid": null,
35+
"status": "enqueued",
36+
"type": "dumpCreation",
37+
"enqueuedAt": "2022-06-21T16:10:29.217688Z"
3438
}
3539
```
3640

37-
## Get dump status
38-
39-
<RouteHighlighter method="GET" route="/dumps/{dump_uid}/status"/>
40-
41-
Get the status of a dump creation process using the uid returned after calling the [dump creation route](/reference/api/dump.md#create-a-dump). The dump `uid` is required.
42-
43-
The returned status could be:
44-
45-
- `in_progress`: Dump creation is in progress
46-
- `failed`: An error occurred during dump process, and the task was aborted
47-
- `done`: Dump creation is finished and was successful
48-
49-
### Example
50-
51-
<CodeSamples id="get_dump_status_1" />
52-
53-
#### Response: `200 Ok`
54-
55-
```json
56-
{
57-
"uid": "20200929-114144097",
58-
"status": "done",
59-
"startedAt": "2020-09-29T11:41:44.392327Z",
60-
"finishedAt": "2020-09-29T11:41:50.792147Z"
61-
}
62-
```
41+
You can use this `taskUid` to get more details on [the status of the task](/reference/api/tasks.md#get-one-task)

reference/api/error_codes.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ The Content-Type header does not match the request body payload format or the fo
9797

9898
The Content-Type header was specified, but no request body was sent to the server or the request body is empty.
9999

100-
### `dump_already_processing`
101-
102-
Dump creation is already in progress. A new dump creation process can be triggered after the current one has been completed.
103-
104100
### `dump_not_found`
105101

106102
The requested dump could not be found.

0 commit comments

Comments
 (0)