Keep the search engine configured on an index when deploying index definitions - #5946
Open
mauroservienti wants to merge 1 commit into
Open
mauroservienti wants to merge 1 commit into
mauroservienti wants to merge 1 commit into
Conversation
…finitions Operators migrating indexes from Corax to Lucene in RavenDB Studio store the search engine in the index configuration. ServiceControl deployed its index definitions without it, so RavenDB built a side-by-side replacement that fell back to the database default, which is Corax for databases created before 6.20. Unless the index was locked, every start-up reset migrated indexes back to Corax. Index definitions are now deployed carrying over the search engine configured on the existing index (or on its pending replacement). A migrated index no longer needs to be locked, still receives definition changes, and a pending Corax replacement created by earlier versions is discarded at start-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
6.20.0 recommends migrating RavenDB indexes from Corax to Lucene. The documented per-index procedure changes the search engine on the index's Configuration tab in RavenDB Studio, which stores
Indexing.Static.SearchEngineTypein the index configuration.At every start-up ServiceControl deploys its index definitions with
IndexCreation.CreateIndexesAsync. Those definitions carry no search engine, so RavenDB sees a definition difference and builds a side-by-sideReplacementOf/<index>that falls back to the database default. For databases created before 6.20 the default is Corax, becauseUpdateDatabaseSettingspins it. Unless the migrated index is locked, it gets reset to Corax and rebuilt.A customer hit this after unlocking a migrated
MessagesViewIndexWithFullTextSearch, following the docs, which state that locking is no longer needed from 6.20.0.Fix
New
IndexDeploymenthelper inServiceControl.RavenDB, used by both the Primary and AuditDatabaseSetupinstead ofIndexCreation.CreateIndexesAsync. Before deploying, it reads the existing index definitions and copies theIndexing.Static.SearchEngineTypeconfigured on the existing index onto the definition being deployed. A pending replacement's configuration takes precedence over the original's.Tests
Audit
IndexSetupTests:Indexes_should_be_reset_on_setupasserted the old behavior. It is replaced by:Search_engine_configured_on_the_index_should_be_preserved_on_setup: no replacement, index not recreated.Indexes_should_be_reset_on_setup_keeping_the_configured_search_engine: a hand-edited field is reset, the engine is kept.Pending_replacement_using_the_database_default_should_be_discarded_in_favor_of_the_configured_search_engine: reproduces the customer's state. Indexing is stopped so the replacement can't swap.Primary
IndexSetupTests(new): covers the assembly-scanning path.The three new Audit tests fail without the fix. Locally, both RavenDB persistence suites pass: Audit 55/55, Primary 349/349.
Related
🤖 Generated with Claude Code