public static String getHotPartitionsDueToContiguity ( final Cluster cluster , int hotContiguityCutoff ) { StringBuilder sb = new StringBuilder ( ) ; for ( int zoneId : cluster . getZoneIds ( ) ) { Map < Integer , Integer > idToRunLength = getMapOfContiguousPartitions ( cluster , zoneId ) ; for ( Integer initialPartitionId : idToRunLength . keySet ( ) ) { int runLength = idToRunLength . get ( initialPartitionId ) ; if ( runLength < hotContiguityCutoff ) continue ; int hotPartitionId = ( initialPartitionId + runLength ) % cluster . getNumberOfPartitions ( ) ; Node hotNode = cluster . getNodeForPartitionId ( hotPartitionId ) ; sb . append ( "\tNode " + hotNode . getId ( ) + " (" + hotNode . getHost ( ) + ") has hot primary partition " + hotPartitionId + " that follows contiguous run of length " + runLength + Utils . NEWLINE ) ; } } return sb . toString ( ) ; }
Returns a pretty printed string of nodes that host specific hot partitions where hot is defined as following a contiguous run of partitions of some length in another zone .