Skip to content

Commit

Permalink
remove set method
Browse files Browse the repository at this point in the history
  • Loading branch information
pgomulka committed Jul 10, 2024
1 parent e84c4dc commit b3c16bc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ public long normalisedBytesParsed() {
return mapCounter;
}

@Override
public void setNormalisedBytesParsedOn(IndexRequest indexRequest) {
indexRequest.setNormalisedBytesParsed(mapCounter);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,5 @@ public long normalisedBytesParsed() {
return counter;
}

@Override
public void setNormalisedBytesParsedOn(IndexRequest indexRequest) {
indexRequest.setNormalisedBytesParsed(counter);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ Result prepareUpdateIndexRequest(ShardId shardId, UpdateRequest request, GetResu
.setIfPrimaryTerm(getResult.getPrimaryTerm())
.waitForActiveShards(request.waitForActiveShards())
.timeout(request.timeout())
.setRefreshPolicy(request.getRefreshPolicy());
documentSizeObserver.setNormalisedBytesParsedOn(finalIndexRequest);
.setRefreshPolicy(request.getRefreshPolicy())
.setNormalisedBytesParsed(documentSizeObserver.normalisedBytesParsed());

return new Result(finalIndexRequest, DocWriteResponse.Result.UPDATED, updatedSourceAsMap, updateSourceContentType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ public void onFailure(Exception e) {
);

executePipelines(pipelines, indexRequest, ingestDocument, shouldStoreFailure, documentListener);
documentSizeObserver.setNormalisedBytesParsedOn(indexRequest);
indexRequest.setNormalisedBytesParsed(documentSizeObserver.normalisedBytesParsed());
assert actionRequest.index() != null;

i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.elasticsearch.plugins.internal;

import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.xcontent.XContentParser;

/**
Expand All @@ -30,8 +29,6 @@ public long normalisedBytesParsed() {
return 0;
}

@Override
public void setNormalisedBytesParsedOn(IndexRequest indexRequest) {}
};

/**
Expand All @@ -50,11 +47,10 @@ public void setNormalisedBytesParsedOn(IndexRequest indexRequest) {}
long normalisedBytesParsed();

/**
* Enriches the index request with the number of bytes observed when parsing a document
* @param indexRequest
* Indicates if an observer was used on an update request with script
*
* @return true if update was done by script, false otherwise
*/
void setNormalisedBytesParsedOn(IndexRequest indexRequest);

default boolean isUpdateByScript() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,6 @@ public long normalisedBytesParsed() {
return 0;
}

@Override
public void setNormalisedBytesParsedOn(IndexRequest indexRequest) {
parsedValueWasUsed.incrementAndGet();
indexRequest.setNormalisedBytesParsed(0L);
}
};
}
};
Expand Down

0 comments on commit b3c16bc

Please sign in to comment.