vagetablechicken opened a new issue #4845:
URL: https://github.com/apache/incubator-doris/issues/4845


   **Is your feature request related to a problem? Please describe.**
   After #4763, we want to import the kudu's rebalance strategy 
[TwoDimensionalGreedyAlgo](https://github.com/apache/kudu/blob/c7bf1c140e00ba8895ec6a14fa918c190dff2e1f/src/kudu/rebalance/rebalance_algo.h#L139-L147).
   The kudu's two dims are `cluster` & `table`. Two dims of Doris should be 
`cluster` & `partition`.
   And we only consider about the replica count, do not consider replica size.
   
   **Describe the solution you'd like(POC)**
   ```
   PartitionRebalancer:
       @override
       selectAlternativeTabletsForCluster:
           // GetNextMoves gens vector of move{partitionId, indexId, fromBE, 
destBE}
          moves = TwoDimensionalGreedyAlgo.GetNextMoves(statMap, maxMoveNum)
           // The TabletSchedCtx which will add to TabletScheduler must have to 
specify the tablet id
           for move in moves:
               // pick a replica of [partitionId-indexId] on fromBE randomly 
               tabletId = randomPickFrom(move)
               tabletSchedCtx = generateSchedCtx(tabletId, move.srcBE, 
move.destBE)
               alternativeTablets.add(tabletSchedCtx)
   
       @override
       completeSchedCtx:
           // statMap may update, so we should check the move's validation. And 
the tablet may not need to move(means the partition & cluster are balanced), 
return false
           bool status = TwoDimensionalGreedyAlgo.checkValidation(move, statMap)
           if !status:
               // can't create balance task for this tablet
               return error
           // ... some other checks ...
           cacheSrcReplicaId(tabletId, replicaId)
   
       @override
       getToDeleteReplicaId:
           return getCachedSrcReplicaId(tabletId)
   
       @override
       updateLoadStatistic:
           super.updateLoadStatistic()
           if time_interval > config:
               ClearExpiredCache()
   ```
   
   - [ ] TwoDimensionalGreedyAlgo detail
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to