Package org.apache.zookeeper.data

Examples of org.apache.zookeeper.data.Stat


  {
    long startT = System.nanoTime();

    try
    {
      Stat stat = retryUntilConnected(new Callable<Stat>()
      {

        @Override
        public Stat call() throws Exception
        {
          Stat stat = ((ZkConnection) _connection).getZookeeper().exists(path, false);
          return stat;
        }
      });

      return stat;
View Full Code Here


    }
  }

  public Stat writeDataGetStat(final String path, Object datat, final int expectedVersion) throws InterruptedException
  {
    Stat stat = null;
    long start = System.nanoTime();
    try
    {
      byte[] bytes = _zkSerializer.serialize(datat, path);
      stat =
View Full Code Here

      subPaths.add("");
    }
    for (String subPath : subPaths)
    {
      String fullPath = subPath.length() > 0 ? path + "/" + subPath : path;
      Stat pathStat = _zkClient.getStat(fullPath);

      long lastModifiedTimeInMs = pathStat.getMtime();
      long nowInMs = new Date().getTime();
      // logger.info(nowInMs + " " + lastModifiedTimeInMs + " " + fullPath);

      // Check the last modified time
      if (nowInMs > lastModifiedTimeInMs)
View Full Code Here

    DataUpdater<ZNRecord> updater = new HighWaterMarkUpdater(message,
        lastRecordProcessed);
    helixPropertyStore.update(
        "TRANSACTION_ID_METADATA" + "/" + message.getResourceName(), updater,
        AccessOption.PERSISTENT);
    Stat stat = new Stat();
    ;
    ZNRecord znRecord = helixPropertyStore.get("TRANSACTION_ID_METADATA" + "/"
        + message.getResourceName(), stat, AccessOption.PERSISTENT);
    int startGen = Integer.parseInt(znRecord.getSimpleField("currentGen"));
    int startSeq = Integer.parseInt(znRecord
View Full Code Here

  // newRoot,Stat newStat, String path)
  private boolean refreshRecursively(Node<T> oldRoot, Node<T> newRoot,
      String path)
  {
    boolean dataChanged = false;
    Stat newStat = _zkClient.getStat(path);
    Stat oldStat = (oldRoot != null) ? oldRoot.stat : null;
    newRoot.name = path;
    if (newStat != null)
    {
      if (oldStat == null)
      {
View Full Code Here

    ZkHelixPropertyStore<ZNRecord> store = controller.getHelixPropertyStore();
    ZNRecord record = new ZNRecord("node_1");
    int options = 0;
    store.set("node_1", record, AccessOption.PERSISTENT);
    Stat stat = new Stat();
    record = store.get("node_1",stat, options);
    AssertJUnit.assertEquals("node_1", record.getId());

    controller.getMessagingService();
    controller.getHealthReportCollector();
View Full Code Here

  public List<ZNode> getChildren(ZNode node) throws IOException, InterruptedException {
    if (logger.isDebugEnabled())
      logger.debug("getChildren(" + node.getPath() + ")");
    List<ZNode> childNodes = new ArrayList<ZNode>();
    try {
      Stat nodeStat = new Stat();
      List<String> children = client.getChildren(node.getPath(), false, nodeStat);
      copyFromStat(nodeStat, node);

      if (children != null) {
        for (String child : children) {
          ZNode cNode = HadoopFactory.eINSTANCE.createZNode();
          cNode.setNodeName(child);
          cNode.setParent(node);
          Stat exists = client.exists(cNode.getPath(), false);
          if (exists != null) {
            copyFromStat(exists, cNode);
            childNodes.add(cNode);
          }
        }
View Full Code Here

   */
  @Override
  public byte[] open(ZNode node) throws InterruptedException, IOException {
    if(logger.isDebugEnabled())
      logger.debug("open("+node.getPath()+")");
    Stat stat = new Stat();
    byte[] nd;
    try {
      nd = client.getData(node.getPath(), false, stat);
    } catch (KeeperException e) {
      throw new IOException(e.getMessage(), e);
View Full Code Here

      List<HRegion> daughters = checkAndGetDaughters(tableName);
      // Assert the ephemeral node is up in zk.
      String path = ZKAssign.getNodeName(TESTING_UTIL.getZooKeeperWatcher(),
        hri.getEncodedName());
      RegionTransition rt = null;
      Stat stats = null;
      // Wait till the znode moved to SPLIT
      for (int i=0; i<100; i++) {
        stats = TESTING_UTIL.getZooKeeperWatcher().getRecoverableZooKeeper().exists(path, false);
        rt = RegionTransition.parseFrom(ZKAssign.getData(TESTING_UTIL.getZooKeeperWatcher(),
          hri.getEncodedName()));
View Full Code Here

      this.admin.split(hri.getRegionNameAsString());
      checkAndGetDaughters(tableName);
      // Assert the ephemeral node is up in zk.
      String path = ZKAssign.getNodeName(zkw, hri.getEncodedName());
      Stat stats = zkw.getRecoverableZooKeeper().exists(path, false);
      LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
          + stats);
      byte[] bytes = ZKAssign.getData(zkw, hri.getEncodedName());
      RegionTransition rtd = RegionTransition.parseFrom(bytes);
      // State could be SPLIT or SPLITTING.
      assertTrue(rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLIT)
          || rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLITTING));

      // abort and wait for new master.
      MockMasterWithoutCatalogJanitor master = abortAndWaitForMaster();

      this.admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());

      // Update the region to be offline and split, so that HRegionInfo#equals
      // returns true in checking rebuilt region states map.
      hri.setOffline(true);
      hri.setSplit(true);
      ServerName regionServerOfRegion = master.getAssignmentManager()
        .getRegionStates().getRegionServerOfRegion(hri);
      assertTrue(regionServerOfRegion != null);

      // Remove the block so that split can move ahead.
      AssignmentManager.TEST_SKIP_SPLIT_HANDLING = false;
      String node = ZKAssign.getNodeName(zkw, hri.getEncodedName());
      Stat stat = new Stat();
      byte[] data = ZKUtil.getDataNoWatch(zkw, node, stat);
      // ZKUtil.create
      for (int i=0; data != null && i<60; i++) {
        Thread.sleep(1000);
        data = ZKUtil.getDataNoWatch(zkw, node, stat);
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.data.Stat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.