java.lang.Object
java.lang.Record
org.elasticsearch.index.reindex.ResumeInfo
- All Implemented Interfaces:
Writeable
public record ResumeInfo(ResumeInfo.RelocationOrigin relocationOrigin, ResumeInfo.WorkerResumeInfo worker, Map<Integer,ResumeInfo.SliceStatus> slices, TaskResult sourceTaskResult)
extends Record
implements Writeable
Holds resume state information for a
BulkByScrollTask task to be resumed from a previous run. It may contain a WorkerResumeInfo
which keeps the state for a single worker task, or a map of SliceResumeInfo which keeps the state for each slice of a leader task.
It also has information about the original task that was relocated, so the user-facing taskID and start time are preserved in listings.
But the RelocationOrigin isn't accurate for sliced tasks, they have themselves as the origin, but for listing the leader is correct.
Note: For sliced tasks, resume info must include all slices, including those that are already completed. This ensures that the final task has a complete result from all slices. A task may be resumed multiple times, so information for completed slices must be carried forward to each subsequent resume until the task is fully completed.
TODO: we can use List instead of Map for since the keys are required to be 0-based and contiguous.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResume information for a PIT-based BulkByScrollTask worker.static final recordIdentity of the original task that was relocated.static final recordResume information for a scroll-based BulkByScrollTask worker.static final recordInformation for a single slice of a BulkByScrollTask.static final recordstatic interfaceResume information for a single worker of a BulkByScrollTask.Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionResumeInfo(ResumeInfo.RelocationOrigin relocationOrigin, ResumeInfo.WorkerResumeInfo worker, Map<Integer, ResumeInfo.SliceStatus> slices) ResumeInfo(ResumeInfo.RelocationOrigin relocationOrigin, ResumeInfo.WorkerResumeInfo worker, Map<Integer, ResumeInfo.SliceStatus> slices, TaskResult sourceTaskResult) Creates an instance of aResumeInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getSlice(int sliceId) intfinal inthashCode()Returns a hash code value for this object.booleanisSliceCompleted(int sliceId) Returns the value of therelocationOriginrecord component.slices()Returns the value of theslicesrecord component.Returns the value of thesourceTaskResultrecord component.final StringtoString()Returns a string representation of this record class.worker()Returns the value of theworkerrecord component.voidwriteTo(StreamOutput out) Write this into the StreamOutput.
-
Constructor Details
-
ResumeInfo
public ResumeInfo(ResumeInfo.RelocationOrigin relocationOrigin, @Nullable ResumeInfo.WorkerResumeInfo worker, @Nullable Map<Integer, ResumeInfo.SliceStatus> slices) -
ResumeInfo
public ResumeInfo(ResumeInfo.RelocationOrigin relocationOrigin, @Nullable ResumeInfo.WorkerResumeInfo worker, @Nullable Map<Integer, ResumeInfo.SliceStatus> slices, @Nullable TaskResult sourceTaskResult) Creates an instance of aResumeInforecord class.- Parameters:
relocationOrigin- the value for therelocationOriginrecord componentworker- the value for theworkerrecord componentslices- the value for theslicesrecord componentsourceTaskResult- the value for thesourceTaskResultrecord component
-
ResumeInfo
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getTotalSlices
public int getTotalSlices() -
getWorker
-
getSlice
-
isSliceCompleted
public boolean isSliceCompleted(int sliceId) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
relocationOrigin
Returns the value of therelocationOriginrecord component.- Returns:
- the value of the
relocationOriginrecord component
-
worker
Returns the value of theworkerrecord component.- Returns:
- the value of the
workerrecord component
-
slices
Returns the value of theslicesrecord component.- Returns:
- the value of the
slicesrecord component
-
sourceTaskResult
Returns the value of thesourceTaskResultrecord component.- Returns:
- the value of the
sourceTaskResultrecord component
-