Add indexer interface for shard interaction with underlying engines#20675
Add indexer interface for shard interaction with underlying engines#20675Bukhtawar merged 8 commits intoopensearch-project:mainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
server/src/main/java/org/opensearch/index/engine/EngineBackedIndexer.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/Indexer.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/Indexer.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/Segment.java
Outdated
Show resolved
Hide resolved
PR Reviewer Guide 🔍(Review updated until commit e403aa9)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to e403aa9 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 4d70feb
Suggestions up to commit b7133e3
Suggestions up to commit 88b1af9
Suggestions up to commit fbe21d8
Suggestions up to commit a817aa5
|
|
Persistent review updated to latest commit d4a8622 |
|
❌ Gradle check result for d4a8622: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
server/src/main/java/org/opensearch/index/engine/dataformat/MergeResult.java
Show resolved
Hide resolved
|
Persistent review updated to latest commit 9566666 |
|
❌ Gradle check result for 9566666: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit 3926bc0 |
|
❌ Gradle check result for 3926bc0: TIMEOUT Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit eae9a8a |
|
❌ Gradle check result for eae9a8a: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit 11cadef |
|
❌ Gradle check result for 11cadef: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/EngineBackedIndexer.java
Show resolved
Hide resolved
|
Persistent review updated to latest commit 217f00f |
|
Persistent review updated to latest commit 91d376d |
|
Persistent review updated to latest commit a817aa5 |
|
❌ Gradle check result for a817aa5: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit fbe21d8 |
fbe21d8 to
88b1af9
Compare
|
@mgodwan I just rebased the latest version increment that is needed to get the bwc tests to pass |
|
Persistent review updated to latest commit 88b1af9 |
server/src/main/java/org/opensearch/index/engine/exec/WriterFileSet.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/WriterFileSet.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/WriterFileSet.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/exec/WriterFileSet.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/engine/dataformat/FileInfos.java
Outdated
Show resolved
Hide resolved
|
Persistent review updated to latest commit b7133e3 |
|
Persistent review updated to latest commit 4d70feb |
|
❌ Gradle check result for 4d70feb: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Mohit Godwani <mgodwan@amazon.com> Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
Convert some classes to records Add immutability to collections held in record classes Signed-off-by: Mohit Godwani <mgodwan@amazon.com>
|
Persistent review updated to latest commit e403aa9 |
Bukhtawar
left a comment
There was a problem hiding this comment.
Thanks for the changes LGTM
Summary
This PR introduces an
Indexerinterface that abstracts the interaction betweenIndexShardand the underlying storage engine. Today,IndexShardholds a direct reference toEngineand calls engine methods throughout its lifecycle — tightly coupling shard-level coordination logic to a single engine implementation. This change decouples that relationship by introducingIndexeras the primary contract through whichIndexShardperforms document operations, manages sequence numbers, controls lifecycle events (flush, refresh, force merge), and queries statistics. A concrete implementation,EngineBackedIndexer, wraps the existingEngineto preserve full backward compatibility. This is a foundational step toward enabling pluggable and composite engine architectures in OpenSearch, as described in RFC #20644.Motivation
OpenSearch's engine layer is responsible for indexing, searching, and managing the lifecycle of data on a shard. As the project evolves toward supporting composite engines (e.g., a primary Lucene engine paired with a secondary vector or columnar engine), the current tight coupling between
IndexShardandEnginebecomes a bottleneck. There is no clean abstraction boundary that allows a shard to interact with multiple engine implementations or swap engine behavior without modifyingIndexSharddirectly.This PR establishes that abstraction boundary.
Architecture: Before vs. After
Before (Tightly Coupled)
After (Interface-Abstracted)
New Class Structure
Indexer Interface Responsibilities
EngineBackedIndexer: Delegation Model
The
enginereference insideEngineBackedIndexeris volatile and mirrors the existing engine swap semantics inIndexShard. ThegetEngine()accessor is intentionally marked for future removal once all callers migrate away from direct engine access.Migration Path
Related Issues & PRs
mgodwan/OpenSearch#201– Changes for supportingDataFormatRegistryCheck List
Notes for Reviewers
Indexerinterface is annotated@ExperimentalApi— the contract is expected to evolve as composite engine support matures.EngineBackedIndexer.getEngine()is a temporary escape hatch for callers not yet migrated; it is documented for removal.IndexShardmethods are marked@Deprecatedwith TODO comments pending aSearcherInterfacecompanion PR.applyOnEngineutility method currently throwsIllegalStateExceptionfor non-EngineBackedIndexerinstances; this will be addressed as the interface matures.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.