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


Java WAL.close方法代码示例

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


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

示例1: testEmptyWALEditAreNotSeen

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
/**
 * Coprocessors shouldn't get notice of empty waledits.
 */
@Test
public void testEmptyWALEditAreNotSeen() throws Exception {
  final HRegionInfo hri = createBasic3FamilyHRegionInfo(Bytes.toString(TEST_TABLE));
  final HTableDescriptor htd = createBasic3FamilyHTD(Bytes.toString(TEST_TABLE));
  final MultiVersionConcurrencyControl mvcc = new MultiVersionConcurrencyControl();

  WAL log = wals.getWAL(UNSPECIFIED_REGION);
  try {
    SampleRegionWALObserver cp = getCoprocessor(log, SampleRegionWALObserver.class);

    cp.setTestValues(TEST_TABLE, null, null, null, null, null, null, null);

    assertFalse(cp.isPreWALWriteCalled());
    assertFalse(cp.isPostWALWriteCalled());

    final long now = EnvironmentEdgeManager.currentTime();
    long txid = log.append(htd, hri,
        new WALKey(hri.getEncodedNameAsBytes(), hri.getTable(), now, mvcc),
        new WALEdit(), true);
    log.sync(txid);

    assertFalse("Empty WALEdit should skip coprocessor evaluation.", cp.isPreWALWriteCalled());
    assertFalse("Empty WALEdit should skip coprocessor evaluation.", cp.isPostWALWriteCalled());
  } finally {
    log.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestWALObserver.java

示例2: testActionListener

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
/**
 * Add a bunch of dummy data and roll the logs every two insert. We
 * should end up with 10 rolled files (plus the roll called in
 * the constructor). Also test adding a listener while it's running.
 */
@Test
public void testActionListener() throws Exception {
  DummyWALActionsListener observer = new DummyWALActionsListener();
  List<WALActionsListener> list = new ArrayList<WALActionsListener>();
  list.add(observer);
  final WALFactory wals = new WALFactory(conf, list, "testActionListener");
  DummyWALActionsListener laterobserver = new DummyWALActionsListener();
  HRegionInfo hri = new HRegionInfo(TableName.valueOf(SOME_BYTES),
           SOME_BYTES, SOME_BYTES, false);
  final WAL wal = wals.getWAL(hri.getEncodedNameAsBytes());

  for (int i = 0; i < 20; i++) {
    byte[] b = Bytes.toBytes(i+"");
    KeyValue kv = new KeyValue(b,b,b);
    WALEdit edit = new WALEdit();
    edit.add(kv);
    HTableDescriptor htd = new HTableDescriptor();
    htd.addFamily(new HColumnDescriptor(b));

    final long txid = wal.append(htd, hri, new WALKey(hri.getEncodedNameAsBytes(),
        TableName.valueOf(b), 0), edit, true);
    wal.sync(txid);
    if (i == 10) {
      wal.registerWALActionsListener(laterobserver);
    }
    if (i % 2 == 0) {
      wal.rollWriter();
    }
  }

  wal.close();

  assertEquals(11, observer.preLogRollCounter);
  assertEquals(11, observer.postLogRollCounter);
  assertEquals(5, laterobserver.preLogRollCounter);
  assertEquals(5, laterobserver.postLogRollCounter);
  assertEquals(1, observer.closedCount);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:44,代码来源:TestWALActionsListener.java

示例3: teardown

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
@After
public void teardown() throws IOException {
  if (region != null) {
    BlockCache bc = region.getStores().get(0).getCacheConfig().getBlockCache();
    ((HRegion)region).close();
    WAL wal = ((HRegion)region).getWAL();
    if (wal != null) wal.close();
    if (bc != null) bc.shutdown();
    region = null;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestAtomicOperation.java

示例4: tearDown

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
  WAL wal = r.getWAL();
  this.r.close();
  wal.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestCompaction.java

示例5: tearDown

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
  WAL wal = ((HRegion)r).getWAL();
  ((HRegion)r).close();
  wal.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestMinorCompaction.java

示例6: tearDown

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
  WAL wal = ((HRegion)region).getWAL();
  ((HRegion)region).close();
  wal.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestFilter.java

示例7: testFilterListWithPrefixFilter

import org.apache.hadoop.hbase.wal.WAL; //导入方法依赖的package包/类
@Test
public void testFilterListWithPrefixFilter() throws IOException {
  byte[] family = Bytes.toBytes("f1");
  byte[] qualifier = Bytes.toBytes("q1");
  HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("TestFilter"));
  htd.addFamily(new HColumnDescriptor(family));
  HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
  HRegion testRegion = HRegion.createHRegion(info, TEST_UTIL.getDataTestDir(),
      TEST_UTIL.getConfiguration(), htd);

  for(int i=0; i<5; i++) {
    Put p = new Put(Bytes.toBytes((char)('a'+i) + "row"));
    p.setDurability(Durability.SKIP_WAL);
    p.add(family, qualifier, Bytes.toBytes(String.valueOf(111+i)));
    testRegion.put(p);
  }
  testRegion.flush(true);

  // rows starting with "b"
  PrefixFilter pf = new PrefixFilter(new byte[] {'b'}) ;
  // rows with value of column 'q1' set to '113'
  SingleColumnValueFilter scvf = new SingleColumnValueFilter(
      family, qualifier, CompareOp.EQUAL, Bytes.toBytes("113"));
  // combine these two with OR in a FilterList
  FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, pf, scvf);

  Scan s1 = new Scan();
  s1.setFilter(filterList);
  InternalScanner scanner = testRegion.getScanner(s1);
  List<Cell> results = new ArrayList<Cell>();
  int resultCount = 0;
  while (scanner.next(results)) {
    resultCount++;
    byte[] row =  CellUtil.cloneRow(results.get(0));
    LOG.debug("Found row: " + Bytes.toStringBinary(row));
    assertTrue(Bytes.equals(row, Bytes.toBytes("brow"))
        || Bytes.equals(row, Bytes.toBytes("crow")));
    results.clear();
  }
  assertEquals(2, resultCount);
  scanner.close();

  WAL wal = ((HRegion)testRegion).getWAL();
  ((HRegion)testRegion).close();
  wal.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:47,代码来源:TestFilter.java


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