ravipesala commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server
URL: https://github.com/apache/carbondata/pull/3177#discussion_r279632177 ########## File path: core/src/main/java/org/apache/carbondata/core/datamap/DistributableDataMapFormat.java ########## @@ -85,33 +143,67 @@ private ExtendedBlocklet currBlocklet; private List<DataMap> dataMaps; - @Override public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) + @Override + public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException { - distributable = (DataMapDistributableWrapper) inputSplit; - // clear the segmentMap and from cache in executor when there are invalid segments - if (invalidSegments.size() > 0) { - DataMapStoreManager.getInstance().clearInvalidSegments(table, invalidSegments); - } - TableDataMap tableDataMap = DataMapStoreManager.getInstance() - .getDataMap(table, distributable.getDistributable().getDataMapSchema()); + DataMapDistributableWrapper distributable = (DataMapDistributableWrapper) inputSplit; + distributable.getDistributable().getSegment().setCacheable(!isFallbackJob); + distributable.getDistributable().getSegment().setReadCommittedScope(readCommittedScope); + List<Segment> segmentsToLoad = new ArrayList<>(); + segmentsToLoad.add(distributable.getDistributable().getSegment()); if (isJobToClearDataMaps) { - // if job is to clear datamaps just clear datamaps from cache and return - DataMapStoreManager.getInstance() - .clearDataMaps(table.getCarbonTableIdentifier().getTableUniqueName()); - // clear the segment properties cache from executor - SegmentPropertiesAndSchemaHolder.getInstance() - .invalidate(table.getAbsoluteTableIdentifier()); - blockletIterator = Collections.emptyIterator(); + if (StringUtils.isNotEmpty(dataMapToClear)) { + List<TableDataMap> dataMaps = + DataMapStoreManager.getInstance().getAllVisibleDataMap(table); + List<TableDataMap> dataMapsTobeRemoved = new ArrayList<>(); + for (TableDataMap tableDataMap : dataMaps) { + if (tableDataMap != null && dataMapToClear + .equalsIgnoreCase(tableDataMap.getDataMapSchema().getDataMapName())) { + tableDataMap.deleteSegmentDatamapData( + ((DataMapDistributableWrapper) inputSplit).getDistributable().getSegment() + .getSegmentNo()); + dataMapsTobeRemoved.add(tableDataMap); + } + } + dataMaps.removeAll(dataMapsTobeRemoved); + DataMapStoreManager.getInstance().getAllDataMaps().put(table.getTableUniqueName(), + dataMaps); + } else { + // if job is to clear datamaps just clear datamaps from cache and return + DataMapStoreManager.getInstance() + .clearDataMaps(table.getCarbonTableIdentifier().getTableUniqueName()); + // clear the segment properties cache from executor + SegmentPropertiesAndSchemaHolder.getInstance() + .invalidate(table.getAbsoluteTableIdentifier()); + } + List<ExtendedBlocklet> list = new ArrayList<ExtendedBlocklet>(); + list.add(new ExtendedBlocklet()); + blockletIterator = list.iterator(); return; + } else if (invalidSegments.size() > 0) { + // clear the segmentMap and from cache in executor when there are invalid segments + DataMapStoreManager.getInstance().clearInvalidSegments(table, invalidSegments); } - dataMaps = tableDataMap.getTableDataMaps(distributable.getDistributable()); - List<ExtendedBlocklet> blocklets = tableDataMap - .prune(dataMaps, - distributable.getDistributable(), + SegmentUpdateStatusManager updateStatusManager = new SegmentUpdateStatusManager(table); Review comment: It is very heavy to read update status file and tablestatus file inside this class. Better create SegmentUpdateStatusManager for each segment in the driver and serialize and send here ---------------------------------------------------------------- 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] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |