lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:master: SOLR-11642: remove Policy.Session from OverseerCollectionMessageHandler
Date Wed, 15 Nov 2017 10:48:43 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master aef58a26a -> cfea3d5e8


SOLR-11642: remove Policy.Session from OverseerCollectionMessageHandler


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/cfea3d5e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cfea3d5e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cfea3d5e

Branch: refs/heads/master
Commit: cfea3d5e835ed56eb365565488646a56d6cae1ff
Parents: aef58a2
Author: Noble Paul <noble@apache.org>
Authored: Wed Nov 15 21:18:33 2017 +1030
Committer: Noble Paul <noble@apache.org>
Committed: Wed Nov 15 21:18:33 2017 +1030

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java      | 2 +-
 solr/core/src/java/org/apache/solr/cloud/Assign.java             | 3 +--
 .../core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java | 2 +-
 solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java     | 2 +-
 .../org/apache/solr/cloud/OverseerCollectionMessageHandler.java  | 2 --
 solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java         | 2 +-
 solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java      | 4 ++--
 .../apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java | 4 ++++
 8 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java b/solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java
index e6e7ae7..b5101f5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/AddReplicaCmd.java
@@ -222,7 +222,7 @@ public class AddReplicaCmd implements OverseerCollectionMessageHandler.Cmd
{
       ocmh.waitForCoreNodeName(collection, fnode, fcoreName);
       if (policyVersionAfter.get() > -1) {
         PolicyHelper.REF_VERSION.remove();
-        ocmh.policySessionRef.decref(policyVersionAfter.get());
+        PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()).decref(policyVersionAfter.get());
       }
       if (onComplete != null) onComplete.run();
     };

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/Assign.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/Assign.java b/solr/core/src/java/org/apache/solr/cloud/Assign.java
index ad4ffea..c7bd577 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Assign.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Assign.java
@@ -294,14 +294,13 @@ public class Assign {
       if (message.getStr(CREATE_NODE_SET) == null)
         nodeList = Collections.emptyList();// unless explicitly specified do not pass node
list to Policy
       synchronized (ocmh) {
-        PolicyHelper.SESSION_REF.set(ocmh.policySessionRef);
+        PolicyHelper.SESSION_REF.set(PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()));
         try {
           return getPositionsUsingPolicy(collectionName,
               shardNames, numNrtReplicas, numTlogReplicas, numPullReplicas, policyName, ocmh.overseer.getSolrCloudManager(),
nodeList);
         } finally {
           PolicyHelper.SESSION_REF.remove();
         }
-
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
index 3925a7e..94d7d9f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
@@ -318,7 +318,7 @@ public class CreateCollectionCmd implements Cmd {
     } catch (Exception ex) {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, ex);
     } finally {
-      PolicyHelper.clearFlagAndDecref(ocmh.policySessionRef);
+      PolicyHelper.clearFlagAndDecref(PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
index 03fc045..73ac7ff 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
@@ -164,7 +164,7 @@ public class CreateShardCmd implements Cmd {
         });
       }
     } finally {
-      PolicyHelper.clearFlagAndDecref(ocmh.policySessionRef);
+      PolicyHelper.clearFlagAndDecref(PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()));
     }
 
     log.debug("Waiting for create shard action to complete");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
index 12bc49f..9a9c949 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
@@ -36,7 +36,6 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.cloud.DistributedQueue;
-import org.apache.solr.client.solrj.cloud.autoscaling.PolicyHelper;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient.RemoteSolrException;
 import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
@@ -971,7 +970,6 @@ public class OverseerCollectionMessageHandler implements OverseerMessageHandler,
     );
   }
 
-  public final PolicyHelper.SessionRef policySessionRef = new PolicyHelper.SessionRef();
 
   @Override
   public void close() throws IOException {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java b/solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java
index a1990b4..1f9d64a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RestoreCmd.java
@@ -350,7 +350,7 @@ public class RestoreCmd implements OverseerCollectionMessageHandler.Cmd
{
 
       log.info("Completed restoring collection={} backupName={}", restoreCollection, backupName);
     } finally {
-      PolicyHelper.clearFlagAndDecref(ocmh.policySessionRef);
+      PolicyHelper.clearFlagAndDecref(PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
index 4a91ba5..2c1e5d6 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
@@ -32,7 +32,6 @@ import org.apache.solr.client.solrj.cloud.autoscaling.PolicyHelper;
 import org.apache.solr.client.solrj.request.CoreAdminRequest;
 import org.apache.solr.cloud.OverseerCollectionMessageHandler.Cmd;
 import org.apache.solr.cloud.overseer.OverseerAction;
-import org.apache.solr.common.cloud.ReplicaPosition;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.CompositeIdRouter;
@@ -40,6 +39,7 @@ import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.cloud.DocRouter;
 import org.apache.solr.common.cloud.PlainIdRouter;
 import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.cloud.ReplicaPosition;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
@@ -513,7 +513,7 @@ public class SplitShardCmd implements Cmd {
       log.error("Error executing split operation for collection: " + collectionName + " parent
shard: " + slice, e);
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e);
     } finally {
-      PolicyHelper.clearFlagAndDecref(ocmh.policySessionRef);
+      PolicyHelper.clearFlagAndDecref(PolicyHelper.getPolicySessionRef(ocmh.overseer.getSolrCloudManager()));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cfea3d5e/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
index daafb8f..5d179b7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
@@ -223,6 +223,10 @@ public class PolicyHelper {
     if (refVersion != null) policySessionRef.decref(refVersion);
     REF_VERSION.remove();
   }
+  public static PolicyHelper.SessionRef getPolicySessionRef(SolrCloudManager cloudManager){
+    return (SessionRef) cloudManager.getObjectCache().computeIfAbsent(SessionRef.class.getName(),
s -> new SessionRef());
+  }
+
 
   public static ThreadLocal<SessionRef> SESSION_REF = new ThreadLocal<>();
 


Mime
View raw message