Java Code Examples for org.apache.hadoop.hbase.client.Get#getAttribute()

The following examples show how to use org.apache.hadoop.hbase.client.Get#getAttribute() . 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: OmidSnapshotFilter.java    From phoenix-omid with Apache License 2.0 5 votes vote down vote up
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results)
        throws IOException {

    if (get.getAttribute(CellUtils.CLIENT_GET_ATTRIBUTE) == null) return;
    boolean isLowLatency = Bytes.toBoolean(get.getAttribute(CellUtils.LL_ATTRIBUTE));
    HBaseTransaction hbaseTransaction = getHBaseTransaction(get.getAttribute(CellUtils.TRANSACTION_ATTRIBUTE),
            isLowLatency);
    SnapshotFilterImpl snapshotFilter = getSnapshotFilter(e);
    snapshotFilterMap.put(get, snapshotFilter);

    get.setMaxVersions();
    Filter newFilter = TransactionFilters.getVisibilityFilter(get.getFilter(),
            snapshotFilter, hbaseTransaction);
    get.setFilter(newFilter);
}
 
Example 2
Source File: ErrorThrowingGetObserver.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e,
                     Get get, List<Cell> results) throws IOException {
  byte[] errorType = get.getAttribute(SHOULD_ERROR_ATTRIBUTE);
  if (errorType != null) {
    ErrorType type = ErrorType.valueOf(Bytes.toString(errorType));
    switch (type) {
      case CALL_QUEUE_TOO_BIG:
        throw new CallQueueTooBigException("Failing for test");
      case MULTI_ACTION_RESULT_TOO_LARGE:
        throw new MultiActionResultTooLarge("Failing for test");
      case FAILED_SANITY_CHECK:
        throw new FailedSanityCheckException("Failing for test");
      case NOT_SERVING_REGION:
        throw new NotServingRegionException("Failing for test");
      case REGION_MOVED:
        throw new RegionMovedException(e.getEnvironment().getServerName(), 1);
      case SCANNER_RESET:
        throw new ScannerResetException("Failing for test");
      case UNKNOWN_SCANNER:
        throw new UnknownScannerException("Failing for test");
      case REGION_TOO_BUSY:
        throw new RegionTooBusyException("Failing for test");
      case OUT_OF_ORDER_SCANNER_NEXT:
        throw new OutOfOrderScannerNextException("Failing for test");
      default:
        throw new DoNotRetryIOException("Failing for test");
    }
  }
}
 
Example 3
Source File: TestMasterReplication.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> c,
    final Get get, final List<Cell> result) throws IOException {
  if (get.getAttribute("count") != null) {
    result.clear();
    // order is important!
    result.add(new KeyValue(count, count, delete, Bytes.toBytes(nDelete)));
    result.add(new KeyValue(count, count, put, Bytes.toBytes(nCount)));
    c.bypass();
  }
}