Skip to content

[2.0] Fixes 35914: Prevent closed readers in OpenSearch embedding updates - #35945

Closed
gh-bot-collate[bot] wants to merge 1 commit into
2.0from
backport/2.0/pr-35917
Closed

gh-bot-collate[bot] wants to merge 1 commit into
2.0from
backport/2.0/pr-35917

Conversation

@gh-bot-collate

@gh-bot-collate gh-bot-collate Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Automated backport of #35917 to 2.0.

Source PR #35917
Author @harshach
Merge commit 1cfeb2bcf658d70bd9395a272f5e77b836b0ed44
Method Clean cherry-pick — identical to the commit on main.

Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #35917 is asked to look.

resolver run

RetriggerView in GreptileConfidence Score: 4/5

Do not merge until the integration test compiles and the explicit Java requirements are satisfied.

Findings

  1. P1 Integration tests cannot compile ▶
  2. P2 Helper breaks return rule ▶
  3. P2 Missing required final declarations ▶
  4. P2 Repeated field names ▶

Summary

Keeps OpenSearch vectors in _source to avoid closed-reader failures during embedding updates.

  • OpenSearch vector indexes keep embeddings in _source.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Settings["Shared vector settings"] --> Entity["Entity index creation"]
  Settings --> Chunk["Chunk index mapping"]
  Chunk --> Live["Live chunk index"]
  Chunk --> Staged["Staged chunk index"]
  Entity --> Source["Keep vectors in _source"]
  Live --> Source
  Staged --> Source
Loading

Reviews (1) · Last reviewed commit: "Fixes #35914: Keep OpenSearch vectors in..." · Reviewed by Greptile

…rs (#35917)

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.

(cherry picked from commit 1cfeb2b)
@gh-bot-collate
gh-bot-collate Bot requested a review from a team as a code owner October 22, 2026 09:41
@gh-bot-collate gh-bot-collate Bot added the safe to test Add this label to run secure Github workflows on PRs label Oct 22, 2026
@gh-bot-collate
gh-bot-collate Bot requested review from mohityadav766 and removed request for a team October 22, 2026 09:41
@gh-bot-collate
gh-bot-collate Bot enabled auto-merge (squash) October 22, 2026 09:41
Entity.setSearchRepository(previousRepository);
final var dispatcher = EntityLifecycleEventDispatcher.getInstance();
dispatcher.unregisterHandler(SearchIndexHandler.class.getSimpleName());
previousHandlers.forEach(dispatcher::replaceHandler);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Integration tests cannot compile

EntityLifecycleEventDispatcher has no replaceHandler method on this branch. This method reference prevents the integration-test module from compiling, so its tests cannot run. Use the available registerHandler method after removing the temporary search handler, or backport the missing API.

Suggested change
previousHandlers.forEach(dispatcher::replaceHandler);
previousHandlers.forEach(dispatcher::registerHandler);

throws IOException {
if (chunks) {
vectorService.writeEntityChunks("seed", List.of());
return vectorService.getChunkIndexName();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Helper breaks return rule

createIndex returns from both the chunk branch and the end of the method. The Java guide requires one return statement at the end. Assign the chosen index name to a local variable and return it once. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

service.executeGenericRequest("POST", "/" + index + "/_flush", null);
}

private void exerciseReaders(OpenSearchVectorService service, String index) throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Missing required final declarations

The new methods leave unchanged parameters and local variables without final. The Java guide requires final for values that do not change. Apply it to parameters such as service and index, and locals such as executor and result. The pattern appears elsewhere in this test and in loadVectorIndexMapping. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


final var updatedVector = Collections.nCopies(DIMENSION, 0.2);
vectorService.partialUpdateEntity(
index, "500", Map.of("embedding", updatedVector, "fingerprint", "updated"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Repeated field names

The new test repeats raw strings such as embedding and fingerprint. The Java guide requires strings used more than once to have one named constant. Reuse existing constants where available, or define shared constants for these values. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant