Skip to content

Commit 9b0cbec

Browse files
Lazy compute description in ReplicationRequest.createTask (#117783) (#117804)
These can at times be quite long strings, no need to materialize unless requested. This is showing up as allocating needless heap of O(GB) in some benchmarks during indexing needlessly.
1 parent 5e4757e commit 9b0cbec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,12 @@ public void writeThin(StreamOutput out) throws IOException {
210210

211211
@Override
212212
public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> headers) {
213-
return new ReplicationTask(id, type, action, getDescription(), parentTaskId, headers);
213+
return new ReplicationTask(id, type, action, "", parentTaskId, headers) {
214+
@Override
215+
public String getDescription() {
216+
return ReplicationRequest.this.getDescription();
217+
}
218+
};
214219
}
215220

216221
@Override

0 commit comments

Comments
 (0)