You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by GitBox <gi...@apache.org> on 2022/09/26 02:12:29 UTC

[GitHub] [incubator-uniffle] zuston commented on a diff in pull request #235: Write to hdfs when local disk can't be write

zuston commented on code in PR #235:
URL: https://github.com/apache/incubator-uniffle/pull/235#discussion_r979509794


##########
server/src/main/java/org/apache/uniffle/server/storage/MultiStorageManager.java:
##########
@@ -71,7 +71,7 @@ public void updateWriteMetrics(ShuffleDataFlushEvent event, long writeTime) {
   @Override
   public boolean write(Storage storage, ShuffleWriteHandler handler, ShuffleDataFlushEvent event) {
     StorageManager storageManager = selectStorageManager(event);
-    if (storageManager == coldStorageManager && event.getRetryTimes() > fallBackTimes) {
+    if (event.getRetryTimes() > fallBackTimes) {

Review Comment:
   Why not put these select condition into one abstract method? such as being involved in `selectStorageManager`



##########
server/src/main/java/org/apache/uniffle/server/storage/MultiStorageManager.java:
##########
@@ -80,24 +80,43 @@ public boolean write(Storage storage, ShuffleWriteHandler handler, ShuffleDataFl
         if (request == null) {
           return false;
         }
-        storage = warmStorageManager.selectStorage(event);
+        storageManager = storageManager == warmStorageManager ? coldStorageManager : warmStorageManager;
+        event.setStorageManager(storageManager);
+        storage = storageManager.selectStorage(event);
         handler = storage.getOrCreateWriteHandler(request);
       } catch (IOException ioe) {
         LOG.warn("Create fallback write handler failed ", ioe);
         return false;
       }
-      return warmStorageManager.write(storage, handler, event);
+      return storageManager.write(storage, handler, event);
     } else {
       return storageManager.write(storage, handler, event);
     }
   }
 
   private StorageManager selectStorageManager(ShuffleDataFlushEvent event) {
+    if (event.getStorageManager() != null) {

Review Comment:
   Good idea!



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

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org