@Override protected void reset() { deletes.reset(); }
protected final MatchCode checkDeleted(DeleteTracker deletes, Cell cell) { if (deletes.isEmpty() && !(deletes instanceof NewVersionBehaviorTracker)) { return null; } // MvccSensitiveTracker always need check all cells to save some infos. DeleteResult deleteResult = deletes.isDeleted(cell); switch (deleteResult) { case FAMILY_DELETED: case COLUMN_DELETED: if (!(deletes instanceof NewVersionBehaviorTracker)) { // MvccSensitive can not seek to next because the Put with lower ts may have higher mvcc return columns.getNextRowOrNextColumn(cell); } case VERSION_DELETED: case FAMILY_VERSION_DELETED: case VERSION_MASKED: return MatchCode.SKIP; case NOT_DELETED: return null; default: throw new RuntimeException("Unexpected delete result: " + deleteResult); } }
@Override public void beforeShipped() throws IOException { super.beforeShipped(); deletes.beforeShipped(); }
protected final void trackDelete(Cell cell) { // If keepDeletedCells is true, then we only remove cells by versions or TTL during // compaction, so we do not need to track delete here. // If keepDeletedCells is TTL and the delete marker is expired, then we can make sure that the // minVerions is larger than 0(otherwise we will just return at preCheck). So here we still // need to track the delete marker to see if it masks some cells. if (keepDeletedCells == KeepDeletedCells.FALSE || (keepDeletedCells == KeepDeletedCells.TTL && cell.getTimestamp() < oldestUnexpiredTS)) { deletes.add(cell); } }
@Override public DeleteTracker postInstantiateDeleteTracker( ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker) throws IOException { // Nothing to do if we are not filtering by visibility if (!authorizationEnabled) { return delTracker; } Region region = ctx.getEnvironment().getRegion(); TableName table = region.getRegionInfo().getTable(); if (table.isSystemTable()) { return delTracker; } // We are creating a new type of delete tracker here which is able to track // the timestamps and also the // visibility tags per cell. The covering cells are determined not only // based on the delete type and ts // but also on the visibility expression matching. return new VisibilityScanDeleteTracker(delTracker.getCellComparator()); }
@Override public void beforeShipped() throws IOException { super.beforeShipped(); deletes.beforeShipped(); }
@Override public MatchCode match(Cell cell) throws IOException { if (filter != null && filter.filterAllRemaining()) { return MatchCode.DONE_SCAN; } MatchCode returnCode = preCheck(cell); if (returnCode != null) { return returnCode; } long timestamp = cell.getTimestamp(); byte typeByte = cell.getTypeByte(); if (PrivateCellUtil.isDelete(typeByte)) { boolean includeDeleteMarker = seePastDeleteMarkers ? tr.withinTimeRange(timestamp) : tr.withinOrAfterTimeRange(timestamp); if (includeDeleteMarker) { this.deletes.add(cell); } return MatchCode.SKIP; } returnCode = checkDeleted(deletes, cell); if (returnCode != null) { return returnCode; } return matchColumn(cell, timestamp, typeByte); }
@Override protected void reset() { deletes.reset(); }