Umeshkumar9414 commented on code in PR #7375:
URL: https://github.com/apache/hbase/pull/7375#discussion_r2466618862
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java:
##########
@@ -2046,15 +2057,56 @@ public Pair<Integer, Integer> getReopenStatus(TableName
tableName) {
return new Pair<Integer, Integer>(ritCount, states.size());
}
+ // This comparator sorts the RegionStates by time stamp then Region name.
+ // Comparing by timestamp alone can lead us to discard different
RegionStates that happen
+ // to share a timestamp.
+ private static class RegionStateStampComparator implements
Comparator<RegionState> {
+ @Override
+ public int compare(final RegionState l, final RegionState r) {
+ int stampCmp = Long.compare(l.getStamp(), r.getStamp());
+ return stampCmp != 0 ? stampCmp :
RegionInfo.COMPARATOR.compare(l.getRegion(), r.getRegion());
+ }
+ }
+
+ public final static RegionStateStampComparator REGION_STATE_STAMP_COMPARATOR
=
+ new RegionStateStampComparator();
+
//
============================================================================================
// TODO: Region State In Transition
//
============================================================================================
public boolean hasRegionsInTransition() {
- return regionStates.hasRegionsInTransition();
+ return regionInTransitionTracker.hasRegionsInTransition();
}
public List<RegionStateNode> getRegionsInTransition() {
- return regionStates.getRegionsInTransition();
+ return regionInTransitionTracker.getRegionsInTransition();
+ }
+
+ public boolean isRegionInTransition(final RegionInfo regionInfo) {
+ return regionInTransitionTracker.isRegionInTransition(regionInfo);
+ }
+
+ public int getOngoingTRSPCount() {
+ return regionStates.getOngoingTRSPCount();
+ }
+
+ /**
+ * Get the number of regions in transition.
+ */
+ public int getRegionsInTransitionCount() {
+ return regionInTransitionTracker.getRegionsInTransition().size();
+ }
+
+ public List<RegionState> getRegionsStateInTransition() {
+ return
getRegionsInTransition().stream().map(RegionStateNode::toRegionState).toList();
+ }
+
+ public SortedSet<RegionState> getRegionsInTransitionOrderedByTimestamp() {
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]