Skip to content

Instantly share code, notes, and snippets.

@markrmiller
Last active October 2, 2021 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrmiller/2c197e0a8703e762c6434c80735eef74 to your computer and use it in GitHub Desktop.
Save markrmiller/2c197e0a8703e762c6434c80735eef74 to your computer and use it in GitHub Desktop.
test

public DistributedMap(SolrZkClient zookeeper, String dir) { this.dir = dir;

ZkCmdExecutor cmdExecutor = new ZkCmdExecutor(zookeeper.getZkClientTimeout());
try {
  cmdExecutor.ensureExists(dir, zookeeper);
} catch (KeeperException e) {
  throw new SolrException(ErrorCode.SERVER_ERROR, e);
} catch (InterruptedException e) {
  Thread.currentThread().interrupt();
  throw new SolrException(ErrorCode.SERVER_ERROR, e);
}

this.zookeeper = zookeeper;

}

/mnt/s1/solr3/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java

43:   public DistributedMap(SolrZkClient zookeeper, String dir) {
44:     this.dir = dir;
45: 
46:     ZkCmdExecutor cmdExecutor = new ZkCmdExecutor(zookeeper.getZkClientTimeout());
47:     try {
48:       cmdExecutor.ensureExists(dir, zookeeper);
49:     } catch (KeeperException e) {
50:       throw new SolrException(ErrorCode.SERVER_ERROR, e);
51:     } catch (InterruptedException e) {
52:       Thread.currentThread().interrupt();
53:       throw new SolrException(ErrorCode.SERVER_ERROR, e);
54:     }
55: 
56:     this.zookeeper = zookeeper;
57:   }
File: solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
64:   /**
65:    * Puts an element in the map only if there isn't one with the same trackingId already
66:    * @return True if the the element was added. False if it wasn't (because the key already exists)
67:    */
68:   public boolean putIfAbsent(String trackingId, byte[] data) throws KeeperException, InterruptedException {
69:     try {
70:       zookeeper.makePath(dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, true, true);
71:       return true;
72:     } catch (NodeExistsException e) {
73:       return false;
74:     }
75:   }

File: solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java

539:    if (recoveringAfterStartup) {
540:       // if we're recovering after startup (i.e. we have been down), then we need to know what the last versions were
541:       // when we went down. We may have received updates since then.
542:       recentVersions = startingVersions;
543:       try {
544:         if (ulog.existOldBufferLog()) {
545:           // this means we were previously doing a full index replication
546:           // that probably didn't complete and buffering updates in the
547:           // meantime.
548:           log.info("Looks like a previous replication recovery did not complete - skipping peer sync.");
549:           firstTime = false; // skip peersync
550:         }
551:       } catch (Exception e) {
552:         SolrException.log(log, "Error trying to get ulog starting operation.", e);
553:         firstTime = false; // skip peersync
554:       }
555:     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment