Pipe: Handle hybrid meta progress indexes - #18331
Open
Caideyipi wants to merge 4 commits into
Open
Conversation
…com/Caideyipi/iotdb into fix/pipe-hybrid-meta-progress-index # Conflicts: # iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBNonDataRegionSource.java
jt2594838
reviewed
Jul 29, 2026
Comment on lines
+168
to
+199
| public final <T extends ProgressIndex> Optional<T> getProgressIndexByType( | ||
| final Class<T> progressIndexClass) { | ||
| if (progressIndexClass.isInstance(this)) { | ||
| return Optional.of(progressIndexClass.cast(this)); | ||
| } | ||
|
|
||
| if (this instanceof StateProgressIndex) { | ||
| return ((StateProgressIndex) this) | ||
| .getInnerProgressIndex() | ||
| .getProgressIndexByType(progressIndexClass); | ||
| } | ||
|
|
||
| if (this instanceof HybridProgressIndex) { | ||
| final Map<Short, ProgressIndex> type2Index = ((HybridProgressIndex) this).getType2Index(); | ||
|
|
||
| // Prefer a direct component over one nested in another composite progress index. | ||
| for (final ProgressIndex progressIndex : type2Index.values()) { | ||
| if (progressIndexClass.isInstance(progressIndex)) { | ||
| return Optional.of(progressIndexClass.cast(progressIndex)); | ||
| } | ||
| } | ||
| for (final ProgressIndex progressIndex : type2Index.values()) { | ||
| final Optional<T> extractedProgressIndex = | ||
| progressIndex.getProgressIndexByType(progressIndexClass); | ||
| if (extractedProgressIndex.isPresent()) { | ||
| return extractedProgressIndex; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return Optional.empty(); | ||
| } |
Contributor
There was a problem hiding this comment.
Let the sub-classes implement it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
IoTDBNonDataRegionSource assumed every non-minimum task progress was a MetaProgressIndex. Pipe task progress can also be merged into a HybridProgressIndex, and may be wrapped by a StateProgressIndex. This caused a ClassCastException while restoring a non-data-region source or calculating its remaining events during DataNode shutdown.
Changes
Verification
This PR has:
Key changed/added classes