You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "xianjingfeng (via GitHub)" <gi...@apache.org> on 2023/02/16 05:55:09 UTC

[GitHub] [incubator-uniffle] xianjingfeng commented on a diff in pull request #607: [MINOR] fix: Allow `mountPoint` do not contains '/'

xianjingfeng commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108043642


##########
storage/src/main/java/org/apache/uniffle/storage/common/DefaultStorageMediaProvider.java:
##########
@@ -61,8 +61,9 @@ public StorageMedia getStorageMediaFor(String baseDir) {
       try {
         File baseFile = new File(baseDir);
         FileStore store = Files.getFileStore(baseFile.toPath());
-        String mountPoint = store.name(); // mountPoint would be /dev/sda1 or /dev/vda1, etc.
-        String deviceName = mountPoint.substring(mountPoint.lastIndexOf(File.separator));
+        String mountPoint = store.name(); // mountPoint would be /dev/sda1, /dev/vda1, rootfs, etc.
+        int separatorIndex = mountPoint.lastIndexOf(File.separator);
+        String deviceName = separatorIndex > -1 ? mountPoint.substring(separatorIndex) : mountPoint;

Review Comment:
   > Let's turn line 62 to 67 to a method and add a UT for it? `String deviceName = getDeviceName(baseDir)`;
   
   `mountPoint` is different for different environments. I have no good idea to do this. May be we can turn line 64 to 67 to a method and add a UT for it.



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