public static void cleanupCollectionLevelSnapshots(SolrZkClient zkClient,String collectionName) throws InterruptedException, KeeperException {
  String zkPath=getSnapshotMetaDataZkPath(collectionName,Optional.empty());
  try {
    Collection<String> snapshots=zkClient.getChildren(zkPath,null,true);
    for (    String snapshot : snapshots) {
      String path=getSnapshotMetaDataZkPath(collectionName,Optional.of(snapshot));
      try {
        zkClient.delete(path,-1,true);
      }
 catch (      KeeperException ex) {
        if (ex.code() != KeeperException.Code.NONODE) {
          throw ex;
        }
      }
    }
    zkClient.delete(zkPath,-1,true);
  }
 catch (  KeeperException ex) {
    if (ex.code() != KeeperException.Code.NONODE) {
      throw ex;
    }
  }
}

public static void cleanupCollectionLevelSnapshots ( SolrZkClient zkClient , String collectionName ) throws InterruptedException , KeeperException { String zkPath = getSnapshotMetaDataZkPath ( collectionName , Optional . empty ( ) ) ; try { Collection < String > snapshots = zkClient . getChildren ( zkPath , null , true ) ; for ( String snapshot : snapshots ) { String path = getSnapshotMetaDataZkPath ( collectionName , Optional . of ( snapshot ) ) ; try { zkClient . delete ( path , - 1 , true ) ; } catch ( KeeperException ex ) { if ( ex . code ( ) != KeeperException . Code . NONODE ) { throw ex ; } } } zkClient . delete ( zkPath , - 1 , true ) ; } catch ( KeeperException ex ) { if ( ex . code ( ) != KeeperException . Code . NONODE ) { throw ex ; } } }
this method deletes all snapshots for the specified collection in zookeeper .
