Login  Register

[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4010: [CARBONDATA-4050]Avoid redundant RPC calls to get file status when CarbonFile is instantiated with fileStatus constructor

Posted by GitBox on Nov 19, 2020; 7:54am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-VenuReddy2103-opened-a-new-pull-request-4010-CARBONDATA-4050-Avoid-redundant-RPC-cr-tp103268p103285.html


VenuReddy2103 commented on a change in pull request #4010:
URL: https://github.com/apache/carbondata/pull/4010#discussion_r526656764



##########
File path: core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
##########
@@ -541,7 +547,10 @@ public boolean createNewLockFile() throws IOException {
   @Override
   public String[] getLocations() throws IOException {
     BlockLocation[] blkLocations;
-    FileStatus fileStatus = fileSystem.getFileStatus(path);
+    FileStatus fileStatus = this.fileStatus;
+    if (fileStatus == null) {
+      fileStatus = fileSystem.getFileStatus(path);

Review comment:
       I think, as mentioned in PR #2465, we shouldn't get once and cache the filestatus in class field member. So have fixed to use the existing fileStatus from class field only if available (i.e., when Carbon file is instantiated with a `FileStatus` constructor `AbstractDFSCarbonFile(FileStatus fileStatus)`). This is particularly the case where we have obtained all the filestatuses in the segment and create carbonfiles with filestatus argument constructor. It happens only from implementation of `protected abstract CarbonFile[] getFiles(FileStatus[] listStatus);`




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

For queries about this service, please contact Infrastructure at:
[hidden email]