You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MB-57888: Support for downtime mitigation upon updates to index mapping (#2106)
- Added new apis for index update
- Added logic to determine whether index mappings can be updated and
what specifically changed between mappings
- Added logic to store and retrieve said information within bolt
- Added checks to prevent deleted data from being referenced within
queries till the actual data on the segment is removed during the merge
process
Related:
- blevesearch/bleve_index_api#64
- blevesearch/scorch_segment_api#61
- blevesearch/zapx#318
---------
Co-authored-by: Abhinav Dangeti <abhinav@couchbase.com>
# Ability to reduce downtime during index mapping updates
2
+
3
+
**v2.5.4* (and after) will come with support to delete or modify any field mapping in the index mapping without requiring a full rebuild of the index
4
+
* We do this by storing which portions of the field has to be deleted within zap and then lazily executing the deletion during subsequent merging of the segments
5
+
6
+
## Usage
7
+
8
+
While opening an index, if an updated mapping is provided as a string under the key `updated_mapping` within the `runtimeConfig` parameter of `OpenUsing`, then we open the index and try to update it to use the new mapping provided.
9
+
10
+
If the update fails, the index is unchanged and an error is returned explaining why the update was unsuccessful.
11
+
12
+
## What can be deleted and what can't be deleted?
13
+
Fields can be partially deleted by changing their Index, Store, and DocValues parameters from true to false, or completely removed by deleting the field itself.
14
+
15
+
Additionally, document mappings can be deleted either by fully removing them from the index mapping or by setting the Enabled value to false, which deletes all fields defined within that mapping.
16
+
17
+
However, if any of the following conditions are met, the index is considered non-updatable.
18
+
* Any additional fields or enabled document mappings in the new index mapping
19
+
* Any changes to IncludeInAll, type, IncludeTermVectors and SkipFreqNorm
20
+
* Any document mapping having it's enabled value changing from false to true
21
+
* Text fields with a different analyser or date time fields with a different date time format
22
+
* Vector and VectorBase64 fields changing dims, similarity or vectorIndexOptimizedFor
23
+
* Any changes when field is part of `_all`
24
+
* Full field deletions when it is covered by any dynamic setting (Index, Store or DocValues Dynamic)
25
+
* Any changes to dynamic settings at the top level or any enabled document mapping
26
+
* If multiple fields sharing the same field name either from different type mappings or aliases are present, then any non compatible changes across all of these fields
27
+
28
+
## How to enforce immediate deletion?
29
+
Since the deletion is only done during merging, a [force merge](https://github.com/blevesearch/bleve/blob/b82baf10b205511cf12da5cb24330abd9f5b1b74/index/scorch/merge.go#L164) may be used to completely remove the stale data.
30
+
31
+
## Sample code to update an existing index
32
+
```
33
+
newMapping := `<Updated Index Mapping>`
34
+
config := map[string]interface{}{
35
+
"updated_mapping": newMapping
36
+
}
37
+
index, err := OpenUsing("<Path to Index>", config)
0 commit comments