Skip to content

MB-57888: Support for downtime mitigation upon updates to index mapping - #2106

Merged
Likith101 merged 27 commits into
masterfrom
IndexUpdate
Oct 9, 2025
Merged

Likith101 merged 27 commits into
masterfrom
IndexUpdate

Conversation

@Likith101

@Likith101 Likith101 commented Nov 26, 2024 •

Copy link
Copy Markdown
Member
  • 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:

@abhinavdangeti abhinavdangeti added this to the v2.5.0 milestone Jan 6, 2025
@Likith101 Likith101 changed the title MB-57888: WIP: Index Update MB-57888: Index Update Jan 9, 2025
@Likith101
Likith101 force-pushed the IndexUpdate branch 2 times, most recently from 65b6392 to 289e64a Compare January 17, 2025 08:05
Comment thread index_update.go Resolved
Comment thread index/scorch/optimize_knn.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
@CascadingRadium

Copy link
Copy Markdown
Member

hi @Likith101 can you please rebase over master and fix conflicts

@CascadingRadium CascadingRadium left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

first pass will continue

Comment thread index_impl.go Resolved
Comment thread index_impl.go Resolved
Comment thread index/scorch/scorch.go Resolved
Comment thread index/scorch/scorch.go Resolved
Comment thread index_update_test.go Resolved
@Likith101
Likith101 force-pushed the IndexUpdate branch 2 times, most recently from efafd86 to 973fdce Compare March 11, 2025 06:11

@CascadingRadium CascadingRadium left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

second pass

Comment thread index_impl.go Resolved
Comment thread index/scorch/persister.go Resolved
Comment thread index/scorch/snapshot_index.go Resolved
Comment thread index_update_test.go Resolved
Comment thread index_update_test.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
@CascadingRadium

CascadingRadium commented Mar 12, 2025 •

Copy link
Copy Markdown
Member

theres one case which is not implemented.
consider the following scenario

  1. OriginalMapping
   "analysis": {
    "analyzers": {
     "custAna": {
      "token_filters": [
       "custFilt"
      ],
      "type": "custom",
      "tokenizer": "unicode"
     }
    },
    "token_filters": {
     "custFilt": {
      "min": 3,
      "max": 255,
      "type": "length"
     }
    },
   "types": {
    "abc": {
     "enabled": true,
     "dynamic": true,
     "default_analyzer": "custAna"
    }
   }
   
  1. UpdatedMapping
   "analysis": {
    "analyzers": {
     "custAna": {
      "token_filters": [
       "custFilt"
      ],
      "type": "custom",
      "tokenizer": "unicode"
     }
    },
    "token_filters": {
     "custFilt": {
      "min": 10,
      "max": 255,
      "type": "length"
     }
    },
   "types": {
    "abc": {
     "enabled": true,
     "dynamic": true,
     "default_analyzer": "custAna"
    }
   }

Here assume the custAna analyzer is used in a type_mapping. Now, although the custom analyzer has not changed and the type_mapping is the same, the custom analysis component used within the custom analyzer has changed. This check is not there and it can wrongly flag the update as successful. This is true for all custom analysis component - tokenFilter, tokenMap, tokenizer,

Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
Comment thread index/scorch/scorch.go Resolved
Comment thread index_impl.go Resolved

@abhinavdangeti abhinavdangeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking mostly ok to me @Likith101 - I've a few requests for some more commentary and the positioning the mapping_key and we should be good here.

Comment thread index/scorch/optimize_knn.go Resolved
Comment thread index/scorch/persister.go Resolved
Comment thread index/scorch/snapshot_index.go Resolved
Comment thread index/scorch/snapshot_segment.go Resolved
Comment thread index_impl.go Resolved
@abhinavdangeti

Copy link
Copy Markdown
Member

@Likith101 Would you add a new docs/index_update.md with a title "Ability to reduce downtime during index mapping updates" (in the same format as the other docs there) indicating the status quo and capturing how to leverage this feature for our community users.

I'll leave it be your decision if you want to make that a separate commit, but it'll need to be available before we produce v2.5.0.

Comment thread docs/index_update.md Resolved
Comment thread docs/index_update.md Resolved
Comment thread docs/index_update.md Resolved
Comment thread docs/index_update.md Resolved
Comment thread docs/index_update.md Resolved
Comment thread docs/index_update.md Resolved

@abhinavdangeti abhinavdangeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Likith101 It seems this is introducing multiple unit test failures that need your attention - please make it a practice to run go test ./... locally with and without the vectors tag before proposing each patch.

@abhinavdangeti abhinavdangeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A vector unit test requires attention ..

--- FAIL: TestIndexUpdateVector (0.07s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x2 addr=0x30 pc=0x100381494]

goroutine 14502 [running]:
testing.tRunner.func1.2({0x1006bc4c0, 0x100b1ce80})
	/opt/homebrew/Cellar/go/1.25.0/libexec/src/testing/testing.go:1872 +0x190
testing.tRunner.func1()
	/opt/homebrew/Cellar/go/1.25.0/libexec/src/testing/testing.go:1875 +0x31c
panic({0x1006bc4c0?, 0x100b1ce80?})
	/opt/homebrew/Cellar/go/1.25.0/libexec/src/runtime/panic.go:783 +0x120
github.com/blevesearch/bleve/v2/index/scorch.(*IndexSnapshotVectorReader).Next(0x1400039ad00, 0x1?)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/index/scorch/snapshot_index_vr.go:86 +0x74
github.com/blevesearch/bleve/v2/search/searcher.(*KNNSearcher).Next(0x140007488c0, 0x14001b8cb40)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search/searcher/search_knn.go:118 +0x94
github.com/blevesearch/bleve/v2/search/searcher.(*DisjunctionSliceSearcher).initSearchers(0x140000d66c0, 0x14001b8cb40)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search/searcher/search_disjunction_slice.go:151 +0x9c
github.com/blevesearch/bleve/v2/search/searcher.(*DisjunctionSliceSearcher).Next(0x140000d66c0, 0x14001b8cb40)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search/searcher/search_disjunction_slice.go:215 +0x30
github.com/blevesearch/bleve/v2/search/collector.(*KNNCollector).Collect(0x14000647a00, {0x10078e588, 0x100bde840}, {0x100793100, 0x140000d66c0}, {0x100794d68, 0x1400012e4d0})
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search/collector/knn.go:181 +0x264
github.com/blevesearch/bleve/v2.(*indexImpl).runKnnCollector(0x140001d2930, {0x10078e588, 0x100bde840}, 0x14000432f00, {0x100794d68, 0x1400012e4d0}, 0x0)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search_knn.go:412 +0x354
github.com/blevesearch/bleve/v2.(*indexImpl).SearchInContext(0x140001d2930, {0x10078e588, 0x100bde840}, 0x14000432f00)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/index_impl.go:700 +0x6e0
github.com/blevesearch/bleve/v2.(*indexImpl).Search(0x0?, 0x48?)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/index_impl.go:480 +0x30
github.com/blevesearch/bleve/v2.TestIndexUpdateVector(0x14000910e00)
	/Users/abhinav.dangeti/Documents/go/src/github.com/blevesearch/bleve/search_knn_test.go:1904 +0x1c40
testing.tRunner(0x14000910e00, 0x1007843a8)
	/opt/homebrew/Cellar/go/1.25.0/libexec/src/testing/testing.go:1934 +0xc8
created by testing.(*T).Run in goroutine 1
	/opt/homebrew/Cellar/go/1.25.0/libexec/src/testing/testing.go:1997 +0x364
FAIL	github.com/blevesearch/bleve/v2	48.307s

Comment thread util/keys.go Resolved
Comment thread docs/index_update.md Resolved
Comment thread index/scorch/scorch.go Resolved
@abhinavdangeti

Copy link
Copy Markdown
Member

Looking good, let me make one more pass early next week.

Comment thread index/scorch/scorch.go Resolved
CascadingRadium
CascadingRadium previously approved these changes Oct 6, 2025
abhinavdangeti
abhinavdangeti previously approved these changes Oct 6, 2025

@abhinavdangeti abhinavdangeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Likith101 one check required for scoring_model as well allowing any change between states - `"", "tf-idf", "bm25" to be changeable without index rebuild. Please weigh in on whether that change is required here or in cbft.

Comment thread index/scorch/scorch.go Resolved
Comment thread index_impl.go Resolved
Comment thread index_update.go Resolved
Comment thread index_update.go Resolved
@abhinavdangeti abhinavdangeti changed the title MB-57888: Index Update MB-57888: Support for downtime mitigation upon certain kind of updates to index mappings Oct 8, 2025
@abhinavdangeti abhinavdangeti changed the title MB-57888: Support for downtime mitigation upon certain kind of updates to index mappings MB-57888: Support for downtime mitigation upon updates to index mappings Oct 8, 2025
@abhinavdangeti abhinavdangeti changed the title MB-57888: Support for downtime mitigation upon updates to index mappings MB-57888: Support for downtime mitigation upon updates to index mapping Oct 8, 2025
@Likith101
Likith101 merged commit c91bb76 into master Oct 9, 2025
@CascadingRadium
CascadingRadium deleted the IndexUpdate branch May 5, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants