当前位置: 首页>>代码示例>>Java>>正文


Java Get.setConsistency方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.Get.setConsistency方法的典型用法代码示例。如果您正苦于以下问题:Java Get.setConsistency方法的具体用法?Java Get.setConsistency怎么用?Java Get.setConsistency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.client.Get的用法示例。


在下文中一共展示了Get.setConsistency方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyNumericRows

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
public void verifyNumericRows(Table table, final byte[] f, int startRow, int endRow,
    int replicaId)
    throws IOException {
  for (int i = startRow; i < endRow; i++) {
    String failMsg = "Failed verification of row :" + i;
    byte[] data = Bytes.toBytes(String.valueOf(i));
    Get get = new Get(data);
    get.setReplicaId(replicaId);
    get.setConsistency(Consistency.TIMELINE);
    Result result = table.get(get);
    assertTrue(failMsg, result.containsColumn(f, null));
    assertEquals(failMsg, result.getColumnCells(f, null).size(), 1);
    Cell cell = result.getColumnLatestCell(f, null);
    assertTrue(failMsg,
      Bytes.equals(data, 0, data.length, cell.getValueArray(), cell.getValueOffset(),
        cell.getValueLength()));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:HBaseTestingUtility.java

示例2: createGet

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
protected Get createGet(long keyToRead) throws IOException {
  Get get = new Get(dataGenerator.getDeterministicUniqueKey(keyToRead));
  String cfsString = "";
  byte[][] columnFamilies = dataGenerator.getColumnFamilies();
  for (byte[] cf : columnFamilies) {
    get.addFamily(cf);
    if (verbose) {
      if (cfsString.length() > 0) {
        cfsString += ", ";
      }
      cfsString += "[" + Bytes.toStringBinary(cf) + "]";
    }
  }
  get = dataGenerator.beforeGet(keyToRead, get);
  if (regionReplicaId > 0) {
    get.setReplicaId(regionReplicaId);
    get.setConsistency(Consistency.TIMELINE);
  }
  if (verbose) {
    LOG.info("[" + readerId + "] " + "Querying key " + keyToRead + ", cfs " + cfsString);
  }
  return get;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:MultiThreadedReader.java

示例3: testGetOnTargetRegionReplica

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testGetOnTargetRegionReplica() throws Exception {
  try {
    //load some data to primary
    HTU.loadNumericRows(table, f, 0, 1000);
    // assert that we can read back from primary
    Assert.assertEquals(1000, HTU.countRows(table));
    // flush so that region replica can read
    Region region = getRS().getRegionByEncodedName(hriPrimary.getEncodedName());
    region.flush(true);

    openRegion(HTU, getRS(), hriSecondary);

    // try directly Get against region replica
    byte[] row = Bytes.toBytes(String.valueOf(42));
    Get get = new Get(row);
    get.setConsistency(Consistency.TIMELINE);
    get.setReplicaId(1);
    Result result = table.get(get);
    Assert.assertArrayEquals(row, result.getValue(f, null));
  } finally {
    HTU.deleteNumericRows(table, HConstants.CATALOG_FAMILY, 0, 1000);
    closeRegion(HTU, getRS(), hriSecondary);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestRegionReplicas.java

示例4: testRow

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
@Override
void testRow(final int i) throws IOException, InterruptedException {
  if (opts.randomSleep > 0) {
    Thread.sleep(rd.nextInt(opts.randomSleep));
  }
  Get get = new Get(getRandomRow(this.rand, opts.totalRows));
  if (opts.addColumns) {
    get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
  } else {
    get.addFamily(FAMILY_NAME);
  }
  if (opts.filterAll) {
    get.setFilter(new FilterAllFilter());
  }
  get.setConsistency(consistency);
  if (LOG.isTraceEnabled()) LOG.trace(get.toString());
  if (opts.multiGet > 0) {
    this.gets.add(get);
    if (this.gets.size() == opts.multiGet) {
      Result [] rs = this.table.get(this.gets);
      updateValueSize(rs);
      this.gets.clear();
    }
  } else {
    updateValueSize(this.table.get(get));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:PerformanceEvaluation.java

示例5: testSecondaryRegionWithEmptyRegion

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
/**
 * Tests the case where a newly created table with region replicas and no data, the secondary
 * region replicas are available to read immediately.
 */
@Test(timeout = 60000)
public void testSecondaryRegionWithEmptyRegion() throws IOException {
  // Create a new table with region replication, don't put any data. Test that the secondary
  // region replica is available to read.
  try (Connection connection = ConnectionFactory.createConnection(HTU.getConfiguration());
      Table table = connection.getTable(htd.getTableName())) {

    Get get = new Get(row);
    get.setConsistency(Consistency.TIMELINE);
    get.setReplicaId(1);
    table.get(get); // this should not block
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestRegionReplicaFailover.java

示例6: testLotsOfRegionReplicas

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
/**
 * Tests the case where we are creating a table with a lot of regions and replicas. Opening region
 * replicas should not block handlers on RS indefinitely.
 */
@Test (timeout = 120000)
public void testLotsOfRegionReplicas() throws IOException {
  int numRegions = NB_SERVERS * 20;
  int regionReplication = 10;
  String tableName = htd.getTableName().getNameAsString() + "2";
  htd = HTU.createTableDescriptor(tableName);
  htd.setRegionReplication(regionReplication);

  // dont care about splits themselves too much
  byte[] startKey = Bytes.toBytes("aaa");
  byte[] endKey = Bytes.toBytes("zzz");
  byte[][] splits = HTU.getRegionSplitStartKeys(startKey, endKey, numRegions);
  HTU.getHBaseAdmin().createTable(htd, startKey, endKey, numRegions);

  try (Connection connection = ConnectionFactory.createConnection(HTU.getConfiguration());
      Table table = connection.getTable(htd.getTableName())) {

    for (int i = 1; i < splits.length; i++) {
      for (int j = 0; j < regionReplication; j++) {
        Get get = new Get(splits[i]);
        get.setConsistency(Consistency.TIMELINE);
        get.setReplicaId(j);
        table.get(get); // this should not block. Regions should be coming online
      }
    }
  }

  HTU.deleteTableIfAny(TableName.valueOf(tableName));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:TestRegionReplicaFailover.java

示例7: createGet

import org.apache.hadoop.hbase.client.Get; //导入方法依赖的package包/类
@Override
protected Get createGet(long keyToRead) throws IOException {
  Get get = super.createGet(keyToRead);
  get.setConsistency(Consistency.TIMELINE);
  return get;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:IntegrationTestTimeBoundedRequestsWithRegionReplicas.java


注:本文中的org.apache.hadoop.hbase.client.Get.setConsistency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。