akashrn5 commented on a change in pull request #3907:
URL: https://github.com/apache/carbondata/pull/3907#discussion_r481198186



##########
File path: 
core/src/main/java/org/apache/carbondata/core/index/IndexStoreManager.java
##########
@@ -515,15 +516,16 @@ public TableSegmentRefresher 
getTableSegmentRefresher(CarbonTable table) {
         UpdateVO updateVO =
             
SegmentUpdateStatusManager.getInvalidTimestampRange(segment.getLoadMetadataDetails());
         SegmentRefreshInfo segmentRefreshInfo;
-        if ((updateVO != null && updateVO.getLatestUpdateTimestamp() != null)
-            || segment.getSegmentFileName() != null) {
-          long segmentFileTimeStamp;
+        if (updateVO.getLatestUpdateTimestamp() != null || 
segment.getSegmentFileName() != null) {
+          long segmentFileTimeStamp = 0L;
           if (null != segment.getLoadMetadataDetails()) {
             segmentFileTimeStamp = 
segment.getLoadMetadataDetails().getLastModifiedTime();
           } else {
-            segmentFileTimeStamp = FileFactory.getCarbonFile(CarbonTablePath
-                .getSegmentFilePath(table.getTablePath(), 
segment.getSegmentFileName()))
-                .getLastModifiedTime();
+            CarbonFile segmentFile = FileFactory.getCarbonFile(CarbonTablePath
+                .getSegmentFilePath(table.getTablePath(), 
segment.getSegmentFileName()));
+            if (segmentFile.exists()) {

Review comment:
       1. even though when the segment object exists, if concurrently 
operations are happening like like or compaction, you can consider SI also, 
then we will modify the segment file, which is basically overwrite, then that 
corner case it will fail, so in that case, above scenario will happen, so no 
need to throw exception.
   
   2. can refer PR #3814 
   
   3. we cannot differentiate between positive case and negative case, in order 
to query or the operation to succeed, we should take these steps, which we 
follow all places in carbon.




----------------------------------------------------------------
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:
[email protected]


Reply via email to