noblepaul commented on a change in pull request #2187:
URL: https://github.com/apache/lucene-solr/pull/2187#discussion_r554585836
##########
File path: solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
##########
@@ -174,20 +215,30 @@ public boolean hasPendingUpdates() {
* @throws KeeperException if any ZooKeeper operation results in an
error
* @throws InterruptedException if the current thread is interrupted
*/
- public ClusterState writePendingUpdates() throws IllegalStateException,
KeeperException, InterruptedException {
+ public ClusterState writePendingUpdates(Map<String, ZkWriteCommand> updates)
throws IllegalStateException, KeeperException, InterruptedException {
if (invalidState) {
throw new IllegalStateException("ZkStateWriter has seen a tragic error,
this instance can no longer be used");
}
- if (!hasPendingUpdates()) return clusterState;
+ if ((updates == this.updates)
+ && !hasPendingUpdates()) {
+ return clusterState;
+ }
Timer.Context timerContext = stats.time("update_state");
boolean success = false;
try {
if (!updates.isEmpty()) {
- for (Map.Entry<String, DocCollection> entry : updates.entrySet()) {
+ for (Map.Entry<String, ZkWriteCommand> entry : updates.entrySet()) {
String name = entry.getKey();
String path = ZkStateReader.getCollectionPath(name);
- DocCollection c = entry.getValue();
+ ZkWriteCommand cmd = entry.getValue();
+ DocCollection c = cmd.collection;
+ if (cmd.ops != null && cmd.ops.isPreOp()) {
+ cmd.ops.persist(path, reader.getZkClient());
+ clusterState = clusterState.copyWith(name,
+
cmd.collection.copyWith(PerReplicaStates.fetch(cmd.collection.getZNode(),
reader.getZkClient(), null)));
+ }
+ if (!cmd.persistCollState) continue;
Review comment:
preOp is a command that should be run before updating the state.json
operation
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]