Repository navigation
Fixes 35914: Prevent closed readers in OpenSearch embedding updates - #35917
Conversation
Load shared OpenSearch vector settings from the spec mappings for entity and chunk indexes, including staged chunks. Disable derived vector source while preserving embedding indexing and kNN search. Reproduce the reader lifecycle failure on OpenSearch 3.4 with concurrent updates, merges and scroll cleanup. Verify partial updates preserve source fields and vector searches still work. Document the disk storage tradeoff and full reindex required for existing indexes.
Code Review ✅ Approved🟡 Medium risk · Disabling OpenSearch derived vectors stores embeddings in _source, increasing disk use and requiring full reindexing for existing indexes. Keeps OpenSearch vector fields in stored VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Earlier implementation-stage affected-test results, referenced in the PR description. This report predates commit Local Java test run: FAILED — details
Failed: Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. integration · postgres-opensearch · parallel: 42 classes
Why these tests
Impacted, not run locally (14)
Commandsmvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AvailableEntityTypesConsistencyTest,CompanyContextToolTest,DistributedJobParticipantTest,GetEntityToolTest,HighlightFieldClassifierTest,ImmenseTermReproTest,IndexTemplateManagerTest,OSLineageGraphBuilderTest,OpenSearchBulkSinkBehaviorTest,OpenSearchVectorMemoryAccessTest,OpenSearchVectorServiceChunkStagingTest,OpenSearchVectorServiceTest,OsUtilsTest,SearchRepositoryBehaviorTest,SemanticSearchToolTest,VectorDocBuilderChunkTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=OpenSearchVectorReaderIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel '-Dit.test=<37 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=PatchTableEmbeddingIT,SearchIndexRetryQueueIT,TestSuiteReindexIT,VectorEmbeddingIntegrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=rdf -Dit.test=RdfIndexAppScaleIT,RdfIndexRunRecoveryIT,RdfReindexFailuresIT,RdfReindexInsertOnlyIT,RdfReindexRunLockIT,RdfSemanticSearchIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=ColumnIndexingToggleIT,CustomPropertyAggregationIT,DbToEsCountReconciliationIT,ExtensionHighlightSearchIT,FieldNamesAggregationIT,HighlightFieldSaveValidationIT,IndexFieldExplosionIT,IndexMappingTemplatesIT,LiveIndexRetryIT,LiveSearchSettingsChangeIT,NestedHierarchyIndexIT,NoDuplicatesDuringReindexIT,OwnersNestedMappingIT,PerEntitySearchDefaultsIT,ReindexAliasSwapIT,ReindexDocSurvivalIT,ReindexOutageRecoveryIT,ReindexStatsIT,ReindexStopUnderLoadIT,SearchAggregateRbacIT,SearchClusterFitnessReindexE2EIT,SearchCountConsistencyIT,SearchEntityRankingIT,SearchRelevancyPreviewIT,SearchScoringIT,StagedIndexUnrefreshedCountIT,TestCaseStaleDefinitionReindexIT,UnsafeReindexConfigIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
|
|
🤖 Backport to |
|
🤖 Backport to |
…rs (backport 2.0 #35917) (#36208) Co-authored-by: Sriharsha Chintalapani <[email protected]>



Describe your changes:
Fixes #35914
OpenSearch embedding updates can return HTTP 500 with
already_closed_exceptionafter concurrent updates, merges and scroll cleanup close a derived-source vector reader.Commit
111eee439a3loads shared OpenSearch vector settings from the spec mappings for entity and chunk indexes, including staged chunks. It setsindex.knn.derived_source.enabled=falsewhile preserving embedding indexing and kNN search. The regression test reproduces the failure on OpenSearch 3.4.0 and verifies updated vectors and existing document fields remain readable.Type of change:
High-level design:
OsUtilsand the chunk mapping builder shareopenmetadata-spec/src/main/resources/elasticsearch/opensearch_vector_index_mapping.json. The resource keeps vectors in stored_source, avoiding the failing derived-source reader path. Only OpenSearch consumes it; the supported OpenSearch baseline is 3.x onwards.Existing indexes need a full reindex to recreate them with this static setting. Keeping vectors in
_sourceincreases disk usage; the increase has not been measured. See the decision record.Tests:
Use cases covered
_source.Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/search/opensearch/OsUtilsTest.java.OsUtilsTest(38),EsUtilsTest(31),OpenSearchIndexManagerTest(62),IndexTemplateManagerTest(11),ImmenseTermReproTest(3),OpenSearchVectorMemoryAccessTest(1),OpenSearchVectorServiceChunkStagingTest(10), andOpenSearchVectorServiceTest(33).Backend integration tests
Added
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/OpenSearchVectorReaderIT.java, using a real OpenSearch 3.4.0 container and production index creation paths. Both parameterized cases failed with the reported HTTP 500 before the fix and passed after the final mapping change. The test writes fixed vectors and needs no external embedding provider.The current-commit affected run is still running; its unit step passed all 415 tests. The broader run and fresh coverage collection remain pending. The last completed affected-run report below is from the earlier uncommitted implementation:
Local Java test run: FAILED
0476bb31d51a(baseHEAD) — uncommitted changes were presentFailed:
SearchRankingRelevanceIT#singularQueryFindsThePluralTable(TestNamespace)Additional focused verification of the final mapping implementation: 2 integration cases passed, alongside the 189 unit tests above:
Earlier implementation-stage runs:
SearchRankingRelevanceIT#singularQueryFindsThePluralTable. Embeddings were disabled on its table index and the new setting was absent. A clean-main baseline was not run, so this is not claimed to be a proven pre-existing failure. Later lanes were not run after that failure.Ingestion integration tests
Not applicable — no ingestion changes.
Playwright (UI) tests
Not applicable — no UI changes.
Manual testing performed
already_closed_exceptionwith derived source enabled.git diff --check, the Java impact-map ownership check and the decision-record check; all passed.UI screen recording:
Not applicable — backend search fix with no UI changes.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #35914above.111eee439a3d64dcc5be82deff51857aed771a48was reviewed againstREVIEW.md.docs/decisions/2026-10-21-opensearch-vectors-stay-in-source.md.

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
OpenSearch entity and chunk indexes now share settings that keep vectors in stored
_sourcewhile leaving kNN enabled._sourceand k-NN enabled.No actionable issues were found. Tests were reviewed but not run during this review.
Acknowledged limitations:
harshachstates that existing indexes need a full reindex that recreates them because the setting is static.harshachacknowledges increased disk usage; the increase has not been measured.harshachreports that the OpenSearch 2.x concern was withdrawn after the maintainer confirmed support starts at 3.x.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD Resource["Shared OpenSearch vector settings"] --> Entity["OsUtils: entity index settings"] Resource --> Chunk["OpenSearchVectorService: chunk mapping"] Chunk --> Live["Live chunk index"] Chunk --> Staged["Staged chunk generation"] Entity --> Stored["Vectors remain in stored _source; kNN stays enabled"] Live --> Stored Staged --> StoredReviews (1) · Last reviewed commit: "Fixes #35914: Keep OpenSearch vectors in..." · Reviewed by Greptile