Skip to content

Conversation

@varunbharadwaj
Copy link
Contributor

@varunbharadwaj varunbharadwaj commented Oct 7, 2025

Description

This PR refactors IndexShard and Engine to move prepareIndex and prepareDelete to the abstract Engine class to enable custom engine implementations to bypass OS mapping framework. This has benefits as described in #19550

Related Issues

Resolves #19550

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Indexing Indexing, Bulk Indexing and anything related to indexing labels Oct 7, 2025
@varunbharadwaj varunbharadwaj force-pushed the vb/enginerefactor branch 2 times, most recently from 4aeb16d to ece97de Compare October 7, 2025 01:16
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

❌ Gradle check result for ece97de: 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?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

❕ Gradle check result for ece97de: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.00%. Comparing base (b553d3a) to head (15a5a5b).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19551      +/-   ##
============================================
- Coverage     73.01%   73.00%   -0.01%     
+ Complexity    70546    70527      -19     
============================================
  Files          5719     5719              
  Lines        323251   323260       +9     
  Branches      46815    46816       +1     
============================================
- Hits         236016   235993      -23     
+ Misses        68226    68176      -50     
- Partials      19009    19091      +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@varunbharadwaj varunbharadwaj requested a review from a team as a code owner October 7, 2025 04:13
…rd to Engine

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

❌ Gradle check result for 15a5a5b: 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?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

✅ Gradle check result for 15a5a5b: SUCCESS

@msfroh msfroh merged commit 39b7a59 into opensearch-project:main Oct 8, 2025
61 of 63 checks passed
Comment on lines +1616 to +1628
public Engine.Index prepareIndex(
DocumentMapperForType docMapper,
SourceToParse source,
long seqNo,
long primaryTerm,
long version,
VersionType versionType,
Engine.Operation.Origin origin,
long autoGeneratedIdTimestamp,
boolean isRetry,
long ifSeqNo,
long ifPrimaryTerm
) {
Copy link
Contributor

@Bukhtawar Bukhtawar Oct 8, 2025

Choose a reason for hiding this comment

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

The concern with this change is implementations of the Engine interface like the NRTReplicationEngine now gets this method while in practise it isn't supposed to index any document. Thoughts @mch2 ?

Do we need to override this method appropriately?

Copy link
Member

Choose a reason for hiding this comment

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

for NRT specifically prepareIndex is never invoked -

if (indexSettings.isSegRepEnabledOrRemoteNode() && routingEntry().primary() == false) {
.

but we can take this opportunity to refactor more and remove that block from indexshard and push the noOp to NRT engine directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree this isn't getting used but always good to be explicit for future use cases

rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 11, 2025
…opensearch-project#19551)

---------

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 11, 2025
…opensearch-project#19551)

---------

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
Gagan6164 pushed a commit to Gagan6164/OpenSearch that referenced this pull request Oct 13, 2025
…opensearch-project#19551)

---------

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
Signed-off-by: Gagan Singh Saini <gagasa@amazon.com>
peteralfonsi pushed a commit to peteralfonsi/OpenSearch that referenced this pull request Oct 15, 2025
…opensearch-project#19551)

---------

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 18, 2025
…opensearch-project#19551)

---------

Signed-off-by: Varun Bharadwaj <varunbharadwaj1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request Indexing Indexing, Bulk Indexing and anything related to indexing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow custom document parsing by skipping OS default mapping framework

4 participants