Session ntp同步日期/时间失败导致Zk清理过程无法删除客户端会话

Session ntp同步日期/时间失败导致Zk清理过程无法删除客户端会话,session,zk,apache-zookeeper,Session,Zk,Apache Zookeeper,如果出于任何原因,ntp同步。日期/时间失去了正确的时间,集群更改为未来的日期/时间,如果同时集群的日期/时间再次同步到正确的日期/时间,那么在Zk中创建的客户端会话在10分钟后将不会被删除 现在我的假设是zookeeper清理程序在crontab中被激活(每10分钟一次),但只是清理过去的会话 0-59/10****/opt/dve/bin/zookeeper_cleanup.sh 因此,无法清理将来创建的会话,只能在同一日期返回到将来,等待zookeeper_cleanup.sh在10分钟后

如果出于任何原因,ntp同步。日期/时间失去了正确的时间,集群更改为未来的日期/时间,如果同时集群的日期/时间再次同步到正确的日期/时间,那么在Zk中创建的客户端会话在10分钟后将不会被删除

现在我的假设是zookeeper清理程序在crontab中被激活(每10分钟一次),但只是清理过去的会话

0-59/10****/opt/dve/bin/zookeeper_cleanup.sh

因此,无法清理将来创建的会话,只能在同一日期返回到将来,等待zookeeper_cleanup.sh在10分钟后清理会话

我试图删除日志文件,但这可能不是正确的方法,可能会导致其他问题。 所以我应该做得更好。

最后,我们通过zookeeper api删除日志。如下所示:
For last ,we remove the log by zookeeper api.as:

Stat stat = null;
List<String> children = this.zooKeeper.getChildren(tempSessionPath, false, stat);
System.out.println(children.size() + " sessions found.");
int count = 0;
for(String child:children){
  String path = this.tempSessionPath + "/" + child;
  stat = this.zooKeeper.exists(path, false);
  if(null != stat && stat.getCtime() > currentTime){
  count++;
  System.out.println("Session created in future time " + stat.getCtime() + " to be deleted!");
  safeDeleteZKNode(path, stat);
  }
}
System.out.println(count + " future sessions cleaned!");    
Stat=null; List children=this.zooKeeper.getChildren(tempSessionPath,false,stat); System.out.println(children.size()+“sessions found.”); 整数计数=0; for(字符串子项:子项){ 字符串路径=this.tempSessionPath+“/”+子级; stat=this.zooKeeper.exists(路径,false); if(null!=stat&&stat.getCtime()>currentTime){ 计数++; System.out.println(“在未来时间创建的会话”+stat.getCtime()+“要删除!”); 安全删除节点(路径、状态); } } System.out.println(count+“未来会话已清理!”);