From 52536c12a2833f0c398dffa8b7cef2e3119b02ee Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Tue, 11 Dec 2012 18:32:37 +0000 Subject: [PATCH] SOLR-4114: add back commented out test with 10 second wait, add Per's new test, add test to ensure no two cores use the same index directory git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1420327 13f79535-47bb-0310-9956-ffa450edef68 --- dev-tools/maven/pom.xml.template | 3 +- solr/core/ivy.xml | 4 +- .../cloud/OverseerCollectionProcessor.java | 8 +- .../java/org/apache/solr/core/SolrCore.java | 1 + .../solr/cloud/BasicDistributedZkTest.java | 57 ++- .../OverseerCollectionProcessorTest.java | 418 ++++++++++++++++++ solr/licenses/cglib-nodep-2.2.jar.sha1 | 1 + solr/licenses/cglib-nodep-LICENSE-ASL.txt | 201 +++++++++ solr/licenses/cglib-nodep-NOTICE.txt | 2 + solr/licenses/easymock-2.2.jar.sha1 | 1 - solr/licenses/easymock-3.0.jar.sha1 | 1 + solr/licenses/objenesis-1.2.jar.sha1 | 1 + solr/licenses/objenesis-LICENSE-ASL.txt | 202 +++++++++ solr/licenses/objenesis-NOTICE.txt | 8 + 14 files changed, 899 insertions(+), 9 deletions(-) create mode 100644 solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java create mode 100644 solr/licenses/cglib-nodep-2.2.jar.sha1 create mode 100644 solr/licenses/cglib-nodep-LICENSE-ASL.txt create mode 100644 solr/licenses/cglib-nodep-NOTICE.txt delete mode 100644 solr/licenses/easymock-2.2.jar.sha1 create mode 100644 solr/licenses/easymock-3.0.jar.sha1 create mode 100644 solr/licenses/objenesis-1.2.jar.sha1 create mode 100644 solr/licenses/objenesis-LICENSE-ASL.txt create mode 100644 solr/licenses/objenesis-NOTICE.txt diff --git a/dev-tools/maven/pom.xml.template b/dev-tools/maven/pom.xml.template index effbea39c2f..e0cb50e86f9 100644 --- a/dev-tools/maven/pom.xml.template +++ b/dev-tools/maven/pom.xml.template @@ -368,7 +368,8 @@ org.easymock easymock - 2.2 + 3.0 + test org.eclipse.jetty diff --git a/solr/core/ivy.xml b/solr/core/ivy.xml index b740a271582..93c63170dcf 100644 --- a/solr/core/ivy.xml +++ b/solr/core/ivy.xml @@ -25,7 +25,9 @@ - + + + diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java index 9887549c038..6ca21d2e041 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java @@ -77,11 +77,15 @@ public class OverseerCollectionProcessor implements Runnable { private boolean isClosed; public OverseerCollectionProcessor(ZkStateReader zkStateReader, String myId, ShardHandler shardHandler, String adminPath) { + this(zkStateReader, myId, shardHandler, adminPath, Overseer.getCollectionQueue(zkStateReader.getZkClient())); + } + + protected OverseerCollectionProcessor(ZkStateReader zkStateReader, String myId, ShardHandler shardHandler, String adminPath, DistributedQueue workQueue) { this.zkStateReader = zkStateReader; this.myId = myId; this.shardHandler = shardHandler; this.adminPath = adminPath; - workQueue = Overseer.getCollectionQueue(zkStateReader.getZkClient()); + this.workQueue = workQueue; } @Override @@ -130,7 +134,7 @@ public class OverseerCollectionProcessor implements Runnable { isClosed = true; } - private boolean amILeader() { + protected boolean amILeader() { try { ZkNodeProps props = ZkNodeProps.load(zkStateReader.getZkClient().getData( "/overseer_elect/leader", null, null, true)); diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java index 71320818965..355b7400c4a 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java @@ -2203,6 +2203,7 @@ public final class SolrCore implements SolrInfoMBean { lst.add("coreName", name==null ? "(null)" : name); lst.add("startTime", new Date(startTime)); lst.add("refCount", getOpenCount()); + lst.add("indexDir", getIndexDir()); CoreDescriptor cd = getCoreDescriptor(); if (cd != null) { diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java index f41ddac5b11..fb192a3b362 100644 --- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java @@ -19,11 +19,13 @@ package org.apache.solr.cloud; import java.io.File; import java.io.IOException; +import java.lang.management.ManagementFactory; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -37,6 +39,10 @@ import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; +import javax.management.ObjectName; + import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util._TestUtil; import org.apache.solr.JSONTestUtil; @@ -71,6 +77,8 @@ import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.UpdateParams; import org.apache.solr.common.util.NamedList; +import org.apache.solr.core.SolrCore; +import org.apache.solr.core.SolrInfoMBean.Category; import org.apache.solr.update.DirectUpdateHandler2; import org.apache.solr.update.SolrCmdDistributor.Request; import org.apache.solr.util.DefaultSolrThreadFactory; @@ -876,8 +884,11 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { collectionInfos = new HashMap>(); createCollection(collectionInfos, cnt, numShards, replicationFactor, maxShardsPerNode); - // TODO: enable this check after removing the 60 second wait in it - //checkCollectionIsNotCreated(collectionInfos.keySet().iterator().next()); + // TODO: REMOVE THE SLEEP IN THE METHOD CALL WHEN WE HAVE COLLECTION API + // RESPONSES + checkCollectionIsNotCreated(collectionInfos.keySet().iterator().next()); + + checkNoTwoShardsUseTheSameIndexDir(); } @@ -1076,8 +1087,8 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { private void checkCollectionIsNotCreated(String collectionName) throws Exception { - // TODO: this method not called because of below sleep - Thread.sleep(60000); + // TODO: REMOVE THIS SLEEP WHEN WE HAVE COLLECTION API RESPONSES + Thread.sleep(10000); assertFalse(collectionName + " not supposed to exist", getCommonCloudSolrServer().getZkStateReader().getClusterState().getCollections().contains(collectionName)); } @@ -1499,6 +1510,44 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { assertEquals(collection3Docs, collection2Docs - 1); } + private void checkNoTwoShardsUseTheSameIndexDir() throws Exception { + Map> indexDirToShardNamesMap = new HashMap>(); + + List servers = new LinkedList(); + servers.add(ManagementFactory.getPlatformMBeanServer()); + servers.addAll(MBeanServerFactory.findMBeanServer(null)); + for (final MBeanServer server : servers) { + Set mbeans = new HashSet(); + mbeans.addAll(server.queryNames(null, null)); + for (final ObjectName mbean : mbeans) { + Object value; + Object indexDir; + Object name; + try { + if (((value = server.getAttribute(mbean, "category")) != null && value.toString().equals(Category.CORE.toString())) && + ((value = server.getAttribute(mbean, "source")) != null && value.toString().contains(SolrCore.class.getSimpleName())) && + ((indexDir = server.getAttribute(mbean, "indexDir")) != null) && + ((name = server.getAttribute(mbean, "name")) != null)) { + if (!indexDirToShardNamesMap.containsKey(indexDir.toString())) { + indexDirToShardNamesMap.put(indexDir.toString(), new HashSet()); + } + indexDirToShardNamesMap.get(indexDir.toString()).add(name.toString()); + } + } catch (Exception e) { + // ignore, just continue - probably a "category" or "source" attribute not found + } + } + } + + assertTrue("Something is broken in the assert for no shards using the same indexDir - probably something was changed in the attributes published in the MBean of " + SolrCore.class.getSimpleName(), indexDirToShardNamesMap.size() > 0); + for (Entry> entry : indexDirToShardNamesMap.entrySet()) { + if (entry.getValue().size() > 1) { + fail("We have shards using the same indexDir. E.g. shards " + entry.getValue().toString() + " all use indexDir " + entry.getKey()); + } + } + + } + protected SolrInputDocument getDoc(Object... fields) throws Exception { SolrInputDocument doc = new SolrInputDocument(); addFields(doc, fields); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java new file mode 100644 index 00000000000..54737e3643b --- /dev/null +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java @@ -0,0 +1,418 @@ +package org.apache.solr.cloud; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import static org.easymock.EasyMock.capture; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.expectLastCall; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Queue; +import java.util.Set; + +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.common.cloud.ClusterState; +import org.apache.solr.common.cloud.ZkNodeProps; +import org.apache.solr.common.cloud.ZkStateReader; +import org.apache.solr.common.params.CoreAdminParams; +import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction; +import org.apache.solr.common.params.ModifiableSolrParams; +import org.apache.solr.handler.component.ShardHandler; +import org.apache.solr.handler.component.ShardRequest; +import org.apache.solr.handler.component.ShardResponse; +import org.easymock.Capture; +import org.easymock.IAnswer; +import org.eclipse.jetty.util.BlockingArrayQueue; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OverseerCollectionProcessorTest extends SolrTestCaseJ4 { + + private static final String ADMIN_PATH = "/admin/cores"; + private static final String COLLECTION_NAME = "mycollection"; + private static final String CONFIG_NAME = "myconfig"; + + private OverseerCollectionProcessor underTest; + private DistributedQueue workQueueMock; + private ShardHandler shardHandlerMock; + private ZkStateReader zkStateReaderMock; + private ClusterState clusterStateMock; + + private Thread thread; + private Queue queue = new BlockingArrayQueue(); + + private class OverseerCollectionProcessorToBeTested extends + OverseerCollectionProcessor { + + public OverseerCollectionProcessorToBeTested(ZkStateReader zkStateReader, + String myId, ShardHandler shardHandler, String adminPath, + DistributedQueue workQueue) { + super(zkStateReader, myId, shardHandler, adminPath, workQueue); + } + + @Override + protected boolean amILeader() { + return true; + } + + } + + @Before + public void setUp() throws Exception { + super.setUp(); + workQueueMock = createMock(DistributedQueue.class); + shardHandlerMock = createMock(ShardHandler.class); + zkStateReaderMock = createMock(ZkStateReader.class); + clusterStateMock = createMock(ClusterState.class); + underTest = new OverseerCollectionProcessorToBeTested(zkStateReaderMock, + "1234", shardHandlerMock, ADMIN_PATH, workQueueMock); + } + + @After + public void tearDown() throws Exception { + underTest.close(); + thread.interrupt(); + stopComponentUnderTest(); + super.tearDown(); + } + + protected Set commonMocks(int liveNodesCount) throws Exception { + workQueueMock.peek(true); + expectLastCall().andAnswer(new IAnswer() { + @Override + public Object answer() throws Throwable { + Object result; + while ((result = queue.peek()) == null) { + Thread.sleep(1000); + } + return result; + } + }).anyTimes(); + + workQueueMock.remove(); + expectLastCall().andAnswer(new IAnswer() { + @Override + public Object answer() throws Throwable { + return queue.poll(); + } + }).anyTimes(); + + zkStateReaderMock.getClusterState(); + expectLastCall().andAnswer(new IAnswer() { + @Override + public Object answer() throws Throwable { + return clusterStateMock; + } + }).anyTimes(); + + clusterStateMock.getCollections(); + expectLastCall().andAnswer(new IAnswer() { + @Override + public Object answer() throws Throwable { + return new HashSet(); + } + }).anyTimes(); + final Set liveNodes = new HashSet(); + for (int i = 0; i < liveNodesCount; i++) { + liveNodes.add("localhost:" + (8963 + i) + "_solr"); + } + clusterStateMock.getLiveNodes(); + expectLastCall().andAnswer(new IAnswer() { + @Override + public Object answer() throws Throwable { + return liveNodes; + } + }).anyTimes(); + + return liveNodes; + } + + protected void startComponentUnderTest() { + thread = new Thread(underTest); + thread.start(); + } + + protected void stopComponentUnderTest() throws Exception { + thread.join(); + } + + private class SubmitCapture { + public Capture shardRequestCapture = new Capture(); + public Capture nodeUrlsWithoutProtocolPartCapture = new Capture(); + public Capture params = new Capture(); + } + + protected List mockShardHandlerForCreateJob( + Integer numberOfSlices, Integer numberOfReplica) { + List submitCaptures = new ArrayList(); + for (int i = 0; i < (numberOfSlices * numberOfReplica); i++) { + SubmitCapture submitCapture = new SubmitCapture(); + shardHandlerMock.submit(capture(submitCapture.shardRequestCapture), + capture(submitCapture.nodeUrlsWithoutProtocolPartCapture), + capture(submitCapture.params)); + expectLastCall(); + submitCaptures.add(submitCapture); + ShardResponse shardResponseWithoutException = new ShardResponse(); + expect(shardHandlerMock.takeCompletedOrError()).andReturn( + shardResponseWithoutException); + } + expect(shardHandlerMock.takeCompletedOrError()).andReturn(null); + return submitCaptures; + } + + protected void issueCreateJob(Integer numberOfSlices, + Integer replicationFactor, Integer maxShardsPerNode) { + ZkNodeProps props = new ZkNodeProps(Overseer.QUEUE_OPERATION, + OverseerCollectionProcessor.CREATECOLLECTION, + OverseerCollectionProcessor.REPLICATION_FACTOR, + replicationFactor.toString(), "name", COLLECTION_NAME, + "collection.configName", CONFIG_NAME, + OverseerCollectionProcessor.NUM_SLICES, numberOfSlices.toString(), + OverseerCollectionProcessor.MAX_SHARDS_PER_NODE, + maxShardsPerNode.toString()); + queue.add(ZkStateReader.toJSON(props)); + } + + protected void verifySubmitCaptures(List submitCaptures, + Integer numberOfSlices, Integer numberOfReplica, Set liveNodes) { + List coreNames = new ArrayList(); + Map> sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap = new HashMap>(); + List nodeUrlWithoutProtocolPartForLiveNodes = new ArrayList( + liveNodes.size()); + for (String nodeName : liveNodes) { + String nodeUrlWithoutProtocolPart = nodeName.replaceAll("_", "/"); + if (nodeUrlWithoutProtocolPart.startsWith("http://")) nodeUrlWithoutProtocolPart = nodeUrlWithoutProtocolPart + .substring(7); + nodeUrlWithoutProtocolPartForLiveNodes.add(nodeUrlWithoutProtocolPart); + } + + for (SubmitCapture submitCapture : submitCaptures) { + ShardRequest shardRequest = submitCapture.shardRequestCapture.getValue(); + assertEquals(CoreAdminAction.CREATE.toString(), + shardRequest.params.get(CoreAdminParams.ACTION)); + // assertEquals(shardRequest.params, submitCapture.params); + String coreName = shardRequest.params.get(CoreAdminParams.NAME); + assertFalse("Core with name " + coreName + " created twice", + coreNames.contains(coreName)); + coreNames.add(coreName); + assertEquals(CONFIG_NAME, + shardRequest.params.get("collection.configName")); + assertEquals(COLLECTION_NAME, + shardRequest.params.get(CoreAdminParams.COLLECTION)); + assertEquals(numberOfSlices.toString(), + shardRequest.params.get(ZkStateReader.NUM_SHARDS_PROP)); + assertEquals(ADMIN_PATH, shardRequest.params.get("qt")); + assertEquals(1, shardRequest.purpose); + assertEquals(1, shardRequest.shards.length); + assertEquals(submitCapture.nodeUrlsWithoutProtocolPartCapture.getValue(), + shardRequest.shards[0]); + assertTrue("Shard " + coreName + " created on wrong node " + + shardRequest.shards[0], + nodeUrlWithoutProtocolPartForLiveNodes + .contains(shardRequest.shards[0])); + assertEquals(shardRequest.shards, shardRequest.actualShards); + + String sliceName = shardRequest.params.get(CoreAdminParams.SHARD); + if (!sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap + .containsKey(sliceName)) { + sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap.put( + sliceName, new HashMap()); + } + Map nodeUrlsWithoutProtocolPartToNumberOfShardsRunningMap = sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap + .get(sliceName); + Integer existingCount; + nodeUrlsWithoutProtocolPartToNumberOfShardsRunningMap + .put( + shardRequest.shards[0], + ((existingCount = nodeUrlsWithoutProtocolPartToNumberOfShardsRunningMap + .get(shardRequest.shards[0])) == null) ? 1 + : (existingCount + 1)); + } + + assertEquals(numberOfSlices * numberOfReplica, coreNames.size()); + for (int i = 1; i <= numberOfSlices; i++) { + for (int j = 1; j <= numberOfReplica; j++) { + String coreName = COLLECTION_NAME + "_shard" + i + "_replica" + j; + assertTrue("Shard " + coreName + " was not created", + coreNames.contains(coreName)); + } + } + + assertEquals(numberOfSlices.intValue(), + sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap.size()); + for (int i = 1; i <= numberOfSlices; i++) { + sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap.keySet() + .contains("shard" + i); + } + int minShardsPerSlicePerNode = numberOfReplica / liveNodes.size(); + int numberOfNodesSupposedToRunMaxShards = numberOfReplica + % liveNodes.size(); + int numberOfNodesSupposedToRunMinShards = liveNodes.size() + - numberOfNodesSupposedToRunMaxShards; + int maxShardsPerSlicePerNode = (numberOfNodesSupposedToRunMaxShards == 0) ? minShardsPerSlicePerNode + : (minShardsPerSlicePerNode + 1); + boolean diffBetweenMinAndMaxShardsPerSlicePerNode = (maxShardsPerSlicePerNode != minShardsPerSlicePerNode); + + for (Entry> sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMapEntry : sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMap + .entrySet()) { + int numberOfShardsRunning = 0; + int numberOfNodesRunningMinShards = 0; + int numberOfNodesRunningMaxShards = 0; + int numberOfNodesRunningAtLeastOneShard = 0; + for (String nodeUrlsWithoutProtocolPart : sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMapEntry + .getValue().keySet()) { + int numberOfShardsRunningOnThisNode = sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMapEntry + .getValue().get(nodeUrlsWithoutProtocolPart); + numberOfShardsRunning += numberOfShardsRunningOnThisNode; + numberOfNodesRunningAtLeastOneShard++; + assertTrue( + "Node " + + nodeUrlsWithoutProtocolPart + + " is running wrong number of shards. Supposed to run " + + minShardsPerSlicePerNode + + (diffBetweenMinAndMaxShardsPerSlicePerNode ? (" or " + maxShardsPerSlicePerNode) + : ""), + (numberOfShardsRunningOnThisNode == minShardsPerSlicePerNode) + || (numberOfShardsRunningOnThisNode == maxShardsPerSlicePerNode)); + if (numberOfShardsRunningOnThisNode == minShardsPerSlicePerNode) numberOfNodesRunningMinShards++; + if (numberOfShardsRunningOnThisNode == maxShardsPerSlicePerNode) numberOfNodesRunningMaxShards++; + } + if (minShardsPerSlicePerNode == 0) numberOfNodesRunningMinShards = (liveNodes + .size() - numberOfNodesRunningAtLeastOneShard); + assertEquals( + "Too many shards are running under slice " + + sliceToNodeUrlsWithoutProtocolPartToNumberOfShardsRunningMapMapEntry + .getKey(), + numberOfReplica.intValue(), numberOfShardsRunning); + assertEquals(numberOfNodesSupposedToRunMinShards, + numberOfNodesRunningMinShards); + assertEquals(numberOfNodesSupposedToRunMaxShards, + numberOfNodesRunningMaxShards); + } + } + + protected void waitForEmptyQueue(long maxWait) throws Exception { + long start = System.currentTimeMillis(); + while (queue.peek() != null) { + if ((System.currentTimeMillis() - start) > maxWait) fail("Queue not empty within " + + maxWait + " ms"); + Thread.sleep(100); + } + } + + protected void testTemplate(Integer numberOfNodes, Integer replicationFactor, + Integer numberOfSlices, Integer maxShardsPerNode, + boolean collectionExceptedToBeCreated) throws Exception { + Set liveNodes = commonMocks(numberOfNodes); + + List submitCaptures = null; + if (collectionExceptedToBeCreated) { + submitCaptures = mockShardHandlerForCreateJob(numberOfSlices, + replicationFactor); + } + + replay(workQueueMock); + replay(zkStateReaderMock); + replay(clusterStateMock); + replay(shardHandlerMock); + startComponentUnderTest(); + + issueCreateJob(numberOfSlices, replicationFactor, maxShardsPerNode); + + waitForEmptyQueue(10000); + + verify(shardHandlerMock); + + if (collectionExceptedToBeCreated) { + verifySubmitCaptures(submitCaptures, numberOfSlices, replicationFactor, + liveNodes); + } + } + + @Test + public void testNoReplicationEqualNumberOfSlicesPerNode() throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 1; + Integer numberOfSlices = 8; + Integer maxShardsPerNode = 2; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, true); + } + + @Test + public void testReplicationEqualNumberOfSlicesPerNode() throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 2; + Integer numberOfSlices = 4; + Integer maxShardsPerNode = 2; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, true); + } + + @Test + public void testNoReplicationUnequalNumberOfSlicesPerNode() throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 1; + Integer numberOfSlices = 6; + Integer maxShardsPerNode = 2; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, true); + } + + @Test + public void testReplicationUnequalNumberOfSlicesPerNode() throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 2; + Integer numberOfSlices = 3; + Integer maxShardsPerNode = 2; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, true); + } + + @Test + public void testNoReplicationCollectionNotCreatedDueToMaxShardsPerNodeLimit() + throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 1; + Integer numberOfSlices = 6; + Integer maxShardsPerNode = 1; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, false); + } + + @Test + public void testReplicationCollectionNotCreatedDueToMaxShardsPerNodeLimit() + throws Exception { + Integer numberOfNodes = 4; + Integer replicationFactor = 2; + Integer numberOfSlices = 3; + Integer maxShardsPerNode = 1; + testTemplate(numberOfNodes, replicationFactor, numberOfSlices, + maxShardsPerNode, false); + } + +} diff --git a/solr/licenses/cglib-nodep-2.2.jar.sha1 b/solr/licenses/cglib-nodep-2.2.jar.sha1 new file mode 100644 index 00000000000..e1f1486314e --- /dev/null +++ b/solr/licenses/cglib-nodep-2.2.jar.sha1 @@ -0,0 +1 @@ +59afed7ab65e7ec6585d5bc60556c3cbd203532b diff --git a/solr/licenses/cglib-nodep-LICENSE-ASL.txt b/solr/licenses/cglib-nodep-LICENSE-ASL.txt new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/solr/licenses/cglib-nodep-LICENSE-ASL.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/solr/licenses/cglib-nodep-NOTICE.txt b/solr/licenses/cglib-nodep-NOTICE.txt new file mode 100644 index 00000000000..3f59805ce43 --- /dev/null +++ b/solr/licenses/cglib-nodep-NOTICE.txt @@ -0,0 +1,2 @@ +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). diff --git a/solr/licenses/easymock-2.2.jar.sha1 b/solr/licenses/easymock-2.2.jar.sha1 deleted file mode 100644 index 661f60054d7..00000000000 --- a/solr/licenses/easymock-2.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -0b9536281a0d32253f97445999dcaf0572e57bbb diff --git a/solr/licenses/easymock-3.0.jar.sha1 b/solr/licenses/easymock-3.0.jar.sha1 new file mode 100644 index 00000000000..e31ee54cc26 --- /dev/null +++ b/solr/licenses/easymock-3.0.jar.sha1 @@ -0,0 +1 @@ +f28a4c31c330f95c9acbf1108cea19952b5c496f diff --git a/solr/licenses/objenesis-1.2.jar.sha1 b/solr/licenses/objenesis-1.2.jar.sha1 new file mode 100644 index 00000000000..1252cc62939 --- /dev/null +++ b/solr/licenses/objenesis-1.2.jar.sha1 @@ -0,0 +1 @@ +bfcb0539a071a4c5a30690388903ac48c0667f2a diff --git a/solr/licenses/objenesis-LICENSE-ASL.txt b/solr/licenses/objenesis-LICENSE-ASL.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/solr/licenses/objenesis-LICENSE-ASL.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/solr/licenses/objenesis-NOTICE.txt b/solr/licenses/objenesis-NOTICE.txt new file mode 100644 index 00000000000..bee3251ae66 --- /dev/null +++ b/solr/licenses/objenesis-NOTICE.txt @@ -0,0 +1,8 @@ +// ------------------------------------------------------------------ +// NOTICE file corresponding to the section 4d of The Apache License, +// Version 2.0, in this case for Objenesis +// ------------------------------------------------------------------ + +Objenesis +Copyright 2006-2009 Joe Walnes, Henri Tremblay, Leonardo Mesquita +