org.apache.solr.cloud
Class ChaosMonkey

java.lang.Object
  extended by org.apache.solr.cloud.ChaosMonkey

public class ChaosMonkey
extends Object

The monkey can stop random or specific jetties used with SolrCloud. It can also run in a background thread and start and stop jetties randomly. TODO: expire multiple sessions / connectionloss at once TODO: kill multiple jetties at once TODO: ? add random headhunter mode that always kills the leader TODO: chaosmonkey should be able to do cluster stop/start tests


Constructor Summary
ChaosMonkey(ZkTestServer zkServer, org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty, Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty)
           
 
Method Summary
 void expireRandomSession()
           
 void expireSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
           
 org.apache.solr.client.solrj.SolrServer getRandomClient(String slice)
           
 AbstractFullDistribZkTestBase.CloudJettyRunner getRandomJetty(String slice, boolean aggressivelyKillLeaders)
           
 org.apache.solr.client.solrj.embedded.JettySolrRunner getShard(String slice, int index)
           
 int getStarts()
           
static void kill(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
           
 void killJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
           
 AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard()
           
 AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard(String slice)
           
static void monkeyLog(String msg)
           
 void randomConnectionLoss()
           
static boolean start(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
           
 void startTheMonkey(boolean killLeaders, int roundPauseUpperLimit)
           
static void stop(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
           
 void stopJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
           
 void stopJetty(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
           
 AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard()
           
 AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard(String slice)
           
 void stopShard(String slice)
           
 AbstractFullDistribZkTestBase.CloudJettyRunner stopShard(String slice, int index)
           
 void stopShardExcept(String slice, String shardName)
           
 void stopTheMonkey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChaosMonkey

public ChaosMonkey(ZkTestServer zkServer,
                   org.apache.solr.common.cloud.ZkStateReader zkStateReader,
                   String collection,
                   Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty,
                   Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty)
Method Detail

expireSession

public void expireSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)

expireRandomSession

public void expireRandomSession()
                         throws org.apache.zookeeper.KeeperException,
                                InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

randomConnectionLoss

public void randomConnectionLoss()
                          throws org.apache.zookeeper.KeeperException,
                                 InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

stopShard

public AbstractFullDistribZkTestBase.CloudJettyRunner stopShard(String slice,
                                                                int index)
                                                         throws Exception
Throws:
Exception

stopJetty

public void stopJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
               throws Exception
Throws:
Exception

killJetty

public void killJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
               throws Exception
Throws:
Exception

stopJetty

public void stopJetty(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
               throws Exception
Throws:
Exception

kill

public static void kill(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
                 throws Exception
Throws:
Exception

stopShard

public void stopShard(String slice)
               throws Exception
Throws:
Exception

stopShardExcept

public void stopShardExcept(String slice,
                            String shardName)
                     throws Exception
Throws:
Exception

getShard

public org.apache.solr.client.solrj.embedded.JettySolrRunner getShard(String slice,
                                                                      int index)
                                                               throws Exception
Throws:
Exception

stopRandomShard

public AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard()
                                                               throws Exception
Throws:
Exception

stopRandomShard

public AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard(String slice)
                                                               throws Exception
Throws:
Exception

killRandomShard

public AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard()
                                                               throws Exception
Throws:
Exception

killRandomShard

public AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard(String slice)
                                                               throws Exception
Throws:
Exception

getRandomJetty

public AbstractFullDistribZkTestBase.CloudJettyRunner getRandomJetty(String slice,
                                                                     boolean aggressivelyKillLeaders)
                                                              throws org.apache.zookeeper.KeeperException,
                                                                     InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

getRandomClient

public org.apache.solr.client.solrj.SolrServer getRandomClient(String slice)
                                                        throws org.apache.zookeeper.KeeperException,
                                                               InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

startTheMonkey

public void startTheMonkey(boolean killLeaders,
                           int roundPauseUpperLimit)

monkeyLog

public static void monkeyLog(String msg)

stopTheMonkey

public void stopTheMonkey()

getStarts

public int getStarts()

stop

public static void stop(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                 throws Exception
Throws:
Exception

start

public static boolean start(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                     throws Exception
Throws:
Exception


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.