Search in sources :

Example 1 with UpdateShardHandlerConfig

use of org.apache.solr.update.UpdateShardHandlerConfig in project lucene-solr by apache.

the class TestHarness method buildTestNodeConfig.

public static NodeConfig buildTestNodeConfig(SolrResourceLoader loader) {
    CloudConfig cloudConfig = new CloudConfig.CloudConfigBuilder(System.getProperty("host"), Integer.getInteger("hostPort", 8983), System.getProperty("hostContext", "")).setZkClientTimeout(Integer.getInteger("zkClientTimeout", 30000)).build();
    if (System.getProperty("zkHost") == null)
        cloudConfig = null;
    UpdateShardHandlerConfig updateShardHandlerConfig = new UpdateShardHandlerConfig(UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONS, UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONSPERHOST, 30000, 30000, UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY, UpdateShardHandlerConfig.DEFAULT_MAXRECOVERYTHREADS);
    // universal default metric reporter
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("name", "default");
    attributes.put("class", SolrJmxReporter.class.getName());
    PluginInfo defaultPlugin = new PluginInfo("reporter", attributes);
    MetricsConfig metricsConfig = new MetricsConfig.MetricsConfigBuilder().setMetricReporterPlugins(new PluginInfo[] { defaultPlugin }).build();
    return new NodeConfig.NodeConfigBuilder("testNode", loader).setUseSchemaCache(Boolean.getBoolean("shareSchema")).setCloudConfig(cloudConfig).setUpdateShardHandlerConfig(updateShardHandlerConfig).setMetricsConfig(metricsConfig).build();
}
Also used : HashMap(java.util.HashMap) CloudConfig(org.apache.solr.core.CloudConfig) MetricsConfig(org.apache.solr.core.MetricsConfig) UpdateShardHandlerConfig(org.apache.solr.update.UpdateShardHandlerConfig) PluginInfo(org.apache.solr.core.PluginInfo) SolrJmxReporter(org.apache.solr.metrics.reporters.SolrJmxReporter) NodeConfig(org.apache.solr.core.NodeConfig)

Example 2 with UpdateShardHandlerConfig

use of org.apache.solr.update.UpdateShardHandlerConfig in project lucene-solr by apache.

the class TestSolrXml method testAllInfoPresent.

public void testAllInfoPresent() throws IOException {
    File testSrcRoot = new File(SolrTestCaseJ4.TEST_HOME());
    FileUtils.copyFile(new File(testSrcRoot, "solr-50-all.xml"), new File(solrHome, "solr.xml"));
    NodeConfig cfg = SolrXmlConfig.fromSolrHome(loader, solrHome.toPath());
    CloudConfig ccfg = cfg.getCloudConfig();
    UpdateShardHandlerConfig ucfg = cfg.getUpdateShardHandlerConfig();
    PluginInfo[] backupRepoConfigs = cfg.getBackupRepositoryPlugins();
    assertEquals("core admin handler class", "testAdminHandler", cfg.getCoreAdminHandlerClass());
    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(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());
    assertEquals("max update conn", 3, cfg.getUpdateShardHandlerConfig().getMaxUpdateConnections());
    assertEquals("max update conn/host", 37, cfg.getUpdateShardHandlerConfig().getMaxUpdateConnectionsPerHost());
    assertEquals("distrib conn timeout", 22, ucfg.getDistributedConnectionTimeout());
    assertEquals("distrib socket timeout", 33, ucfg.getDistributedSocketTimeout());
    assertEquals("max update conn", 3, ucfg.getMaxUpdateConnections());
    assertEquals("max update conn/host", 37, ucfg.getMaxUpdateConnectionsPerHost());
    assertEquals("host", "testHost", ccfg.getHost());
    assertEquals("zk host context", "testHostContext", ccfg.getSolrHostContext());
    assertEquals("solr host port", 44, ccfg.getSolrHostPort());
    assertEquals("leader vote wait", 55, ccfg.getLeaderVoteWait());
    assertEquals("logging class", "testLoggingClass", cfg.getLogWatcherConfig().getLoggingClass());
    assertEquals("log watcher", true, cfg.getLogWatcherConfig().isEnabled());
    assertEquals("log watcher size", 88, cfg.getLogWatcherConfig().getWatcherSize());
    assertEquals("log watcher thresh", "99", cfg.getLogWatcherConfig().getWatcherThreshold());
    assertEquals("manage path", "testManagementPath", cfg.getManagementPath());
    assertEquals("shardLib", "testSharedLib", cfg.getSharedLibDirectory());
    assertEquals("schema cache", true, cfg.hasSchemaCache());
    assertEquals("trans cache size", 66, cfg.getTransientCacheSize());
    assertEquals("zk client timeout", 77, ccfg.getZkClientTimeout());
    assertEquals("zk host", "testZkHost", ccfg.getZkHost());
    assertEquals("zk ACL provider", "DefaultZkACLProvider", ccfg.getZkACLProviderClass());
    assertEquals("zk credentials provider", "DefaultZkCredentialsProvider", ccfg.getZkCredentialsProviderClass());
    assertEquals(1, backupRepoConfigs.length);
    assertEquals("local", backupRepoConfigs[0].name);
    assertEquals("a.b.C", backupRepoConfigs[0].className);
    assertEquals("true", backupRepoConfigs[0].attributes.get("default"));
    assertEquals(0, backupRepoConfigs[0].initArgs.size());
}
Also used : UpdateShardHandlerConfig(org.apache.solr.update.UpdateShardHandlerConfig) File(java.io.File)

Example 3 with UpdateShardHandlerConfig

use of org.apache.solr.update.UpdateShardHandlerConfig in project lucene-solr by apache.

the class SolrXmlConfig method fromConfig.

public static NodeConfig fromConfig(Config config) {
    checkForIllegalConfig(config);
    config.substituteProperties();
    CloudConfig cloudConfig = null;
    UpdateShardHandlerConfig deprecatedUpdateConfig = null;
    if (config.getNodeList("solr/solrcloud", false).getLength() > 0) {
        NamedList<Object> cloudSection = readNodeListAsNamedList(config, "solr/solrcloud/*[@name]", "<solrcloud>");
        deprecatedUpdateConfig = loadUpdateConfig(cloudSection, false);
        cloudConfig = fillSolrCloudSection(cloudSection);
    }
    NamedList<Object> entries = readNodeListAsNamedList(config, "solr/*[@name]", "<solr>");
    String nodeName = (String) entries.remove("nodeName");
    if (Strings.isNullOrEmpty(nodeName) && cloudConfig != null)
        nodeName = cloudConfig.getHost();
    UpdateShardHandlerConfig updateConfig;
    if (deprecatedUpdateConfig == null) {
        updateConfig = loadUpdateConfig(readNodeListAsNamedList(config, "solr/updateshardhandler/*[@name]", "<updateshardhandler>"), true);
    } else {
        updateConfig = loadUpdateConfig(readNodeListAsNamedList(config, "solr/updateshardhandler/*[@name]", "<updateshardhandler>"), false);
        if (updateConfig != null) {
            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "UpdateShardHandler configuration defined twice in solr.xml");
        }
        updateConfig = deprecatedUpdateConfig;
    }
    NodeConfig.NodeConfigBuilder configBuilder = new NodeConfig.NodeConfigBuilder(nodeName, config.getResourceLoader());
    configBuilder.setUpdateShardHandlerConfig(updateConfig);
    configBuilder.setShardHandlerFactoryConfig(getShardHandlerFactoryPluginInfo(config));
    configBuilder.setSolrCoreCacheFactoryConfig(getTransientCoreCacheFactoryPluginInfo(config));
    configBuilder.setLogWatcherConfig(loadLogWatcherConfig(config, "solr/logging/*[@name]", "solr/logging/watcher/*[@name]"));
    configBuilder.setSolrProperties(loadProperties(config));
    if (cloudConfig != null)
        configBuilder.setCloudConfig(cloudConfig);
    configBuilder.setBackupRepositoryPlugins(getBackupRepositoryPluginInfos(config));
    configBuilder.setMetricsConfig(getMetricsConfig(config));
    return fillSolrSection(configBuilder, entries);
}
Also used : UpdateShardHandlerConfig(org.apache.solr.update.UpdateShardHandlerConfig) SolrException(org.apache.solr.common.SolrException)

Aggregations

UpdateShardHandlerConfig (org.apache.solr.update.UpdateShardHandlerConfig)3 File (java.io.File)1 HashMap (java.util.HashMap)1 SolrException (org.apache.solr.common.SolrException)1 CloudConfig (org.apache.solr.core.CloudConfig)1 MetricsConfig (org.apache.solr.core.MetricsConfig)1 NodeConfig (org.apache.solr.core.NodeConfig)1 PluginInfo (org.apache.solr.core.PluginInfo)1 SolrJmxReporter (org.apache.solr.metrics.reporters.SolrJmxReporter)1