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


Java ZKSplitLog.getFileName方法代码示例

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


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

示例1: HLogSplitterHandler

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
public HLogSplitterHandler(final Server server, String curTask,
    final MutableInt curTaskZKVersion,
    CancelableProgressable reporter,
    AtomicInteger inProgressTasks, TaskExecutor splitTaskExecutor) {
 super(server, EventType.RS_LOG_REPLAY);
  this.curTask = curTask;
  this.wal = ZKSplitLog.getFileName(curTask);
  this.reporter = reporter;
  this.inProgressTasks = inProgressTasks;
  this.inProgressTasks.incrementAndGet();
  this.serverName = server.getServerName();
  this.zkw = server.getZooKeeper();
  this.curTaskZKVersion = curTaskZKVersion;
  this.splitTaskExecutor = splitTaskExecutor;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:16,代码来源:HLogSplitterHandler.java

示例2: getWALFile

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Override
public String getWALFile() {
  return ZKSplitLog.getFileName(taskNode);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:5,代码来源:ZkSplitLogWorkerCoordination.java

示例3: testRescan

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testRescan() throws Exception {
  LOG.info("testRescan");
  SplitLogCounters.resetCounters();
  final ServerName SRV = ServerName.valueOf("svr,1,1");
  RegionServerServices mockedRS = getRegionServer(SRV);
  slw = new SplitLogWorker(ds, TEST_UTIL.getConfiguration(), mockedRS, neverEndingTask);
  slw.start();
  Thread.yield(); // let the worker start
  Thread.sleep(100);

  String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
  SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER, this.mode);
  zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, WAIT_TIME);
  // now the worker is busy doing the above task

  // preempt the task, have it owned by another worker
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, WAIT_TIME);

  // create a RESCAN node
  String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
  rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT_SEQUENTIAL);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, WAIT_TIME);
  // RESCAN node might not have been processed if the worker became busy
  // with the above task. preempt the task again so that now the RESCAN
  // node is processed
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, WAIT_TIME);
  waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME);

  List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.splitLogZNode);
  LOG.debug(nodes);
  int num = 0;
  for (String node : nodes) {
    num++;
    if (node.startsWith("RESCAN")) {
      String name = ZKSplitLog.getEncodedNodeName(zkw, node);
      String fn = ZKSplitLog.getFileName(name);
      byte [] data = ZKUtil.getData(zkw, ZKUtil.joinZNode(zkw.splitLogZNode, fn));
      slt = SplitLogTask.parseFrom(data);
      assertTrue(slt.toString(), slt.isDone(SRV));
    }
  }
  assertEquals(2, num);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:52,代码来源:TestSplitLogWorker.java

示例4: testRescan

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testRescan() throws Exception {
  LOG.info("testRescan");
  ZKSplitLog.Counters.resetCounters();
  slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
      "svr", neverEndingTask);
  slw.start();
  Thread.yield(); // let the worker start
  Thread.sleep(200);

  String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
  zkw.getRecoverableZooKeeper().create(task,
    TaskState.TASK_UNASSIGNED.get("manager"), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT);

  waitForCounter(tot_wkr_task_acquired, 0, 1, WAIT_TIME);
  // now the worker is busy doing the above task

  // preempt the task, have it owned by another worker
  ZKUtil.setData(zkw, task, TaskState.TASK_UNASSIGNED.get("manager"));
  waitForCounter(tot_wkr_preempt_task, 0, 1, WAIT_TIME);

  // create a RESCAN node
  String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
  rescan = zkw.getRecoverableZooKeeper().create(rescan,
    TaskState.TASK_UNASSIGNED.get("manager"), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT_SEQUENTIAL);

  waitForCounter(tot_wkr_task_acquired, 1, 2, WAIT_TIME);
  // RESCAN node might not have been processed if the worker became busy
  // with the above task. preempt the task again so that now the RESCAN
  // node is processed
  ZKUtil.setData(zkw, task, TaskState.TASK_UNASSIGNED.get("manager"));
  waitForCounter(tot_wkr_preempt_task, 1, 2, WAIT_TIME);
  waitForCounter(tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME);

  List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.splitLogZNode);
  LOG.debug(nodes);
  int num = 0;
  for (String node : nodes) {
    num++;
    if (node.startsWith("RESCAN")) {
      String name = ZKSplitLog.getEncodedNodeName(zkw, node);
      String fn = ZKSplitLog.getFileName(name);
      byte [] data = ZKUtil.getData(zkw, ZKUtil.joinZNode(zkw.splitLogZNode, fn));
      String datastr = Bytes.toString(data);
      assertTrue("data=" + datastr, TaskState.TASK_DONE.equals(data, "svr"));
    }
  }
  assertEquals(2, num);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:52,代码来源:TestSplitLogWorker.java

示例5: removeStaleRecoveringRegionsFromZK

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
/**
 * It removes stale recovering regions under /hbase/recovering-regions/[encoded region name]
 * during master initialization phase.
 * @param failedServers A set of known failed servers
 * @throws KeeperException
 */
void removeStaleRecoveringRegionsFromZK(final Set<ServerName> failedServers)
    throws KeeperException {

  if (!this.distributedLogReplay) {
    // remove any regions in recovery from ZK which could happen when we turn the feature on
    // and later turn it off
    ZKUtil.deleteChildrenRecursively(watcher, watcher.recoveringRegionsZNode);
    // the function is only used in distributedLogReplay mode when master is in initialization
    return;
  }

  Set<String> knownFailedServers = new HashSet<String>();
  if (failedServers != null) {
    for (ServerName tmpServerName : failedServers) {
      knownFailedServers.add(tmpServerName.getServerName());
    }
  }

  this.recoveringRegionLock.lock();
  try {
    List<String> tasks = ZKUtil.listChildrenNoWatch(watcher, watcher.splitLogZNode);
    if (tasks != null) {
      for (String t : tasks) {
        byte[] data = ZKUtil.getData(this.watcher, ZKUtil.joinZNode(watcher.splitLogZNode, t));
        if (data != null) {
          SplitLogTask slt = null;
          try {
            slt = SplitLogTask.parseFrom(data);
          } catch (DeserializationException e) {
            LOG.warn("Failed parse data for znode " + t, e);
          }
          if (slt != null && slt.isDone()) {
            continue;
          }
        }
        // decode the file name
        t = ZKSplitLog.getFileName(t);
        ServerName serverName = HLogUtil.getServerNameFromHLogDirectoryName(new Path(t));
        if (serverName != null) {
          knownFailedServers.add(serverName.getServerName());
        } else {
          LOG.warn("Found invalid WAL log file name:" + t);
        }
      }
    }

    // remove recovering regions which doesn't have any RS associated with it
    List<String> regions = ZKUtil.listChildrenNoWatch(watcher, watcher.recoveringRegionsZNode);
    if (regions != null) {
      for (String region : regions) {
        String nodePath = ZKUtil.joinZNode(watcher.recoveringRegionsZNode, region);
        List<String> regionFailedServers = ZKUtil.listChildrenNoWatch(watcher, nodePath);
        if (regionFailedServers == null || regionFailedServers.isEmpty()) {
          ZKUtil.deleteNode(watcher, nodePath);
          continue;
        }
        boolean needMoreRecovery = false;
        for (String tmpFailedServer : regionFailedServers) {
          if (knownFailedServers.contains(tmpFailedServer)) {
            needMoreRecovery = true;
            break;
          }
        }
        if (!needMoreRecovery) {
          ZKUtil.deleteNodeRecursively(watcher, nodePath);
        }
      }
    }
  } finally {
    this.recoveringRegionLock.unlock();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:79,代码来源:SplitLogManager.java

示例6: testRescan

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testRescan() throws Exception {
  LOG.info("testRescan");
  SplitLogCounters.resetCounters();
  final ServerName SRV = ServerName.valueOf("svr,1,1");
  RegionServerServices mockedRS = getRegionServer(SRV);
  slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(), mockedRS, neverEndingTask);
  slw.start();
  Thread.yield(); // let the worker start
  Thread.sleep(100);

  String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
  SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER);
  zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, WAIT_TIME);
  // now the worker is busy doing the above task

  // preempt the task, have it owned by another worker
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, WAIT_TIME);

  // create a RESCAN node
  String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
  rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT_SEQUENTIAL);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, WAIT_TIME);
  // RESCAN node might not have been processed if the worker became busy
  // with the above task. preempt the task again so that now the RESCAN
  // node is processed
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, WAIT_TIME);
  waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME);

  List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.splitLogZNode);
  LOG.debug(nodes);
  int num = 0;
  for (String node : nodes) {
    num++;
    if (node.startsWith("RESCAN")) {
      String name = ZKSplitLog.getEncodedNodeName(zkw, node);
      String fn = ZKSplitLog.getFileName(name);
      byte [] data = ZKUtil.getData(zkw, ZKUtil.joinZNode(zkw.splitLogZNode, fn));
      slt = SplitLogTask.parseFrom(data);
      assertTrue(slt.toString(), slt.isDone(SRV));
    }
  }
  assertEquals(2, num);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:52,代码来源:TestSplitLogWorker.java

示例7: testRescan

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testRescan() throws Exception {
  LOG.info("testRescan");
  SplitLogCounters.resetCounters();
  final ServerName SRV = ServerName.valueOf("svr,1,1");
  RegionServerServices mockedRS = getRegionServer(SRV);
  slw = new SplitLogWorker(ds, TEST_UTIL.getConfiguration(), mockedRS, neverEndingTask);
  slw.start();
  Thread.yield(); // let the worker start
  Thread.sleep(100);

  String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
  SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER);
  zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, WAIT_TIME);
  // now the worker is busy doing the above task

  // preempt the task, have it owned by another worker
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, WAIT_TIME);

  // create a RESCAN node
  String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
  rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT_SEQUENTIAL);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, WAIT_TIME);
  // RESCAN node might not have been processed if the worker became busy
  // with the above task. preempt the task again so that now the RESCAN
  // node is processed
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, WAIT_TIME);
  waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME);

  List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.splitLogZNode);
  LOG.debug(Objects.toString(nodes));
  int num = 0;
  for (String node : nodes) {
    num++;
    if (node.startsWith("RESCAN")) {
      String name = ZKSplitLog.getEncodedNodeName(zkw, node);
      String fn = ZKSplitLog.getFileName(name);
      byte [] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(zkw.znodePaths.splitLogZNode, fn));
      slt = SplitLogTask.parseFrom(data);
      assertTrue(slt.toString(), slt.isDone(SRV));
    }
  }
  assertEquals(2, num);
}
 
开发者ID:apache,项目名称:hbase,代码行数:52,代码来源:TestSplitLogWorker.java

示例8: testRescan

import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; //导入方法依赖的package包/类
@Test
public void testRescan() throws Exception {
  LOG.info("testRescan");
  SplitLogCounters.resetCounters();
  final ServerName SRV = ServerName.valueOf("svr,1,1");
  RegionServerServices mockedRS = getRegionServer(SRV);
  slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(), mockedRS, neverEndingTask);
  slw.start();
  Thread.yield(); // let the worker start
  Thread.sleep(100);

  String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
  SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER);
  zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
  // now the worker is busy doing the above task

  // preempt the task, have it owned by another worker
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1500);

  // create a RESCAN node
  String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
  rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
    CreateMode.PERSISTENT_SEQUENTIAL);

  waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, 1500);
  // RESCAN node might not have been processed if the worker became busy
  // with the above task. preempt the task again so that now the RESCAN
  // node is processed
  ZKUtil.setData(zkw, task, slt.toByteArray());
  waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, 1500);
  waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, 1500);

  List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.splitLogZNode);
  LOG.debug(nodes);
  int num = 0;
  for (String node : nodes) {
    num++;
    if (node.startsWith("RESCAN")) {
      String name = ZKSplitLog.getEncodedNodeName(zkw, node);
      String fn = ZKSplitLog.getFileName(name);
      byte [] data = ZKUtil.getData(zkw, ZKUtil.joinZNode(zkw.splitLogZNode, fn));
      slt = SplitLogTask.parseFrom(data);
      assertTrue(slt.toString(), slt.isDone(SRV));
    }
  }
  assertEquals(2, num);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:52,代码来源:TestSplitLogWorker.java


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