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


Java RegionScanner.next方法代码示例

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


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

示例1: getExistingLabelsWithAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
protected List<List<Cell>> getExistingLabelsWithAuths() throws IOException {
  Scan scan = new Scan();
  RegionScanner scanner = labelsRegion.getScanner(scan);
  List<List<Cell>> existingLabels = new ArrayList<List<Cell>>();
  try {
    while (true) {
      List<Cell> cells = new ArrayList<Cell>();
      scanner.next(cells);
      if (cells.isEmpty()) {
        break;
      }
      existingLabels.add(cells);
    }
  } finally {
    scanner.close();
  }
  return existingLabels;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:DefaultVisibilityLabelServiceImpl.java

示例2: getExistingLabelsWithAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private List<List<Cell>> getExistingLabelsWithAuths() throws IOException {
  Scan scan = new Scan();
  RegionScanner scanner = this.regionEnv.getRegion().getScanner(scan);
  List<List<Cell>> existingLabels = new ArrayList<List<Cell>>();
  try {
    while (true) {
      List<Cell> cells = new ArrayList<Cell>();
      scanner.next(cells);
      if (cells.isEmpty()) {
        break;
      }
      existingLabels.add(cells);
    }
  } finally {
    scanner.close();
  }
  return existingLabels;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:VisibilityController.java

示例3: getUserAuthsFromLabelsTable

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private List<String> getUserAuthsFromLabelsTable(byte[] user) throws IOException {
  Scan s = new Scan();
  s.addColumn(LABELS_TABLE_FAMILY, user);
  Filter filter = createVisibilityLabelFilter(this.regionEnv.getRegion(), new Authorizations(
      SYSTEM_LABEL));
  s.setFilter(filter);
  List<String> auths = new ArrayList<String>();
  // We do ACL check here as we create scanner directly on region. It will not make calls to
  // AccessController CP methods.
  performACLCheck();
  RegionScanner scanner = this.regionEnv.getRegion().getScanner(s);
  List<Cell> results = new ArrayList<Cell>(1);
  while (true) {
    scanner.next(results);
    if (results.isEmpty()) break;
    Cell cell = results.get(0);
    int ordinal = Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
    String label = this.visibilityManager.getLabel(ordinal);
    if (label != null) {
      auths.add(label);
    }
    results.clear();
  }
  return auths;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:VisibilityController.java

示例4: initiateScan

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private void initiateScan(HRegion region) throws IOException {
  Scan scan = new Scan();
  scan.setCaching(1);
  RegionScanner resScanner = null;
  try {
    resScanner = region.getScanner(scan);
    List<Cell> results = new ArrayList<>();
    boolean next = resScanner.next(results);
    try {
      counter.incrementAndGet();
      latch.await();
    } catch (InterruptedException e) {
    }
    while (next) {
      next = resScanner.next(results);
    }
  } finally {
    scanCompletedCounter.incrementAndGet();
    resScanner.close();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestCompactedHFilesDischarger.java

示例5: testRegionScanner

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
/**
 * Test region scanner.
 *
 * @throws IOException Signals that an I/O exception has occurred.
 */
public void testRegionScanner() throws IOException
{
  LOG.info("Test Region scanner");
  Scan scan = new Scan();
  scan.setStartRow(region.getStartKey());
  scan.setStopRow(region.getEndKey());
  RegionScanner scanner = region.getScanner(scan);
  //Store store = region.getStore(CF);
  //StoreScanner scanner = new StoreScanner(store,  store.getScanInfo(), scan,  null);
  long start = System.currentTimeMillis();
  int total = 0;
  List<Cell> result = new ArrayList<Cell>();
  while(scanner.next(result)){
    total++; result.clear();
  }
  
  LOG.info("Test Region scanner finished. Found "+total +" in "+(System.currentTimeMillis() - start)+"ms");
  LOG.info("cache hits ="+cache.getStats().getHitCount()+" miss="+cache.getStats().getMissCount());

}
 
开发者ID:VladRodionov,项目名称:bigbase,代码行数:26,代码来源:BlockCacheStorageSimpleRegionTests.java

示例6: getUserAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Override
public List<String> getUserAuths(byte[] user, boolean systemCall)
    throws IOException {
  assert (labelsRegion != null || systemCall);
  if (systemCall || labelsRegion == null) {
    return this.labelsCache.getUserAuths(Bytes.toString(user));
  }
  Scan s = new Scan();
  if (user != null && user.length > 0) {
    s.addColumn(LABELS_TABLE_FAMILY, user);
  }
  Filter filter = VisibilityUtils.createVisibilityLabelFilter(this.labelsRegion,
    new Authorizations(SYSTEM_LABEL));
  s.setFilter(filter);
  ArrayList<String> auths = new ArrayList<String>();
  RegionScanner scanner = this.labelsRegion.getScanner(s);
  try {
    List<Cell> results = new ArrayList<Cell>(1);
    while (true) {
      scanner.next(results);
      if (results.isEmpty()) break;
      Cell cell = results.get(0);
      int ordinal = Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
      String label = this.labelsCache.getLabel(ordinal);
      if (label != null) {
        auths.add(label);
      }
      results.clear();
    }
  } finally {
    scanner.close();
  }
  return auths;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:DefaultVisibilityLabelServiceImpl.java

示例7: getGroupAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Override
public List<String> getGroupAuths(String[] groups, boolean systemCall)
    throws IOException {
  assert (labelsRegion != null || systemCall);
  if (systemCall || labelsRegion == null) {
    return this.labelsCache.getGroupAuths(groups);
  }
  Scan s = new Scan();
  if (groups != null && groups.length > 0) {
    for (String group : groups) {
      s.addColumn(LABELS_TABLE_FAMILY, Bytes.toBytes(AuthUtil.toGroupEntry(group)));
    }
  }
  Filter filter = VisibilityUtils.createVisibilityLabelFilter(this.labelsRegion,
      new Authorizations(SYSTEM_LABEL));
  s.setFilter(filter);
  Set<String> auths = new HashSet<String>();
  RegionScanner scanner = this.labelsRegion.getScanner(s);
  try {
    List<Cell> results = new ArrayList<Cell>(1);
    while (true) {
      scanner.next(results);
      if (results.isEmpty()) break;
      Cell cell = results.get(0);
      int ordinal = Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
      String label = this.labelsCache.getLabel(ordinal);
      if (label != null) {
        auths.add(label);
      }
      results.clear();
    }
  } finally {
    scanner.close();
  }
  return new ArrayList<String>(auths);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:DefaultVisibilityLabelServiceImpl.java

示例8: runScanner

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private void runScanner(Table hTable, int expectedSize, Filter filter) throws IOException {

    String cf = "f";
    Scan scan = new Scan();
    scan.addFamily(cf.getBytes());
    scan.setFilter(filter);
    List<HRegion> regions = TEST_UTIL.getHBaseCluster().getRegions(table.getBytes());
    HRegion first = regions.get(0);
    first.getScanner(scan);
    RegionScanner scanner = first.getScanner(scan);
    List<Cell> results = new ArrayList<Cell>();
    // Result result;
    long timeBeforeScan = System.currentTimeMillis();
    int found = 0;
    while (scanner.next(results)) {
      found += results.size();
      results.clear();
    }
    found += results.size();
    long scanTime = System.currentTimeMillis() - timeBeforeScan;
    scanner.close();

    LOG.info("\nscan time = " + scanTime + "ms");
    LOG.info("found " + found + " results\n");

    assertEquals(expectedSize, found);
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:TestFuzzyRowFilterEndToEnd.java

示例9: testReverseScanWithoutPadding

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Test
public void testReverseScanWithoutPadding() throws Exception {
  byte[] row1 = Bytes.toBytes("a");
  byte[] row2 = Bytes.toBytes("ab");
  byte[] row3 = Bytes.toBytes("b");

  Put put1 = new Put(row1);
  put1.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);
  Put put2 = new Put(row2);
  put2.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);
  Put put3 = new Put(row3);
  put3.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);

  region.put(put1);
  region.put(put2);
  region.put(put3);
  region.flush(true);
  Scan scan = new Scan();
  scan.setCacheBlocks(false);
  scan.setReversed(true);
  scan.setFilter(new FirstKeyOnlyFilter());
  scan.addFamily(cfName);
  RegionScanner scanner = region.getScanner(scan);
  List<Cell> res = new ArrayList<Cell>();
  int count = 1;
  while (scanner.next(res)) {
    count++;
  }
  assertEquals(Bytes.toString(res.get(0).getRowArray(), res.get(0).getRowOffset(), res.get(0)
      .getRowLength()), "b");
  assertEquals(Bytes.toString(res.get(1).getRowArray(), res.get(1).getRowOffset(), res.get(1)
      .getRowLength()), "ab");
  assertEquals(Bytes.toString(res.get(2).getRowArray(), res.get(2).getRowOffset(), res.get(2)
      .getRowLength()), "a");
  assertEquals(3, count);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:TestSeekBeforeWithReverseScan.java

示例10: testReverseScanWithPadding

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Test
public void testReverseScanWithPadding() throws Exception {
  byte[] terminator = new byte[] { -1 };
  byte[] row1 = Bytes.add(invert(Bytes.toBytes("a")), terminator);
  byte[] row2 = Bytes.add(invert(Bytes.toBytes("ab")), terminator);
  byte[] row3 = Bytes.add(invert(Bytes.toBytes("b")), terminator);

  Put put1 = new Put(row1);
  put1.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);
  Put put2 = new Put(row2);
  put2.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);
  Put put3 = new Put(row3);
  put3.addColumn(cfName, cqName, HConstants.EMPTY_BYTE_ARRAY);

  region.put(put1);
  region.put(put2);
  region.put(put3);
  region.flush(true);
  Scan scan = new Scan();
  scan.setCacheBlocks(false);
  scan.setReversed(true);
  scan.setFilter(new FirstKeyOnlyFilter());
  scan.addFamily(cfName);
  RegionScanner scanner = region.getScanner(scan);
  List<Cell> res = new ArrayList<Cell>();
  int count = 1;
  while (scanner.next(res)) {
    count++;
  }
  assertEquals(3, count);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:TestSeekBeforeWithReverseScan.java

示例11: getScannedCount

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private int getScannedCount(RegionScanner scanner) throws IOException {
  int scannedCount = 0;
  List<KeyValue> results = new ArrayList<KeyValue>();
  while (true) {
    boolean existMore = scanner.next(results);
    if (!results.isEmpty())
      scannedCount++;
    if (!existMore)
      break;
    results.clear();
  }
  return scannedCount;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:TestWALReplay.java

示例12: getUserAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Override
public List<String> getUserAuths(byte[] user, boolean systemCall)
    throws IOException {
  assert (labelsRegion != null || systemCall);
  if (systemCall || labelsRegion == null) {
    return this.labelsCache.getUserAuths(Bytes.toString(user));
  }
  Scan s = new Scan();
  if (user != null && user.length > 0) {
    s.addColumn(LABELS_TABLE_FAMILY, user);
  }
  Filter filter = VisibilityUtils.createVisibilityLabelFilter(this.labelsRegion,
      new Authorizations(SYSTEM_LABEL));
  s.setFilter(filter);
  ArrayList<String> auths = new ArrayList<String>();
  RegionScanner scanner = this.labelsRegion.getScanner(s);
  try {
    List<Cell> results = new ArrayList<Cell>(1);
    while (true) {
      scanner.next(results);
      if (results.isEmpty()) break;
      Cell cell = results.get(0);
      int ordinal = Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
      String label = this.labelsCache.getLabel(ordinal);
      if (label != null) {
        auths.add(label);
      }
      results.clear();
    }
  } finally {
    scanner.close();
  }
  return auths;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:35,代码来源:DefaultVisibilityLabelServiceImpl.java

示例13: getGroupAuths

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@Override
public List<String> getGroupAuths(String[] groups, boolean systemCall)
    throws IOException {
  assert (labelsRegion != null || systemCall);
  if (systemCall || labelsRegion == null) {
    return this.labelsCache.getGroupAuths(groups);
  }
  Scan s = new Scan();
  if (groups != null && groups.length > 0) {
    for (String group : groups) {
      s.addColumn(LABELS_TABLE_FAMILY, Bytes.toBytes(AccessControlLists.toGroupEntry(group)));
    }
  }
  Filter filter = VisibilityUtils.createVisibilityLabelFilter(this.labelsRegion,
      new Authorizations(SYSTEM_LABEL));
  s.setFilter(filter);
  Set<String> auths = new HashSet<String>();
  RegionScanner scanner = this.labelsRegion.getScanner(s);
  try {
    List<Cell> results = new ArrayList<Cell>(1);
    while (true) {
      scanner.next(results);
      if (results.isEmpty()) break;
      Cell cell = results.get(0);
      int ordinal = Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
      String label = this.labelsCache.getLabel(ordinal);
      if (label != null) {
        auths.add(label);
      }
      results.clear();
    }
  } finally {
    scanner.close();
  }
  return new ArrayList<String>(auths);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:37,代码来源:DefaultVisibilityLabelServiceImpl.java

示例14: getScannedCount

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private int getScannedCount(RegionScanner scanner) throws IOException {
  int scannedCount = 0;
  List<Cell> results = new ArrayList<Cell>();
  while (true) {
    boolean existMore = scanner.next(results);
    if (!results.isEmpty())
      scannedCount++;
    if (!existMore)
      break;
    results.clear();
  }
  return scannedCount;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:TestWALReplay.java

示例15: metaExists

import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
boolean metaExists(Region region) throws IOException {
  // TODO We should make sure the meta is well formed
  RegionScanner scanner = region.getScanner(new Scan());
  List<Cell> results = new ArrayList<>();
  scanner.next(results, 1);
  return results.size() > 0;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:8,代码来源:RootTabletLeaderBehavior.java


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