Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
kkewwei committed Jan 18, 2025
1 parent 33f26ee commit 895c5cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions server/src/main/java/org/opensearch/index/engine/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ public abstract static class Result {
private final SetOnce<Boolean> freeze = new SetOnce<>();
private final Mapping requiredMappingUpdate;
private Translog.Location translogLocation;
private InternalEngine.IndexingStrategy indexingStrategy;
private long took;

protected Result(Operation.TYPE operationType, Exception failure, long version, long term, long seqNo) {
Expand All @@ -492,6 +493,10 @@ protected Result(Operation.TYPE operationType, Exception failure, long version,
}

protected Result(Operation.TYPE operationType, long version, long term, long seqNo) {
this(operationType, version, term, seqNo, null);
}

protected Result(Operation.TYPE operationType, long version, long term, long seqNo, InternalEngine.IndexingStrategy indexingStrategy) {
this.operationType = operationType;
this.version = version;
this.seqNo = seqNo;
Expand Down Expand Up @@ -604,6 +609,11 @@ public static class IndexResult extends Result {

private final boolean created;

public IndexResult(long version, long term, long seqNo, boolean created, InternalEngine.IndexingStrategy plan) {
super(Operation.TYPE.INDEX, version, term, seqNo, plan);
this.created = created;
}

public IndexResult(long version, long term, long seqNo, boolean created) {
super(Operation.TYPE.INDEX, version, term, seqNo);
this.created = created;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ private IndexResult indexIntoLucene(Index index, IndexingStrategy plan) throws I
assert assertDocDoesNotExist(index, canOptimizeAddDocument(index) == false);
addDocs(index.docs(), indexWriter);
}
return new IndexResult(plan.versionForIndexing, index.primaryTerm(), index.seqNo(), plan.currentNotFoundOrDeleted);
return new IndexResult(plan.versionForIndexing, index.primaryTerm(), index.seqNo(), plan.currentNotFoundOrDeleted, plan);
} catch (Exception ex) {
if (ex instanceof AlreadyClosedException == false
&& indexWriter.getTragicException() == null
Expand Down

0 comments on commit 895c5cb

Please sign in to comment.