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


Java RegionScannerImpl.getStoreHeapForTesting方法代码示例

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


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

示例1: scanColSet

import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl; //导入方法依赖的package包/类
private void scanColSet(int[] colSet, int[] expectedResultCols)
    throws IOException {
  LOG.info("Scanning column set: " + Arrays.toString(colSet));
  Scan scan = new Scan(ROW_BYTES, ROW_BYTES);
  addColumnSetToScan(scan, colSet);
  RegionScannerImpl scanner = (RegionScannerImpl) region.getScanner(scan);
  KeyValueHeap storeHeap = scanner.getStoreHeapForTesting();
  assertEquals(0, storeHeap.getHeap().size());
  StoreScanner storeScanner =
      (StoreScanner) storeHeap.getCurrentForTesting();
  @SuppressWarnings({ "unchecked", "rawtypes" })
  List<StoreFileScanner> scanners = (List<StoreFileScanner>)
      (List) storeScanner.getAllScannersForTesting();

  // Sort scanners by their HFile's modification time.
  Collections.sort(scanners, new Comparator<StoreFileScanner>() {
    @Override
    public int compare(StoreFileScanner s1, StoreFileScanner s2) {
      Path p1 = s1.getReader().getHFileReader().getPath();
      Path p2 = s2.getReader().getHFileReader().getPath();
      long t1, t2;
      try {
        t1 = fs.getFileStatus(p1).getModificationTime();
        t2 = fs.getFileStatus(p2).getModificationTime();
      } catch (IOException ex) {
        throw new RuntimeException(ex);
      }
      return t1 < t2 ? -1 : t1 == t2 ? 1 : 0;
    }
  });

  StoreFile.Reader lastStoreFileReader = null;
  for (StoreFileScanner sfScanner : scanners)
    lastStoreFileReader = sfScanner.getReader();

  new HFilePrettyPrinter(conf).run(new String[]{ "-m", "-p", "-f",
      lastStoreFileReader.getHFileReader().getPath().toString()});

  // Disable Bloom filter for the last store file. The disabled Bloom filter
  // will always return "true".
  LOG.info("Disabling Bloom filter for: "
      + lastStoreFileReader.getHFileReader().getName());
  lastStoreFileReader.disableBloomFilterForTesting();

  List<Cell> allResults = new ArrayList<Cell>();

  { // Limit the scope of results.
    List<Cell> results = new ArrayList<Cell>();
    while (scanner.next(results) || results.size() > 0) {
      allResults.addAll(results);
      results.clear();
    }
  }

  List<Integer> actualIds = new ArrayList<Integer>();
  for (Cell kv : allResults) {
    String qual = Bytes.toString(CellUtil.cloneQualifier(kv));
    assertTrue(qual.startsWith(QUALIFIER_PREFIX));
    actualIds.add(Integer.valueOf(qual.substring(
        QUALIFIER_PREFIX.length())));
  }
  List<Integer> expectedIds = new ArrayList<Integer>();
  for (int expectedId : expectedResultCols)
    expectedIds.add(expectedId);

  LOG.info("Column ids returned: " + actualIds + ", expected: "
      + expectedIds);
  assertEquals(expectedIds.toString(), actualIds.toString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:70,代码来源:TestScanWithBloomError.java

示例2: scanColSet

import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl; //导入方法依赖的package包/类
private void scanColSet(int[] colSet, int[] expectedResultCols)
    throws IOException {
  LOG.info("Scanning column set: " + Arrays.toString(colSet));
  Scan scan = new Scan(ROW_BYTES, ROW_BYTES);
  addColumnSetToScan(scan, colSet);
  RegionScannerImpl scanner = (RegionScannerImpl) region.getScanner(scan);
  KeyValueHeap storeHeap = scanner.getStoreHeapForTesting();
  assertEquals(0, storeHeap.getHeap().size());
  StoreScanner storeScanner =
      (StoreScanner) storeHeap.getCurrentForTesting();
  @SuppressWarnings({ "unchecked", "rawtypes" })
  List<StoreFileScanner> scanners = (List<StoreFileScanner>)
      (List) storeScanner.getAllScannersForTesting();

  // Sort scanners by their HFile's modification time.
  Collections.sort(scanners, new Comparator<StoreFileScanner>() {
    @Override
    public int compare(StoreFileScanner s1, StoreFileScanner s2) {
      Path p1 = s1.getReaderForTesting().getHFileReader().getPath();
      Path p2 = s2.getReaderForTesting().getHFileReader().getPath();
      long t1, t2;
      try {
        t1 = fs.getFileStatus(p1).getModificationTime();
        t2 = fs.getFileStatus(p2).getModificationTime();
      } catch (IOException ex) {
        throw new RuntimeException(ex);
      }
      return t1 < t2 ? -1 : t1 == t2 ? 1 : 0;
    }
  });

  StoreFile.Reader lastStoreFileReader = null;
  for (StoreFileScanner sfScanner : scanners)
    lastStoreFileReader = sfScanner.getReaderForTesting();

  new HFilePrettyPrinter().run(new String[]{ "-m", "-p", "-f",
      lastStoreFileReader.getHFileReader().getPath().toString()});

  // Disable Bloom filter for the last store file. The disabled Bloom filter
  // will always return "true".
  LOG.info("Disabling Bloom filter for: "
      + lastStoreFileReader.getHFileReader().getName());
  lastStoreFileReader.disableBloomFilterForTesting();

  List<KeyValue> allResults = new ArrayList<KeyValue>();

  { // Limit the scope of results.
    List<KeyValue> results = new ArrayList<KeyValue>();
    while (scanner.next(results) || results.size() > 0) {
      allResults.addAll(results);
      results.clear();
    }
  }

  List<Integer> actualIds = new ArrayList<Integer>();
  for (KeyValue kv : allResults) {
    String qual = Bytes.toString(kv.getQualifier());
    assertTrue(qual.startsWith(QUALIFIER_PREFIX));
    actualIds.add(Integer.valueOf(qual.substring(
        QUALIFIER_PREFIX.length())));
  }
  List<Integer> expectedIds = new ArrayList<Integer>();
  for (int expectedId : expectedResultCols)
    expectedIds.add(expectedId);

  LOG.info("Column ids returned: " + actualIds + ", expected: "
      + expectedIds);
  assertEquals(expectedIds.toString(), actualIds.toString());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:70,代码来源:TestScanWithBloomError.java

示例3: scanColSet

import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl; //导入方法依赖的package包/类
private void scanColSet(int[] colSet, int[] expectedResultCols)
    throws IOException {
  LOG.info("Scanning column set: " + Arrays.toString(colSet));
  Scan scan = new Scan(ROW_BYTES, ROW_BYTES);
  addColumnSetToScan(scan, colSet);
  RegionScannerImpl scanner = (RegionScannerImpl) region.getScanner(scan);
  KeyValueHeap storeHeap = scanner.getStoreHeapForTesting();
  assertEquals(0, storeHeap.getHeap().size());
  StoreScanner storeScanner =
      (StoreScanner) storeHeap.getCurrentForTesting();
  @SuppressWarnings({ "unchecked", "rawtypes" })
  List<StoreFileScanner> scanners = (List<StoreFileScanner>)
      (List) storeScanner.getAllScannersForTesting();

  // Sort scanners by their HFile's modification time.
  Collections.sort(scanners, new Comparator<StoreFileScanner>() {
    @Override
    public int compare(StoreFileScanner s1, StoreFileScanner s2) {
      Path p1 = s1.getReaderForTesting().getHFileReader().getPath();
      Path p2 = s2.getReaderForTesting().getHFileReader().getPath();
      long t1, t2;
      try {
        t1 = fs.getFileStatus(p1).getModificationTime();
        t2 = fs.getFileStatus(p2).getModificationTime();
      } catch (IOException ex) {
        throw new RuntimeException(ex);
      }
      return t1 < t2 ? -1 : t1 == t2 ? 1 : 0;
    }
  });

  StoreFile.Reader lastStoreFileReader = null;
  for (StoreFileScanner sfScanner : scanners)
    lastStoreFileReader = sfScanner.getReaderForTesting();

  new HFilePrettyPrinter().run(new String[]{ "-m", "-p", "-f",
      lastStoreFileReader.getHFileReader().getPath().toString()});

  // Disable Bloom filter for the last store file. The disabled Bloom filter
  // will always return "true".
  LOG.info("Disabling Bloom filter for: "
      + lastStoreFileReader.getHFileReader().getName());
  lastStoreFileReader.disableBloomFilterForTesting();

  List<Cell> allResults = new ArrayList<Cell>();

  { // Limit the scope of results.
    List<Cell> results = new ArrayList<Cell>();
    while (scanner.next(results) || results.size() > 0) {
      allResults.addAll(results);
      results.clear();
    }
  }

  List<Integer> actualIds = new ArrayList<Integer>();
  for (Cell kv : allResults) {
    String qual = Bytes.toString(CellUtil.cloneQualifier(kv));
    assertTrue(qual.startsWith(QUALIFIER_PREFIX));
    actualIds.add(Integer.valueOf(qual.substring(
        QUALIFIER_PREFIX.length())));
  }
  List<Integer> expectedIds = new ArrayList<Integer>();
  for (int expectedId : expectedResultCols)
    expectedIds.add(expectedId);

  LOG.info("Column ids returned: " + actualIds + ", expected: "
      + expectedIds);
  assertEquals(expectedIds.toString(), actualIds.toString());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:70,代码来源:TestScanWithBloomError.java

示例4: scanColSet

import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl; //导入方法依赖的package包/类
private void scanColSet(int[] colSet, int[] expectedResultCols)
    throws IOException {
  LOG.info("Scanning column set: " + Arrays.toString(colSet));
  Scan scan = new Scan(ROW_BYTES, ROW_BYTES);
  addColumnSetToScan(scan, colSet);
  RegionScannerImpl scanner = region.getScanner(scan);
  KeyValueHeap storeHeap = scanner.getStoreHeapForTesting();
  assertEquals(0, storeHeap.getHeap().size());
  StoreScanner storeScanner =
      (StoreScanner) storeHeap.getCurrentForTesting();
  @SuppressWarnings({ "unchecked", "rawtypes" })
  List<StoreFileScanner> scanners = (List<StoreFileScanner>)
      (List) storeScanner.getAllScannersForTesting();

  // Sort scanners by their HFile's modification time.
  Collections.sort(scanners, new Comparator<StoreFileScanner>() {
    @Override
    public int compare(StoreFileScanner s1, StoreFileScanner s2) {
      Path p1 = s1.getReader().getHFileReader().getPath();
      Path p2 = s2.getReader().getHFileReader().getPath();
      long t1, t2;
      try {
        t1 = fs.getFileStatus(p1).getModificationTime();
        t2 = fs.getFileStatus(p2).getModificationTime();
      } catch (IOException ex) {
        throw new RuntimeException(ex);
      }
      return t1 < t2 ? -1 : t1 == t2 ? 1 : 0;
    }
  });

  StoreFileReader lastStoreFileReader = null;
  for (StoreFileScanner sfScanner : scanners)
    lastStoreFileReader = sfScanner.getReader();

  new HFilePrettyPrinter(conf).run(new String[]{ "-m", "-p", "-f",
      lastStoreFileReader.getHFileReader().getPath().toString()});

  // Disable Bloom filter for the last store file. The disabled Bloom filter
  // will always return "true".
  LOG.info("Disabling Bloom filter for: "
      + lastStoreFileReader.getHFileReader().getName());
  lastStoreFileReader.disableBloomFilterForTesting();

  List<Cell> allResults = new ArrayList<>();

  { // Limit the scope of results.
    List<Cell> results = new ArrayList<>();
    while (scanner.next(results) || results.size() > 0) {
      allResults.addAll(results);
      results.clear();
    }
  }

  List<Integer> actualIds = new ArrayList<>();
  for (Cell kv : allResults) {
    String qual = Bytes.toString(CellUtil.cloneQualifier(kv));
    assertTrue(qual.startsWith(QUALIFIER_PREFIX));
    actualIds.add(Integer.valueOf(qual.substring(
        QUALIFIER_PREFIX.length())));
  }
  List<Integer> expectedIds = new ArrayList<>();
  for (int expectedId : expectedResultCols)
    expectedIds.add(expectedId);

  LOG.info("Column ids returned: " + actualIds + ", expected: "
      + expectedIds);
  assertEquals(expectedIds.toString(), actualIds.toString());
}
 
开发者ID:apache,项目名称:hbase,代码行数:70,代码来源:TestScanWithBloomError.java


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