@@ -228,33 +228,39 @@ fn assert_enforce_nodes_cpu_capacity_post_condition(
228228// If this algorithm fails to place all remaining shards, we inflate
229229// the node capacities by 20% in the scheduling problem and start from the beginning.
230230
231- #[ derive( Debug , PartialEq , Eq , Ord ) ]
231+ #[ derive( Debug , PartialEq , Eq ) ]
232232struct PlacementCandidate {
233233 indexer_ord : IndexerOrd ,
234234 current_num_shards : u32 ,
235235 available_capacity : CpuCapacity ,
236236 affinity : u32 ,
237237}
238238
239- impl PartialOrd for PlacementCandidate {
240- fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
239+ impl Ord for PlacementCandidate {
240+ fn cmp ( & self , other : & Self ) -> Ordering {
241241 // Higher affinity is better
242242 match self . affinity . cmp ( & other. affinity ) {
243243 Ordering :: Equal => { }
244- ordering => return Some ( ordering. reverse ( ) ) ,
244+ ordering => return ordering. reverse ( ) ,
245245 }
246246 // If tie, pick the node with shards already assigned first
247247 match self . current_num_shards . cmp ( & other. current_num_shards ) {
248248 Ordering :: Equal => { }
249- ordering => return Some ( ordering. reverse ( ) ) ,
249+ ordering => return ordering. reverse ( ) ,
250250 }
251251 // If tie, pick the node with the highest available capacity
252252 match self . available_capacity . cmp ( & other. available_capacity ) {
253253 Ordering :: Equal => { }
254- ordering => return Some ( ordering. reverse ( ) ) ,
254+ ordering => return ordering. reverse ( ) ,
255255 }
256256 // Final tie-breaker: indexer ID for deterministic ordering
257- Some ( self . indexer_ord . cmp ( & other. indexer_ord ) . reverse ( ) )
257+ self . indexer_ord . cmp ( & other. indexer_ord ) . reverse ( )
258+ }
259+ }
260+
261+ impl PartialOrd for PlacementCandidate {
262+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
263+ Some ( self . cmp ( other) )
258264 }
259265}
260266
0 commit comments