Java Code Examples for org.apache.hadoop.hbase.HConstants#DEFAULT_HBASE_CLIENT_SCANNER_CACHING

The following examples show how to use org.apache.hadoop.hbase.HConstants#DEFAULT_HBASE_CLIENT_SCANNER_CACHING . 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: ConnectionConfiguration.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * This is for internal testing purpose (using the default value).
 * In real usage, we should read the configuration from the Configuration object.
 */
@VisibleForTesting
protected ConnectionConfiguration() {
  this.writeBufferSize = WRITE_BUFFER_SIZE_DEFAULT;
  this.writeBufferPeriodicFlushTimeoutMs = WRITE_BUFFER_PERIODIC_FLUSH_TIMEOUT_MS_DEFAULT;
  this.writeBufferPeriodicFlushTimerTickMs = WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS_DEFAULT;
  this.metaOperationTimeout = HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT;
  this.operationTimeout = HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT;
  this.scannerCaching = HConstants.DEFAULT_HBASE_CLIENT_SCANNER_CACHING;
  this.scannerMaxResultSize = HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE;
  this.primaryCallTimeoutMicroSecond = 10000;
  this.replicaCallTimeoutMicroSecondScan = 1000000;
  this.metaReplicaCallTimeoutMicroSecondScan =
      HConstants.HBASE_CLIENT_META_REPLICA_SCAN_TIMEOUT_DEFAULT;
  this.retries = HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER;
  this.clientScannerAsyncPrefetch = Scan.DEFAULT_HBASE_CLIENT_SCANNER_ASYNC_PREFETCH;
  this.maxKeyValueSize = MAX_KEYVALUE_SIZE_DEFAULT;
  this.readRpcTimeout = HConstants.DEFAULT_HBASE_RPC_TIMEOUT;
  this.writeRpcTimeout = HConstants.DEFAULT_HBASE_RPC_TIMEOUT;
  this.rpcTimeout = HConstants.DEFAULT_HBASE_RPC_TIMEOUT;
}
 
Example 2
Source File: HBaseOperations.java    From geowave with Apache License 2.0 5 votes vote down vote up
public int getScanCacheSize() {
  if (options != null) {
    if (options.getScanCacheSize() != HConstants.DEFAULT_HBASE_CLIENT_SCANNER_CACHING) {
      return options.getScanCacheSize();
    }
  }

  // Need to get default from config.
  return 10000;
}
 
Example 3
Source File: AggregationEndpoint.java    From geowave with Apache License 2.0 4 votes vote down vote up
private Object getValue(
    final Aggregation aggregation,
    final Filter filter,
    final DataTypeAdapter dataAdapter,
    final Short internalAdapterId,
    final HBaseDistributableFilter hdFilter,
    final boolean blockCaching,
    final int scanCacheSize,
    final String[] authorizations) throws IOException {
  final Scan scan = new Scan();
  scan.setMaxVersions(1);
  scan.setCacheBlocks(blockCaching);

  if (scanCacheSize != HConstants.DEFAULT_HBASE_CLIENT_SCANNER_CACHING) {
    scan.setCaching(scanCacheSize);
  }

  if (filter != null) {
    scan.setFilter(filter);
  }

  if (internalAdapterId != null) {
    scan.addFamily(StringUtils.stringToBinary(ByteArrayUtils.shortToString(internalAdapterId)));
  }

  if (authorizations != null) {
    scan.setAuthorizations(new Authorizations(authorizations));
  }
  env.getRegion().getCoprocessorHost().preScannerOpen(scan);
  try (InternalScanner scanner = env.getRegion().getScanner(scan)) {
    final List<Cell> results = new ArrayList<>();
    boolean hasNext;
    do {
      hasNext = scanner.next(results);
      if (!results.isEmpty()) {
        if (hdFilter != null) {
          if (dataAdapter != null) {
            final Object row = hdFilter.decodeRow(dataAdapter);

            if (row != null) {
              aggregation.aggregate(row);
            } else {
              LOGGER.error("DataAdapter failed to decode row");
            }
          } else {
            aggregation.aggregate(hdFilter.getPersistenceEncoding());
          }
        } else {
          aggregation.aggregate(null);
        }
        results.clear();
      }
    } while (hasNext);
  }
  return aggregation.getResult();
}