kunal642 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_r249724367 ########## 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: done ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |