mirror of https://github.com/apache/lucene.git
SOLR-7280: refactored to incorporate Mike's suggestions. Default thread count for cloud is limited to 8 now. In our internal teting 8 has given us the best stability during restarts
This commit is contained in:
parent
6e99ed3013
commit
fcd2cc57d5
|
@ -87,7 +87,7 @@ public class NodeConfig {
|
|||
this.solrProperties = solrProperties;
|
||||
this.backupRepositoryPlugins = backupRepositoryPlugins;
|
||||
|
||||
if (this.cloudConfig != null && this.getCoreLoadThreadCount(NodeConfigBuilder.DEFAULT_CORE_LOAD_THREADS) < 2) {
|
||||
if (this.cloudConfig != null && this.getCoreLoadThreadCount(false) < 2) {
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"SolrCloud requires a value of at least 2 for coreLoadThreads (configured value = " + this.coreLoadThreads + ")");
|
||||
}
|
||||
|
@ -109,8 +109,10 @@ public class NodeConfig {
|
|||
return updateShardHandlerConfig;
|
||||
}
|
||||
|
||||
public int getCoreLoadThreadCount(int def) {
|
||||
return coreLoadThreads == null ? def : coreLoadThreads;
|
||||
public int getCoreLoadThreadCount(boolean zkAware) {
|
||||
return coreLoadThreads == null ?
|
||||
(zkAware ? NodeConfigBuilder.DEFAULT_CORE_LOAD_THREADS_IN_CLOUD : NodeConfigBuilder.DEFAULT_CORE_LOAD_THREADS)
|
||||
: coreLoadThreads;
|
||||
}
|
||||
|
||||
public String getSharedLibDirectory() {
|
||||
|
@ -196,8 +198,8 @@ public class NodeConfig {
|
|||
private final String nodeName;
|
||||
|
||||
public static final int DEFAULT_CORE_LOAD_THREADS = 3;
|
||||
//No:of core load threads in cloud mode is set to a default of 24
|
||||
public static final int DEFAULT_CORE_LOAD_THREADS_IN_CLOUD = 24;
|
||||
//No:of core load threads in cloud mode is set to a default of 8
|
||||
public static final int DEFAULT_CORE_LOAD_THREADS_IN_CLOUD = 8;
|
||||
|
||||
private static final int DEFAULT_TRANSIENT_CACHE_SIZE = Integer.MAX_VALUE;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.solr.util.MockCoreContainer;
|
|||
import static java.util.stream.Collectors.toList;
|
||||
import static org.apache.solr.core.CoreSorter.getShardName;
|
||||
import static org.easymock.EasyMock.createMock;
|
||||
import static org.easymock.EasyMock.expectLastCall;
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.easymock.EasyMock.reset;
|
||||
|
||||
|
@ -49,16 +49,16 @@ public class CoreSorterTest extends SolrTestCaseJ4 {
|
|||
|
||||
public void testComparator() {
|
||||
List<CountsForEachShard> l = new ArrayList<>();
|
||||
// DN LIV MY
|
||||
l.add(new CountsForEachShard(1, 3, 1));
|
||||
l.add(new CountsForEachShard(0, 3, 2));
|
||||
l.add(new CountsForEachShard(0, 3, 3));
|
||||
l.add(new CountsForEachShard(0, 3, 4));
|
||||
l.add(new CountsForEachShard(1, 0, 2));
|
||||
l.add(new CountsForEachShard(1, 0, 1));
|
||||
l.add(new CountsForEachShard(2, 5, 1));
|
||||
l.add(new CountsForEachShard(2, 4, 2));
|
||||
l.add(new CountsForEachShard(2, 3, 3));
|
||||
// DOWN LIVE MY
|
||||
l.add(new CountsForEachShard(1, 3, 1));
|
||||
l.add(new CountsForEachShard(0, 3, 2));
|
||||
l.add(new CountsForEachShard(0, 3, 3));
|
||||
l.add(new CountsForEachShard(0, 3, 4));
|
||||
l.add(new CountsForEachShard(1, 0, 2));
|
||||
l.add(new CountsForEachShard(1, 0, 1));
|
||||
l.add(new CountsForEachShard(2, 5, 1));
|
||||
l.add(new CountsForEachShard(2, 4, 2));
|
||||
l.add(new CountsForEachShard(2, 3, 3));
|
||||
|
||||
List<CountsForEachShard> expected = Arrays.asList(
|
||||
new CountsForEachShard(0, 3, 2),
|
||||
|
@ -108,14 +108,10 @@ public class CoreSorterTest extends SolrTestCaseJ4 {
|
|||
ZkController mockZKC = createMock(ZkController.class);
|
||||
ClusterState mockClusterState = createMock(ClusterState.class);
|
||||
reset(mockCC, mockZKC, mockClusterState);
|
||||
mockCC.isZooKeeperAware();
|
||||
expectLastCall().andAnswer(() -> Boolean.TRUE).anyTimes();
|
||||
mockCC.getZkController();
|
||||
expectLastCall().andAnswer(() -> mockZKC).anyTimes();
|
||||
mockClusterState.getLiveNodes();
|
||||
expectLastCall().andAnswer(() -> liveNodes).anyTimes();
|
||||
mockZKC.getClusterState();
|
||||
expectLastCall().andAnswer(() -> mockClusterState).anyTimes();
|
||||
expect(mockCC.isZooKeeperAware()).andReturn(Boolean.TRUE).anyTimes();
|
||||
expect(mockCC.getZkController()).andReturn(mockZKC).anyTimes();
|
||||
expect(mockClusterState.getLiveNodes()).andReturn(liveNodes).anyTimes();
|
||||
expect(mockZKC.getClusterState()).andReturn(mockClusterState).anyTimes();
|
||||
replay(mockCC, mockZKC, mockClusterState);
|
||||
return mockCC;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TestSolrXml extends SolrTestCaseJ4 {
|
|||
assertEquals("collection handler class", "testCollectionsHandler", cfg.getCollectionsHandlerClass());
|
||||
assertEquals("info handler class", "testInfoHandler", cfg.getInfoHandlerClass());
|
||||
assertEquals("config set handler class", "testConfigSetsHandler", cfg.getConfigSetsHandlerClass());
|
||||
assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount(0));
|
||||
assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount(false));
|
||||
assertThat("core root dir", cfg.getCoreRootDirectory().toString(), containsString("testCoreRootDirectory"));
|
||||
assertEquals("distrib conn timeout", 22, cfg.getUpdateShardHandlerConfig().getDistributedConnectionTimeout());
|
||||
assertEquals("distrib socket timeout", 33, cfg.getUpdateShardHandlerConfig().getDistributedSocketTimeout());
|
||||
|
|
Loading…
Reference in New Issue