public DeleteDeltaInfo(String[] deleteDeltaFile) { this.deleteDeltaFile = deleteDeltaFile; this.latestDeleteDeltaFileTimestamp = CarbonUpdateUtil.getLatestDeleteDeltaTimestamp(deleteDeltaFile); }
/** * Below method will be used to check row got deleted * * @param rowId * @return is present in deleted row */ public boolean containsDeletedRow(int rowId) { if (null != currentDeleteDeltaVo) { return currentDeleteDeltaVo.containsRow(rowId); } return false; }
/** * returns segment along with block id * @param Tid * @return */ public static String getSegmentWithBlockFromTID(String Tid) { return getRequiredFieldFromTID(Tid, TupleIdEnum.SEGMENT_ID) + CarbonCommonConstants.FILE_SEPARATOR + getRequiredFieldFromTID(Tid, TupleIdEnum.BLOCK_ID); }
/** * populate the block and its details in a map. */ private void populateMap() { blockAndDetailsMap = new HashMap<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); for (SegmentUpdateDetails blockDetails : updateDetails) { String blockIdentifier = CarbonUpdateUtil .getSegmentBlockNameKey(blockDetails.getSegmentName(), blockDetails.getActualBlockName()); blockAndDetailsMap.put(blockIdentifier, blockDetails); } }
/** * check the block whether is valid * * @param segName segment name * @param blockName block name * @return the status of block whether is valid */ public boolean isBlockValid(String segName, String blockName) { SegmentUpdateDetails details = getDetailsForABlock(segName, blockName); return details == null || !CarbonUpdateUtil.isBlockInvalid(details.getSegmentStatus()); } /**
public boolean addBlocklet(String blockletId, String offset, Integer pageId) throws Exception { DeleteDeltaBlockletDetails blocklet = new DeleteDeltaBlockletDetails(blockletId, pageId); try { blocklet.addDeletedRow(CarbonUpdateUtil.getIntegerValue(offset)); return addBlockletDetails(blocklet); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(e.getMessage()); } throw e; } } }
TableSegmentRefresher(CarbonTable table) { SegmentUpdateStatusManager statusManager = new SegmentUpdateStatusManager(table); SegmentUpdateDetails[] updateStatusDetails = statusManager.getUpdateStatusDetails(); for (SegmentUpdateDetails updateDetails : updateStatusDetails) { UpdateVO updateVO = statusManager.getInvalidTimestampRange(updateDetails.getSegmentName()); segmentRefreshTime.put(updateVO.getSegmentId(), new SegmentRefreshInfo(updateVO.getCreatedOrUpdatedTimeStamp(), 0)); } }
public boolean addBlockletDetails(DeleteDeltaBlockletDetails blocklet) { DeleteDeltaBlockletDetails deleteDeltaBlockletDetails = blockletDetailsMap.get(blocklet.getBlockletKey()); if (null == deleteDeltaBlockletDetails) { blockletDetailsMap.put(blocklet.getBlockletKey(), blocklet); return true; } else { deleteDeltaBlockletDetails.addDeletedRows(blocklet.getDeletedRows()); return true; } }
/** * * @param segID * @param actualBlockName * @return null if block is not present in segment update status. */ private SegmentUpdateDetails getDetailsForABlock(String segID, String actualBlockName) { String blockIdentifier = CarbonUpdateUtil .getSegmentBlockNameKey(segID, actualBlockName); return blockAndDetailsMap.get(blockIdentifier); }
/** * * @param details * @param segmentBlockCount */ public static void decrementDeletedBlockCount(SegmentUpdateDetails details, Map<String, Long> segmentBlockCount) { String segId = details.getSegmentName(); segmentBlockCount.put(details.getSegmentName(), segmentBlockCount.get(segId) - 1); }
/** * updates segment status and modificaton time details * * @param loadMetadata */ public static void updateSegmentMetadataDetails(LoadMetadataDetails loadMetadata) { // update status only if the segment is not marked for delete if (SegmentStatus.MARKED_FOR_DELETE != loadMetadata.getSegmentStatus()) { loadMetadata.setSegmentStatus(SegmentStatus.MARKED_FOR_DELETE); loadMetadata.setModificationOrdeletionTimesStamp(CarbonUpdateUtil.readCurrentTime()); } }
/** * return deleteDeltaTime as long * * @return */ public long getDeleteDeltaStartTimeAsLong() { return getTimeStampAsLong(deleteDeltaStartTimestamp); }
@Override public int hashCode() { return super.hashCode(); } }
@Override public boolean equals(Object obj) { return super.equals(obj); }
/** * * @param extension * @param block * @return */ private long getStartTimeOfDeltaFile(String extension, SegmentUpdateDetails block) { long startTimestamp; switch (extension) { case CarbonCommonConstants.DELETE_DELTA_FILE_EXT: startTimestamp = block.getDeleteDeltaStartTimeAsLong(); break; default: startTimestamp = 0; } return startTimestamp; }
/** * * @param extension * @param block * @return */ private long getEndTimeOfDeltaFile(String extension, SegmentUpdateDetails block) { long endTimestamp; switch (extension) { case CarbonCommonConstants.DELETE_DELTA_FILE_EXT: endTimestamp = block.getDeleteDeltaEndTimeAsLong(); break; default: endTimestamp = 0; } return endTimestamp; }
public void setInvalidBlockForSegmentId(List<UpdateVO> invalidSegmentTimestampList) { for (UpdateVO anUpdateVO : invalidSegmentTimestampList) { this.invalidSegmentBlockIdMap.put(anUpdateVO.getSegmentId(), anUpdateVO); } }
/** * returns required filed from tuple id * * @param Tid * @param tid * @return */ public static String getRequiredFieldFromTID(String Tid, TupleIdEnum tid) { return Tid.split("/")[tid.getTupleIdIndex()]; }
public SegmentRefreshInfo getCommittedSegmentRefreshInfo(Segment segment, UpdateVO updateVo) throws IOException { SegmentRefreshInfo segmentRefreshInfo; if (updateVo != null) { segmentRefreshInfo = new SegmentRefreshInfo(updateVo.getCreatedOrUpdatedTimeStamp(), 0); } else { segmentRefreshInfo = new SegmentRefreshInfo(0L, 0); } return segmentRefreshInfo; }
/** * return deleteDeltaTime as long * * @return */ public long getDeleteDeltaEndTimeAsLong() { return getTimeStampAsLong(deleteDeltaEndTimestamp); }