public class SuperSorterProgressTracker extends Object
SuperSorter, which it is designed to track.
It keeps a track of the following things:
1. Total levels to merge (Cannnot be modified once set)
2. Total mergers to merge in each level
3. Total merged batches in each level
There are a few states in which this progress tracker can be in (depending on the SuperSorter's progres):
1. Unknown everything | totalMergingLevels = -1, mergersForUltimateLevel = UNKNOWN_TOTAL
2. Known total levels, but unknown output partitions | totalMergingLevels = set, mergersForUltimateLevelSet = UNKNOWN_TOTAL
3. Unknown total levels, but known output partitions | totalMergingLevels = -1, mergersForUltimateLevelSet != UNKNOWN_TOTAL
4. Known everything | totalMergingLevels = set, mergersForUltimateLevelSet != UNKNOWN_TOTAL
Progress can only be quantified if the total levels are known
snapshot function does the housekeeping to hide this operational complexity away from classes other than SuperSorter
and SuperSorterProgressTracker| Constructor and Description |
|---|
SuperSorterProgressTracker() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMergedBatchesForLevel(int level,
long additionalMergedBatches)
This method is designed to be called during the course of the sorting.
|
void |
markTriviallyComplete()
If the SuperSorter is trivially done without doing any work (for eg - empty input), the tracker can be marked as
trivially complete.
|
void |
setTotalMergersForLevel(int level,
long totalMergers)
Sets the total mergers for a level.
|
void |
setTotalMergersForUltimateLevel(long totalMergersForUltimateLevel)
Sets the number of mergers in the ultimate level (number of mergers = number of output partitions).
|
void |
setTotalMergingLevels(int totalMergingLevels)
Set total merging levels for the SuperSorter it is tracking.
|
SuperSorterProgressSnapshot |
snapshot() |
public void setTotalMergingLevels(int totalMergingLevels)
public void setTotalMergersForLevel(int level,
long totalMergers)
public void setTotalMergersForUltimateLevel(long totalMergersForUltimateLevel)
public void addMergedBatchesForLevel(int level,
long additionalMergedBatches)
public void markTriviallyComplete()
public SuperSorterProgressSnapshot snapshot()
SuperSorterProgressSnapshot representing the same informationCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.