You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2016/04/20 18:06:47 UTC

lucene-solr:master: SOLR-8913: When using a shared filesystem we should store data dir and tlog dir locations in the cluster state.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 221ecfa89 -> b44ca080d


SOLR-8913: When using a shared filesystem we should store data dir and tlog dir locations in the cluster state.


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

Branch: refs/heads/master
Commit: b44ca080d6967fce9f6689e38f2b52968bb96d81
Parents: 221ecfa
Author: markrmiller <ma...@apache.org>
Authored: Wed Apr 20 11:54:09 2016 -0400
Committer: markrmiller <ma...@apache.org>
Committed: Wed Apr 20 12:05:15 2016 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                   |  3 +++
 .../java/org/apache/solr/cloud/ZkController.java   |  5 ++---
 .../org/apache/solr/cloud/hdfs/StressHdfsTest.java | 17 ++++++++++++++++-
 3 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b44ca080/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9e184e3..8630ea4 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -103,6 +103,9 @@ New Features
 
 * SOLR-8918: Adds Streaming to the admin page under the collections section. Includes
   ability to see graphically the expression explanation (Dennis Gove)
+  
+* SOLR-8913: When using a shared filesystem we should store data dir and tlog dir locations in 
+  the cluster state. (Mark Miller)
 
 * SOLR-8809: Implement Connection.prepareStatement (Kevin Risden)
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b44ca080/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index bdd6a62..3afc3b9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1165,9 +1165,8 @@ public final class ZkController {
       if (coreNodeName != null) {
         props.put(ZkStateReader.CORE_NODE_NAME_PROP, coreNodeName);
       }
-      
-      if (ClusterStateUtil.isAutoAddReplicas(getZkStateReader(), collection)) {
-        try (SolrCore core = cc.getCore(cd.getName())) {
+      try (SolrCore core = cc.getCore(cd.getName())) {
+        if (core != null && core.getDirectoryFactory().isSharedStorage()) {
           if (core != null && core.getDirectoryFactory().isSharedStorage()) {
             props.put("dataDir", core.getDataDir());
             UpdateLog ulog = core.getUpdateHandler().getUpdateLog();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b44ca080/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
index aeb4cb7..b2dba10 100644
--- a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
@@ -32,6 +32,9 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.cloud.BasicDistributedZkTest;
 import org.apache.solr.cloud.ChaosMonkey;
+import org.apache.solr.common.cloud.ClusterState;
+import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.params.CollectionParams.CollectionAction;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -46,6 +49,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
@@ -106,7 +110,7 @@ public class StressHdfsTest extends BasicDistributedZkTest {
         createCollection(DELETE_DATA_DIR_COLLECTION, 1, 1, 1);
         
         waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
-        
+
         ChaosMonkey.stop(jettys.get(0));
         
         // enter safe mode and restart a node
@@ -153,6 +157,17 @@ public class StressHdfsTest extends BasicDistributedZkTest {
     createCollection(DELETE_DATA_DIR_COLLECTION, nShards, rep, maxReplicasPerNode);
 
     waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
+    
+    // data dirs should be in zk, SOLR-8913
+    ClusterState clusterState = cloudClient.getZkStateReader().getClusterState();
+    Slice slice = clusterState.getSlice(DELETE_DATA_DIR_COLLECTION, "shard1");
+    assertNotNull(clusterState.getSlices(DELETE_DATA_DIR_COLLECTION).toString(), slice);
+    Collection<Replica> replicas = slice.getReplicas();
+    for (Replica replica : replicas) {
+      assertNotNull(replica.getProperties().toString(), replica.get("dataDir"));
+      assertNotNull(replica.getProperties().toString(), replica.get("ulogDir"));
+    }
+    
     cloudClient.setDefaultCollection(DELETE_DATA_DIR_COLLECTION);
     cloudClient.getZkStateReader().forceUpdateCollection(DELETE_DATA_DIR_COLLECTION);