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 03:35:42 UTC

[GitHub] [incubator-uniffle] xianjingfeng opened a new pull request, #607: [MINOR] fix: Allow `mountPoint` do not contains '/'

xianjingfeng opened a new pull request, #607:
URL: https://github.com/apache/incubator-uniffle/pull/607

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://github.com/apache/incubator-uniffle/blob/master/CONTRIBUTING.md
     2. Ensure you have added or run the appropriate tests for your PR
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]XXXX Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
    Allow `mountPoint` do not contains '/'
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
    `mountPoint` is not always contains '/', such as `rootfs`
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   No need.


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


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

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108116231


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   I think it's not predictable. Depends on the CI environment.



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


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

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108035375


##########
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)`;



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


[GitHub] [incubator-uniffle] xianjingfeng merged pull request #607: [MINOR] fix: allow `mountPoint` not containing '/'

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
xianjingfeng merged PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607


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


[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #607: [MINOR] fix: allow `mountPoint` not containing '/'

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108136537


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   how about mock the `getDeviceName` method?
   
   Seems it was declared as static, maybe an instance method is easier to be mocked?



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


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

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
xianjingfeng commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108069906


##########
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:
   No suitable construction method found for `FileStore`, so I just turn line 65 to 67 to a method.



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


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

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
xianjingfeng commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108088675


##########
storage/src/main/java/org/apache/uniffle/storage/common/DefaultStorageMediaProvider.java:
##########
@@ -84,4 +83,12 @@ public StorageMedia getStorageMediaFor(String baseDir) {
     logger.info("Default storage type provider returns HDD by default");
     return StorageMedia.HDD;
   }
+
+  @VisibleForTesting
+  String getDeviceName(String mountPoint) {

Review Comment:
   Done



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


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

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108084231


##########
storage/src/main/java/org/apache/uniffle/storage/common/DefaultStorageMediaProvider.java:
##########
@@ -84,4 +83,12 @@ public StorageMedia getStorageMediaFor(String baseDir) {
     logger.info("Default storage type provider returns HDD by default");
     return StorageMedia.HDD;
   }
+
+  @VisibleForTesting
+  String getDeviceName(String mountPoint) {

Review Comment:
   Thanks @xianjingfeng for update the PR. Can it be static?



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


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

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
xianjingfeng commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108120251


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   I don't know how to do it. I don't know which path will return rootfs in CI environment.



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


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

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
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


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

Posted by "xianjingfeng (via GitHub)" <gi...@apache.org>.
xianjingfeng commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108188241


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   > how about mock the `getDeviceName` method?
   > 
   > Seems it was declared as static, maybe an instance method is easier to be mocked?
   
   I just tried, but failed. We need to specify the return value for `getStorageMediaFor`, otherwise null will be returned.



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


[GitHub] [incubator-uniffle] codecov-commenter commented on pull request #607: [MINOR] fix: Allow `mountPoint` do not contains '/'

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#issuecomment-1432460166

   # [Codecov](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#607](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c3d9235) into [master](https://codecov.io/gh/apache/incubator-uniffle/commit/7a8cdb044ddf19a5f659bd3879945fb41cd9329c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7a8cdb0) will **increase** coverage by `2.26%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master     #607      +/-   ##
   ============================================
   + Coverage     60.85%   63.11%   +2.26%     
   + Complexity     1800     1799       -1     
   ============================================
     Files           214      200      -14     
     Lines         12387    10417    -1970     
     Branches       1044     1045       +1     
   ============================================
   - Hits           7538     6575     -963     
   + Misses         4444     3497     -947     
   + Partials        405      345      -60     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...le/storage/common/DefaultStorageMediaProvider.java](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmFnZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvdW5pZmZsZS9zdG9yYWdlL2NvbW1vbi9EZWZhdWx0U3RvcmFnZU1lZGlhUHJvdmlkZXIuamF2YQ==) | `51.51% <0.00%> (-1.61%)` | :arrow_down: |
   | [...storage/handler/impl/DataSkippableReadHandler.java](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmFnZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvdW5pZmZsZS9zdG9yYWdlL2hhbmRsZXIvaW1wbC9EYXRhU2tpcHBhYmxlUmVhZEhhbmRsZXIuamF2YQ==) | `83.78% <0.00%> (-2.71%)` | :arrow_down: |
   | [...oy/kubernetes/operator/pkg/controller/util/util.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL2NvbnRyb2xsZXIvdXRpbC91dGlsLmdv) | | |
   | [...y/kubernetes/operator/pkg/webhook/inspector/rss.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3dlYmhvb2svaW5zcGVjdG9yL3Jzcy5nbw==) | | |
   | [deploy/kubernetes/operator/pkg/webhook/manager.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3dlYmhvb2svbWFuYWdlci5nbw==) | | |
   | [...y/kubernetes/operator/pkg/webhook/inspector/pod.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3dlYmhvb2svaW5zcGVjdG9yL3BvZC5nbw==) | | |
   | [...pkg/controller/sync/shuffleserver/shuffleserver.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL2NvbnRyb2xsZXIvc3luYy9zaHVmZmxlc2VydmVyL3NodWZmbGVzZXJ2ZXIuZ28=) | | |
   | [...eploy/kubernetes/operator/pkg/utils/coordinator.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3V0aWxzL2Nvb3JkaW5hdG9yLmdv) | | |
   | [deploy/kubernetes/operator/pkg/utils/util.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3V0aWxzL3V0aWwuZ28=) | | |
   | [...rnetes/operator/pkg/webhook/inspector/inspector.go](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGVwbG95L2t1YmVybmV0ZXMvb3BlcmF0b3IvcGtnL3dlYmhvb2svaW5zcGVjdG9yL2luc3BlY3Rvci5nbw==) | | |
   | ... and [6 more](https://codecov.io/gh/apache/incubator-uniffle/pull/607?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


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


[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #607: [MINOR] fix: allow `mountPoint` not containing '/'

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108204373


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   that doesn't make sense... 
   
   I'm ok with current status. Let's defer 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


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

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108114958


##########
storage/src/test/java/org/apache/uniffle/storage/common/DefaultStorageMediaProviderTest.java:
##########
@@ -40,4 +40,11 @@ public void testStorageProvider() {
     // invalid uri should also be reported as HDD
     assertEquals(StorageMedia.HDD, provider.getStorageMediaFor("file@xx:///path/to/a"));
   }
+
+  @Test
+  public void getGetDeviceName() {

Review Comment:
   could you also add `getStorageMediaFor` for "rootfs" path and check its return media is HDD or not?



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


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

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108035375


##########
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);`~~
   
   Edit: It is difficult to mock the filesystem in CI environment.
   Maybe it's better to turn line 64 to 67 to a method,
   `String deviceName = getDeviceName(fileStore);`



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


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

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #607:
URL: https://github.com/apache/incubator-uniffle/pull/607#discussion_r1108035375


##########
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);`



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