You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/01/22 10:30:52 UTC

[GitHub] kumarvishal09 commented on a change in pull request #3090: [CARBONDATA-3262] Fix merge index failure handling for compacted segment

kumarvishal09 commented on a change in pull request #3090: [CARBONDATA-3262] Fix merge index failure handling for compacted segment
URL: https://github.com/apache/carbondata/pull/3090#discussion_r249722232
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/writer/CarbonIndexFileMergeWriter.java
 ##########
 @@ -69,26 +73,31 @@ public CarbonIndexFileMergeWriter(CarbonTable table) {
   private String mergeCarbonIndexFilesOfSegment(String segmentId,
       String tablePath, List<String> indexFileNamesTobeAdded,
       boolean readFileFooterFromCarbonDataFile, String uuid) throws IOException {
-    Segment segment = Segment.getSegment(segmentId, tablePath);
-    String segmentPath = CarbonTablePath.getSegmentPath(tablePath, segmentId);
-    CarbonFile[] indexFiles;
-    SegmentFileStore sfs = null;
-    if (segment != null && segment.getSegmentFileName() != null) {
-      sfs = new SegmentFileStore(tablePath, segment.getSegmentFileName());
-      List<CarbonFile> indexCarbonFiles = sfs.getIndexCarbonFiles();
-      indexFiles = indexCarbonFiles.toArray(new CarbonFile[indexCarbonFiles.size()]);
-    } else {
-      indexFiles =
-          SegmentIndexFileStore.getCarbonIndexFiles(segmentPath, FileFactory.getConfiguration());
-    }
-    if (isCarbonIndexFilePresent(indexFiles) || indexFileNamesTobeAdded != null) {
-      if (sfs == null) {
-        return writeMergeIndexFileBasedOnSegmentFolder(indexFileNamesTobeAdded,
-            readFileFooterFromCarbonDataFile, segmentPath, indexFiles, segmentId);
+    try {
+      Segment segment = Segment.getSegment(segmentId, tablePath);
+      String segmentPath = CarbonTablePath.getSegmentPath(tablePath, segmentId);
+      CarbonFile[] indexFiles;
+      SegmentFileStore sfs = null;
+      if (segment != null && segment.getSegmentFileName() != null) {
+        sfs = new SegmentFileStore(tablePath, segment.getSegmentFileName());
+        List<CarbonFile> indexCarbonFiles = sfs.getIndexCarbonFiles();
+        indexFiles = indexCarbonFiles.toArray(new CarbonFile[indexCarbonFiles.size()]);
       } else {
-        return writeMergeIndexFileBasedOnSegmentFile(
-            segmentId, indexFileNamesTobeAdded, sfs, indexFiles, uuid);
+        indexFiles =
+            SegmentIndexFileStore.getCarbonIndexFiles(segmentPath, FileFactory.getConfiguration());
+      }
+      if (isCarbonIndexFilePresent(indexFiles) || indexFileNamesTobeAdded != null) {
+        if (sfs == null) {
+          return writeMergeIndexFileBasedOnSegmentFolder(indexFileNamesTobeAdded,
+              readFileFooterFromCarbonDataFile, segmentPath, indexFiles, segmentId);
+        } else {
+          return writeMergeIndexFileBasedOnSegmentFile(segmentId, indexFileNamesTobeAdded, sfs,
+              indexFiles, uuid);
+        }
       }
+    } catch (Exception e) {
 
 Review comment:
   Can we catch specific exception(IOException) here ?? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services