@Override public boolean next(List<Cell> results) throws IOException { return next(results, -1); }
public byte[] toByteArray() throws IOException { // TODO: in the future actual serialization here should be done using protobufs ByteArrayOutputStream bos = new ByteArrayOutputStream(); write(new DataOutputStream(bos)); return bos.toByteArray(); }
public static Filter parseFrom(final byte [] pbBytes) throws DeserializationException { DequeueFilter filter = new DequeueFilter(); try { filter.readFields(new DataInputStream(new ByteArrayInputStream(pbBytes))); } catch (IOException ioe) { throw new DeserializationException(ioe); } return filter; } }
if (!isProcessed(cell, consumerInstance)) { break; if (startRow != null && compareRowKey(cell, startRow) < 0) { consumedGroups++; || compareRowKey(result.get(0), consumerConfig.getSmallestStartRow()) < 0;
@Override public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store, InternalScanner scanner) throws IOException { if (!e.getEnvironment().getRegion().isAvailable()) { return scanner; } LOG.info("preFlush, creates EvictionInternalScanner"); return new EvictionInternalScanner("flush", e.getEnvironment(), scanner); }
@Override public void filterRow(List<KeyValue> kvs) { byte[] dataBytes = null; byte[] metaBytes = null; byte[] stateBytes = null; // list is very short so it is ok to loop thru to find columns for (KeyValue kv : kvs) { if (hasQualifier(kv, QueueEntryRow.DATA_COLUMN)) { dataBytes = kv.getValue(); } else if (hasQualifier(kv, QueueEntryRow.META_COLUMN)) { metaBytes = kv.getValue(); } else if (hasQualifier(kv, stateColumnName)) { stateBytes = kv.getValue(); } } if (dataBytes == null || metaBytes == null) { skipRow = true; return; } QueueEntryRow.CanConsume canConsume = QueueEntryRow.canConsume(consumerConfig, transaction, writePointer, counter, metaBytes, stateBytes); // Only skip the row when canConsumer == NO, so that in case of NO_INCLUDING_ALL_OLDER, the client // can still see the row and move the scan start row. skipRow = canConsume == QueueEntryRow.CanConsume.NO; }
@Override public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan, RegionScanner s) throws IOException { ConsumerConfig consumerConfig = DequeueScanAttributes.getConsumerConfig(scan); Transaction tx = DequeueScanAttributes.getTx(scan); byte[] queueRowPrefix = DequeueScanAttributes.getQueueRowPrefix(scan); if (consumerConfig == null || tx == null || queueRowPrefix == null) { return super.preScannerOpen(e, scan, s); } Filter dequeueFilter = new DequeueFilter(queueRowPrefix, consumerConfig, tx); Filter existing = scan.getFilter(); if (existing != null) { Filter combined = new FilterList(FilterList.Operator.MUST_PASS_ALL, existing, dequeueFilter); scan.setFilter(combined); } else { scan.setFilter(dequeueFilter); } return super.preScannerOpen(e, scan, s); } }
if (canEvict(consumerConfig, results)) { rowsEvicted++; results.clear();
@Override public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store, InternalScanner scanner, ScanType type, CompactionRequest request) throws IOException { if (!e.getEnvironment().getRegion().isAvailable()) { return scanner; } LOG.info("preCompact, creates EvictionInternalScanner"); return new EvictionInternalScanner("compaction", e.getEnvironment(), scanner); }