org.apache.zookeeper.server.ZKDatabase.getDataTreeLastProcessedZxid()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.apache.zookeeper.server.ZKDatabase.getDataTreeLastProcessedZxid()方法的一些代码示例,展示了ZKDatabase.getDataTreeLastProcessedZxid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKDatabase.getDataTreeLastProcessedZxid()方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZKDatabase
类名称:ZKDatabase
方法名:getDataTreeLastProcessedZxid

ZKDatabase.getDataTreeLastProcessedZxid介绍

[英]get the last processed zxid from a datatree
[中]从数据树中获取最后处理的zxid

代码示例

代码示例来源:origin: apache/zookeeper

/**
 * return the last proceesed id from the
 * datatree
 */
public long getLastProcessedZxid() {
  return zkDb.getDataTreeLastProcessedZxid();
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

/**
 * return the last proceesed id from the 
 * datatree
 */
public long getLastProcessedZxid() {
  return zkDb.getDataTreeLastProcessedZxid();
}

代码示例来源:origin: apache/zookeeper

/**
 * returns the highest zxid that this host has seen
 *
 * @return the highest zxid for this host
 */
public long getLastLoggedZxid() {
  if (!zkDb.isInitialized()) {
    loadDataBase();
  }
  return zkDb.getDataTreeLastProcessedZxid();
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

/**
 * returns the highest zxid that this host has seen
 * 
 * @return the highest zxid for this host
 */
public long getLastLoggedZxid() {
  if (!zkDb.isInitialized()) {
    loadDataBase();
  }
  return zkDb.getDataTreeLastProcessedZxid();
}

代码示例来源:origin: apache/zookeeper

setZxid(zkDb.getDataTreeLastProcessedZxid());
killSession(session, zkDb.getDataTreeLastProcessedZxid());

代码示例来源:origin: apache/zookeeper

long maxCommittedLog = db.getmaxCommittedLog();
long minCommittedLog = db.getminCommittedLog();
long lastProcessedZxid = db.getDataTreeLastProcessedZxid();
  currentZxid = db.getDataTreeLastProcessedZxid();

代码示例来源:origin: org.apache.zookeeper/zookeeper

setZxid(zkDb.getDataTreeLastProcessedZxid());
for (long session : deadSessions) {
  killSession(session, zkDb.getDataTreeLastProcessedZxid());

代码示例来源:origin: apache/zookeeper

case OpCode.check:
  ReplyHeader hdr = new ReplyHeader(request.cxid, zks.getZKDatabase()
      .getDataTreeLastProcessedZxid(), Code.NOTREADONLY.intValue());
  try {
    request.cnxn.sendResponse(hdr, null, null);

代码示例来源:origin: apache/zookeeper

/**
 * Wait for all server to have the same lastProccessedZxid. Timeout in seconds
 */
private boolean waitForSync(QuorumUtil qu, int index, int timeout) throws InterruptedException{
  LOG.info("Wait for server to sync");
  int leaderIndex = (index == 1) ? 2 : 1;
  ZKDatabase restartedDb = qu.getPeer(index).peer.getActiveServer().getZKDatabase();
  ZKDatabase cleanDb =  qu.getPeer(3).peer.getActiveServer().getZKDatabase();
  ZKDatabase leadDb = qu.getPeer(leaderIndex).peer.getActiveServer().getZKDatabase();
  long leadZxid = 0;
  long cleanZxid = 0;
  long restartedZxid = 0;
  for (int i = 0; i < timeout; ++i) {
    leadZxid = leadDb.getDataTreeLastProcessedZxid();
    cleanZxid = cleanDb.getDataTreeLastProcessedZxid();
    restartedZxid = restartedDb.getDataTreeLastProcessedZxid();
    if (leadZxid == cleanZxid && leadZxid == restartedZxid) {
      return true;
    }
    Thread.sleep(1000);
  }
  LOG.info("Timeout waiting for zxid to sync: leader 0x{}" +
       "clean 0x{}" +
       "restarted 0x{}", Long.toHexString(leadZxid), Long.toHexString(cleanZxid),
      Long.toHexString(restartedZxid));
  return false;
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

case OpCode.check:
  ReplyHeader hdr = new ReplyHeader(request.cxid, zks.getZKDatabase()
      .getDataTreeLastProcessedZxid(), Code.NOTREADONLY.intValue());
  try {
    request.cnxn.sendResponse(hdr, null, null);

代码示例来源:origin: apache/zookeeper

(new Integer(tokens[1])).intValue() + 1);
ZooKeeperServer zks = getServer(serverFactory);
long eZxid = zks.getZKDatabase().getDataTreeLastProcessedZxid();
    zks.getZKDatabase().getDataTreeLastProcessedZxid() - 10);
LOG.info("Set lastProcessedZxid to "
    + zks.getZKDatabase().getDataTreeLastProcessedZxid());
long fZxid = zks.getZKDatabase().getDataTreeLastProcessedZxid();

代码示例来源:origin: apache/zookeeper

learnerMaster.getLearnerSnapshotThrottler().beginSnapshot(exemptFromThrottle);
try {
  long zxidToSend = learnerMaster.getZKDatabase().getDataTreeLastProcessedZxid();
  oa.writeRecord(new QuorumPacket(Leader.SNAP, zxidToSend, null, null), "packet");
  bufferedOutput.flush();

代码示例来源:origin: apache/zookeeper

+ Long.toHexString(connReq.getLastZxidSeen())
+ " our last zxid is 0x"
+ Long.toHexString(getZKDatabase().getDataTreeLastProcessedZxid())
+ " client must try another server";

代码示例来源:origin: apache/zookeeper

/**
   * ZOOKEEPER-1573: test restoring a snapshot with deleted txns ahead of the
   * snapshot file's zxid.
   */
  @Test
  public void testReloadSnapshotWithMissingParent() throws Exception {
    // create transactions to create the snapshot with create/delete pattern
    ZooKeeper zk = createZKClient(hostPort);
    zk.create("/a", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
        CreateMode.PERSISTENT);
    Stat stat = zk.exists("/a", false);
    long createZxId = stat.getMzxid();
    zk.create("/a/b", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
        CreateMode.PERSISTENT);
    zk.delete("/a/b", -1);
    zk.delete("/a", -1);
    // force the zxid to be behind the content
    ZooKeeperServer zks = getServer(serverFactory);
    zks.getZKDatabase().setlastProcessedZxid(createZxId);
    LOG.info("Set lastProcessedZxid to {}", zks.getZKDatabase()
        .getDataTreeLastProcessedZxid());
    // Force snapshot and restore
    zks.takeSnapshot();
    zks.shutdown();
    stopServer();

    startServer();
  }
}

代码示例来源:origin: apache/zookeeper

zks.getZKDatabase().getDataTreeLastProcessedZxid() - 10);
LOG.info("Set lastProcessedZxid to "
    + zks.getZKDatabase().getDataTreeLastProcessedZxid());

代码示例来源:origin: apache/zookeeper

long epochF = (qu.getPeer(index).peer.getActiveServer().getZxid() >> 32L);
long epochL = (leader.getEpoch() >> 32L);
assertTrue("Zxid: " + qu.getPeer(index).peer.getActiveServer().getZKDatabase().getDataTreeLastProcessedZxid() +
    "Current epoch: " + epochF, epochF == epochL);
int leaderIndex = (index == 1) ? 2 : 1;

代码示例来源:origin: apache/zookeeper

long zxid = zks.getZKDatabase().getDataTreeLastProcessedZxid();
LOG.info("After clean restart, zxid = " + zxid);
Assert.assertTrue("zxid > 0", zxid > 0);

代码示例来源:origin: apache/zookeeper

qp.setZxid(zkDb.getDataTreeLastProcessedZxid());
oa.writeRecord(qp, null);
final long createSessionZxid = ZxidUtils.makeZxid(1, 2);

代码示例来源:origin: apache/zookeeper

qp.setZxid(zkDb.getDataTreeLastProcessedZxid());
oa.writeRecord(qp, null);
zkDb.serializeSnapshot(oa);

代码示例来源:origin: apache/zookeeper

qp.setZxid(zkDb.getDataTreeLastProcessedZxid());
oa.writeRecord(qp, null);
zkDb.serializeSnapshot(oa);

相关文章