public static List < Integer > checkKeyBelongsToPartition ( byte [ ] key , Set < Pair < Integer , HashMap < Integer , List < Integer > > > > stealerNodeToMappingTuples , Cluster cluster , StoreDefinition storeDef ) { List < Integer > keyPartitions = new RoutingStrategyFactory ( ) . updateRoutingStrategy ( storeDef , cluster ) . getPartitionList ( key ) ; List < Integer > nodesToPush = Lists . newArrayList ( ) ; for ( Pair < Integer , HashMap < Integer , List < Integer > > > stealNodeToMap : stealerNodeToMappingTuples ) { List < Integer > nodePartitions = cluster . getNodeById ( stealNodeToMap . getFirst ( ) ) . getPartitionIds ( ) ; if ( StoreRoutingPlan . checkKeyBelongsToPartition ( keyPartitions , nodePartitions , stealNodeToMap . getSecond ( ) ) ) { nodesToPush . add ( stealNodeToMap . getFirst ( ) ) ; } } return nodesToPush ; }
Given a key and a list of steal infos give back a list of stealer node ids which will steal this .