Search in sources :

Example 86 with JettySolrRunner

use of org.apache.solr.client.solrj.embedded.JettySolrRunner in project lucene-solr by apache.

the class ChaosMonkey method causeSomeChaos.

/**
   * causes some randomly selected chaos
   */
public void causeSomeChaos() throws Exception {
    if (chaosRandom.nextBoolean()) {
        if (!deadPool.isEmpty()) {
            int index = chaosRandom.nextInt(deadPool.size());
            JettySolrRunner jetty = deadPool.get(index).jetty;
            if (jetty.isStopped() && !ChaosMonkey.start(jetty)) {
                return;
            }
            deadPool.remove(index);
            starts.incrementAndGet();
            return;
        }
    }
    int rnd = chaosRandom.nextInt(10);
    if (expireSessions && rnd < EXPIRE_PERCENT) {
        expireRandomSession();
    }
    if (causeConnectionLoss && rnd < CONLOSS_PERCENT) {
        randomConnectionLoss();
    }
    CloudJettyRunner cjetty;
    if (chaosRandom.nextBoolean()) {
        cjetty = stopRandomShard();
    } else {
        cjetty = killRandomShard();
    }
    if (cjetty == null) {
    // we cannot kill
    } else {
        deadPool.add(cjetty);
    }
}
Also used : JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner) CloudJettyRunner(org.apache.solr.cloud.AbstractFullDistribZkTestBase.CloudJettyRunner)

Example 87 with JettySolrRunner

use of org.apache.solr.client.solrj.embedded.JettySolrRunner in project lucene-solr by apache.

the class MiniSolrCloudCluster method injectChaos.

public void injectChaos(Random random) throws Exception {
    // sometimes we restart one of the jetty nodes
    if (random.nextBoolean()) {
        JettySolrRunner jetty = jettys.get(random.nextInt(jettys.size()));
        ChaosMonkey.stop(jetty);
        log.info("============ Restarting jetty");
        ChaosMonkey.start(jetty);
    }
    // sometimes we restart zookeeper
    if (random.nextBoolean()) {
        zkServer.shutdown();
        log.info("============ Restarting zookeeper");
        zkServer = new ZkTestServer(zkServer.getZkDir(), zkServer.getPort());
        zkServer.run();
    }
    // sometimes we cause a connection loss - sometimes it will hit the overseer
    if (random.nextBoolean()) {
        JettySolrRunner jetty = jettys.get(random.nextInt(jettys.size()));
        ChaosMonkey.causeConnectionLoss(jetty);
    }
}
Also used : JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner)

Example 88 with JettySolrRunner

use of org.apache.solr.client.solrj.embedded.JettySolrRunner in project lucene-solr by apache.

the class AbstractFullDistribZkTestBase method createJetty.

public JettySolrRunner createJetty(String dataDir, String ulogDir, String shardList, String solrConfigOverride) throws Exception {
    JettyConfig jettyconfig = JettyConfig.builder().setContext(context).stopAtShutdown(false).withServlets(getExtraServlets()).withFilters(getExtraRequestFilters()).withSSLConfig(sslConfig).build();
    Properties props = new Properties();
    props.setProperty("solr.data.dir", getDataDir(dataDir));
    props.setProperty("shards", shardList);
    props.setProperty("solr.ulog.dir", ulogDir);
    props.setProperty("solrconfig", solrConfigOverride);
    JettySolrRunner jetty = new JettySolrRunner(getSolrHome(), props, jettyconfig);
    jetty.start();
    return jetty;
}
Also used : JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner) Properties(java.util.Properties)

Example 89 with JettySolrRunner

use of org.apache.solr.client.solrj.embedded.JettySolrRunner in project lucene-solr by apache.

the class TrackingShardHandlerFactory method setTrackingQueue.

/**
   * Sets the tracking queue for all nodes participating in this cluster. Once this method returns,
   * all search and core admin requests distributed to shards will be submitted to the given queue.
   *
   * @param runners a list of {@link org.apache.solr.client.solrj.embedded.JettySolrRunner} nodes
   * @param queue   an implementation of {@link java.util.Queue} which
   *                accepts {@link org.apache.solr.handler.component.TrackingShardHandlerFactory.ShardRequestAndParams}
   *                instances
   */
public static void setTrackingQueue(List<JettySolrRunner> runners, Queue<ShardRequestAndParams> queue) {
    for (JettySolrRunner runner : runners) {
        CoreContainer container = runner.getCoreContainer();
        ShardHandlerFactory factory = container.getShardHandlerFactory();
        assert factory instanceof TrackingShardHandlerFactory : "not a TrackingShardHandlerFactory: " + factory.getClass();
        TrackingShardHandlerFactory trackingShardHandlerFactory = (TrackingShardHandlerFactory) factory;
        trackingShardHandlerFactory.setTrackingQueue(queue);
    }
}
Also used : CoreContainer(org.apache.solr.core.CoreContainer) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner)

Example 90 with JettySolrRunner

use of org.apache.solr.client.solrj.embedded.JettySolrRunner in project lucene-solr by apache.

the class TestReqParamsAPI method setupHarnesses.

private void setupHarnesses() {
    for (final JettySolrRunner jettySolrRunner : cluster.getJettySolrRunners()) {
        RestTestHarness harness = new RestTestHarness(() -> jettySolrRunner.getBaseUrl().toString() + "/" + COLL_NAME);
        if (true) {
            harness.setServerProvider(() -> jettySolrRunner.getBaseUrl().toString() + "/____v2/c/" + COLL_NAME);
        }
        restTestHarnesses.add(harness);
    }
}
Also used : RestTestHarness(org.apache.solr.util.RestTestHarness) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner)

Aggregations

JettySolrRunner (org.apache.solr.client.solrj.embedded.JettySolrRunner)137 Test (org.junit.Test)52 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)29 Replica (org.apache.solr.common.cloud.Replica)28 CloudSolrClient (org.apache.solr.client.solrj.impl.CloudSolrClient)25 SolrInputDocument (org.apache.solr.common.SolrInputDocument)20 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)20 File (java.io.File)19 SolrQuery (org.apache.solr.client.solrj.SolrQuery)19 DocCollection (org.apache.solr.common.cloud.DocCollection)18 Slice (org.apache.solr.common.cloud.Slice)18 IOException (java.io.IOException)15 ArrayList (java.util.ArrayList)15 Properties (java.util.Properties)15 SolrClient (org.apache.solr.client.solrj.SolrClient)15 UpdateRequest (org.apache.solr.client.solrj.request.UpdateRequest)15 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)15 CoreContainer (org.apache.solr.core.CoreContainer)14 BeforeClass (org.junit.BeforeClass)14 ClusterState (org.apache.solr.common.cloud.ClusterState)13