This is an automated email from the ASF dual-hosted git repository.

nicholasjiang pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/celeborn.git

commit d881e0b47336dcd49440a13ef4e60597447c0516
Author: SteNicholas <[email protected]>
AuthorDate: Wed Aug 6 10:36:07 2025 +0800

    [CELEBORN-1844][FOLLOWUP] Fix the condition of StoragePolicy that worker 
uses memory storage
    
    ### What changes were proposed in this pull request?
    
    Fix the condition of `StoragePolicy` that worker uses memory storage
    
    ### Why are the changes needed?
    
    The condition of `StoragePolicy` that worker uses memory storage is 
`order.contains(StorageInfo.Type.MEMORY.name())`, which condition is wrong 
because `Option#contains` is as follows:
    
    ```
    final def contains[A1 >: A](elem: A1): Boolean = !isEmpty && this.get == 
elem
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    CI.
    
    Closes #3408 from SteNicholas/CELEBORN-1844.
    
    Authored-by: SteNicholas <[email protected]>
    Signed-off-by: mingji <[email protected]>
    (cherry picked from commit 5a459250b08818b6c57e76c76fb941a49e629c08)
    Signed-off-by: mingji <[email protected]>
---
 .../apache/celeborn/service/deploy/worker/storage/StoragePolicy.scala   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StoragePolicy.scala
 
b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StoragePolicy.scala
index db6123e0a..798ad165e 100644
--- 
a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StoragePolicy.scala
+++ 
b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StoragePolicy.scala
@@ -188,7 +188,7 @@ class StoragePolicy(conf: CelebornConf, storageManager: 
StorageManager, source:
         // keep the old behavior, always try to use memory if worker
         // has configured to use memory storage, because slots allocator
         // will not allocate slots on memory storage
-        if (order.contains(StorageInfo.Type.MEMORY.name())) {
+        if (order.exists(_.contains(StorageInfo.Type.MEMORY.name()))) {
           order.get.indexOf(StorageInfo.Type.MEMORY.name())
         } else {
           order.get.indexOf(

Reply via email to