org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController Java Examples

The following examples show how to use org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InterRegionServerRpcController.java    From phoenix-omid with Apache License 2.0 4 votes vote down vote up
public InterRegionServerRpcController(PayloadCarryingRpcController delegate, Configuration conf) {
    super(delegate);
    // Set priority higher that normal, but lower than high
    this.priority = (HConstants.HIGH_QOS + HConstants.NORMAL_QOS) / 2;
}
 
Example #2
Source File: InterRegionServerRpcControllerFactory.java    From phoenix-omid with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController() {
    PayloadCarryingRpcController delegate = super.newController();
    return getController(delegate);
}
 
Example #3
Source File: InterRegionServerRpcControllerFactory.java    From phoenix-omid with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(CellScanner cellScanner) {
    PayloadCarryingRpcController delegate = super.newController(cellScanner);
    return getController(delegate);
}
 
Example #4
Source File: InterRegionServerRpcControllerFactory.java    From phoenix-omid with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(List<CellScannable> cellIterables) {
    PayloadCarryingRpcController delegate = super.newController(cellIterables);
    return getController(delegate);
}
 
Example #5
Source File: InterRegionServerRpcControllerFactory.java    From phoenix-omid with Apache License 2.0 4 votes vote down vote up
private PayloadCarryingRpcController getController(PayloadCarryingRpcController delegate) {
    // construct a chain of controllers
    return new InterRegionServerRpcController(delegate, conf);
}
 
Example #6
Source File: IndexQosRpcControllerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController() {
    PayloadCarryingRpcController delegate = super.newController();
    return new IndexQosRpcController(delegate, conf);
}
 
Example #7
Source File: IndexQosRpcControllerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(CellScanner cellScanner) {
    PayloadCarryingRpcController delegate = super.newController(cellScanner);
    return new IndexQosRpcController(delegate, conf);
}
 
Example #8
Source File: IndexQosRpcControllerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(List<CellScannable> cellIterables) {
    PayloadCarryingRpcController delegate = super.newController(cellIterables);
    return new IndexQosRpcController(delegate, conf);
}
 
Example #9
Source File: IndexQosRpcControllerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public IndexQosRpcController(PayloadCarryingRpcController delegate, Configuration conf) {
    super(delegate);
    this.conf = conf;
    this.priority = PhoenixIndexRpcSchedulerFactory.getMinPriority(conf);
}
 
Example #10
Source File: IndexHandlerIT.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController() {
    PayloadCarryingRpcController controller = delegate.newController();
    return new CountingIndexClientRpcController(controller);
}
 
Example #11
Source File: IndexHandlerIT.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(CellScanner cellScanner) {
    PayloadCarryingRpcController controller = delegate.newController(cellScanner);
    return new CountingIndexClientRpcController(controller);
}
 
Example #12
Source File: IndexHandlerIT.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public PayloadCarryingRpcController newController(List<CellScannable> cellIterables) {
    PayloadCarryingRpcController controller = delegate.newController(cellIterables);
    return new CountingIndexClientRpcController(controller);
}
 
Example #13
Source File: IndexHandlerIT.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public CountingIndexClientRpcController(PayloadCarryingRpcController delegate) {
    super(delegate);
}
 
Example #14
Source File: SepConsumer.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
@Override
public AdminProtos.ReplicateWALEntryResponse replicateWALEntry(final RpcController controller,
        final AdminProtos.ReplicateWALEntryRequest request) throws ServiceException {
    try {

        // TODO Recording of last processed timestamp won't work if two batches of log entries are sent out of order
        long lastProcessedTimestamp = -1;

        SepEventExecutor eventExecutor = new SepEventExecutor(listener, executors, 100, sepMetrics);

        List<AdminProtos.WALEntry> entries = request.getEntryList();
        CellScanner cells = ((PayloadCarryingRpcController)controller).cellScanner();

        for (final AdminProtos.WALEntry entry : entries) {
            TableName tableName = (entry.getKey().getWriteTime() < subscriptionTimestamp) ? null :
                    TableName.valueOf(entry.getKey().getTableName().toByteArray());
            Multimap<ByteBuffer, Cell> keyValuesPerRowKey = ArrayListMultimap.create();
            final Map<ByteBuffer, byte[]> payloadPerRowKey = Maps.newHashMap();
            int count = entry.getAssociatedCellCount();
            for (int i = 0; i < count; i++) {
                if (!cells.advance()) {
                    throw new ArrayIndexOutOfBoundsException("Expected=" + count + ", index=" + i);
                }

                // this signals to us that we simply need to skip over count of cells
                if (tableName == null) {
                    continue;
                }

                Cell cell = cells.current();
                ByteBuffer rowKey = ByteBuffer.wrap(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
                byte[] payload;
                KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
                if (payloadExtractor != null && (payload = payloadExtractor.extractPayload(tableName.toBytes(), kv)) != null) {
                    if (payloadPerRowKey.containsKey(rowKey)) {
                        log.error("Multiple payloads encountered for row " + Bytes.toStringBinary(rowKey)
                                + ", choosing " + Bytes.toStringBinary(payloadPerRowKey.get(rowKey)));
                    } else {
                        payloadPerRowKey.put(rowKey, payload);
                    }
                }
                keyValuesPerRowKey.put(rowKey, kv);
            }

            for (final ByteBuffer rowKeyBuffer : keyValuesPerRowKey.keySet()) {
                final List<Cell> keyValues = (List<Cell>) keyValuesPerRowKey.get(rowKeyBuffer);

                final SepEvent sepEvent = new SepEvent(tableName.toBytes(), CellUtil.cloneRow(keyValues.get(0)), keyValues,
                        payloadPerRowKey.get(rowKeyBuffer));
                eventExecutor.scheduleSepEvent(sepEvent);
                lastProcessedTimestamp = Math.max(lastProcessedTimestamp, entry.getKey().getWriteTime());
            }

        }
        List<Future<?>> futures = eventExecutor.flush();
        waitOnSepEventCompletion(futures);

        if (lastProcessedTimestamp > 0) {
            sepMetrics.reportSepTimestamp(lastProcessedTimestamp);
        }
        return AdminProtos.ReplicateWALEntryResponse.newBuilder().build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}