@@ -228,33 +228,39 @@ fn assert_enforce_nodes_cpu_capacity_post_condition(
228
228
// If this algorithm fails to place all remaining shards, we inflate
229
229
// the node capacities by 20% in the scheduling problem and start from the beginning.
230
230
231
- #[ derive( Debug , PartialEq , Eq , Ord ) ]
231
+ #[ derive( Debug , PartialEq , Eq ) ]
232
232
struct PlacementCandidate {
233
233
indexer_ord : IndexerOrd ,
234
234
current_num_shards : u32 ,
235
235
available_capacity : CpuCapacity ,
236
236
affinity : u32 ,
237
237
}
238
238
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 {
241
241
// Higher affinity is better
242
242
match self . affinity . cmp ( & other. affinity ) {
243
243
Ordering :: Equal => { }
244
- ordering => return Some ( ordering. reverse ( ) ) ,
244
+ ordering => return ordering. reverse ( ) ,
245
245
}
246
246
// If tie, pick the node with shards already assigned first
247
247
match self . current_num_shards . cmp ( & other. current_num_shards ) {
248
248
Ordering :: Equal => { }
249
- ordering => return Some ( ordering. reverse ( ) ) ,
249
+ ordering => return ordering. reverse ( ) ,
250
250
}
251
251
// If tie, pick the node with the highest available capacity
252
252
match self . available_capacity . cmp ( & other. available_capacity ) {
253
253
Ordering :: Equal => { }
254
- ordering => return Some ( ordering. reverse ( ) ) ,
254
+ ordering => return ordering. reverse ( ) ,
255
255
}
256
256
// 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) )
258
264
}
259
265
}
260
266
0 commit comments