Class AbstractFullDistribZkTestBase

    • Constructor Detail

      • AbstractFullDistribZkTestBase

        public AbstractFullDistribZkTestBase()
    • Method Detail

      • beforeFullSolrCloudTest

        public static void beforeFullSolrCloudTest()
      • beforeTest

        public void beforeTest()
      • setErrorHook

        protected static void setErrorHook()
      • clearErrorHook

        protected static void clearErrorHook()
      • beforeClass

        public static void beforeClass()
      • useTlogReplicas

        protected boolean useTlogReplicas()
      • createCloudClient

        protected org.apache.solr.client.solrj.impl.CloudSolrClient createCloudClient​(String defaultCollection)
      • waitForCollection

        public static void waitForCollection​(org.apache.solr.common.cloud.ZkStateReader reader,
                                             String collection,
                                             int slices)
                                      throws Exception
        Throws:
        Exception
      • waitForActiveReplicaCount

        protected void waitForActiveReplicaCount​(org.apache.solr.client.solrj.impl.CloudSolrClient client,
                                                 String collection,
                                                 int expectedNumReplicas)
                                          throws TimeoutException,
                                                 org.apache.solr.cloud.ZkController.NotInClusterStateException
        Throws:
        TimeoutException
        org.apache.solr.cloud.ZkController.NotInClusterStateException
      • getPullReplicaCount

        protected int getPullReplicaCount()
      • getTotalReplicas

        @Deprecated
        protected int getTotalReplicas​(org.apache.solr.common.cloud.DocCollection c,
                                       String collection)
        Deprecated.
        This method is virtually useless as it does not consider the status of either the shard or replica, nor wether the node hosting each replica is alive.
        Total number of replicas for all shards as indicated by the cluster state, regardless of status.
      • createProxiedJetty

        public JettySolrRunner createProxiedJetty​(File solrHome,
                                                  String dataDir,
                                                  String shardList,
                                                  String solrConfigOverride,
                                                  String schemaOverride,
                                                  org.apache.solr.common.cloud.Replica.Type replicaType)
                                           throws Exception
        Creates a JettySolrRunner with a socket proxy sitting in front of the Jetty server, which gives us the ability to simulate network partitions without having to fuss with IPTables.
        Throws:
        Exception
      • getReplicaPort

        protected int getReplicaPort​(org.apache.solr.common.cloud.Replica replica)
      • getProxyForReplica

        protected org.apache.solr.client.solrj.cloud.SocketProxy getProxyForReplica​(org.apache.solr.common.cloud.Replica replica)
                                                                             throws Exception
        Throws:
        Exception
      • updateMappingsFromZk

        protected void updateMappingsFromZk​(List<JettySolrRunner> jettys,
                                            List<org.apache.solr.client.solrj.SolrClient> clients,
                                            boolean allowOverSharding)
                                     throws Exception
        Throws:
        Exception
      • sendDocsWithRetry

        protected int sendDocsWithRetry​(String collectionName,
                                        List<org.apache.solr.common.SolrInputDocument> batch,
                                        int minRf,
                                        int maxRetries,
                                        int waitBeforeRetry)
                                 throws Exception
        Throws:
        Exception
      • sendDocsWithRetry

        protected static int sendDocsWithRetry​(org.apache.solr.client.solrj.impl.CloudSolrClient cloudClient,
                                               String collection,
                                               List<org.apache.solr.common.SolrInputDocument> batch,
                                               int minRf,
                                               int maxRetries,
                                               int waitBeforeRetry)
                                        throws Exception
        Throws:
        Exception
      • index_specific

        protected void index_specific​(org.apache.solr.client.solrj.SolrClient client,
                                      Object... fields)
                               throws Exception
        Throws:
        Exception
      • getLeaderUrlFromZk

        protected org.apache.solr.common.cloud.ZkCoreNodeProps getLeaderUrlFromZk​(String collection,
                                                                                  String slice)
                                                                           throws IOException
        Throws:
        IOException
      • waitForRecoveriesToFinish

        protected void waitForRecoveriesToFinish​(boolean verbose)
                                          throws Exception
        Throws:
        Exception
      • waitForRecoveriesToFinish

        protected void waitForRecoveriesToFinish​(String collection,
                                                 boolean verbose)
                                          throws Exception
        Throws:
        Exception
      • waitForRecoveriesToFinish

        protected void waitForRecoveriesToFinish​(boolean verbose,
                                                 long timeoutSeconds)
                                          throws Exception
        Throws:
        Exception
      • indexAbunchOfDocs

        protected void indexAbunchOfDocs()
                                  throws Exception
        Throws:
        Exception
      • queryAndCompareShards

        public void queryAndCompareShards​(org.apache.solr.common.params.SolrParams params)
                                   throws Exception
        For each Shard, executes a query against each live and active replica of that shard and asserts that the results are identical for each replica of the same shard. Because results are not compared between replicas of different shards, this method should be safe for comparing the results of any query, even if it contains "distrib=false", because the replicas should all be identical.
        Throws:
        Exception
        See Also:
        queryAndCompareReplicas(SolrParams, String)
      • checkShardConsistency

        protected void checkShardConsistency​(String shard)
                                      throws Exception
        Returns a non-null string if replicas within the same shard do not have a consistent number of documents.
        Throws:
        Exception
      • checkShardConsistency

        protected String checkShardConsistency​(String shard,
                                               boolean expectFailure,
                                               boolean verbose)
                                        throws Exception
        Returns a non-null string if replicas within the same shard do not have a consistent number of documents. If expectFailure==false, the exact differences found will be logged since this would be an unexpected failure. verbose causes extra debugging into to be displayed, even if everything is consistent.
        Throws:
        Exception
      • showCounts

        public void showCounts()
      • randomlyEnableAutoSoftCommit

        protected void randomlyEnableAutoSoftCommit()
      • enableAutoSoftCommit

        protected void enableAutoSoftCommit​(int time)
      • checkShardConsistency

        protected void checkShardConsistency()
                                      throws Exception
        Throws:
        Exception
      • checkShardConsistency

        protected void checkShardConsistency​(boolean checkVsControl,
                                             boolean verbose)
                                      throws Exception
        Throws:
        Exception
      • checkShardConsistency

        protected void checkShardConsistency​(boolean checkVsControl,
                                             boolean verbose,
                                             Set<String> addFails,
                                             Set<String> deleteFails)
                                      throws Exception
        Throws:
        Exception
      • getClient

        protected org.apache.solr.client.solrj.SolrClient getClient​(String nodeName)
      • assertDocCounts

        protected void assertDocCounts​(boolean verbose)
                                throws Exception
        Throws:
        Exception
      • queryServer

        protected org.apache.solr.client.solrj.response.QueryResponse queryServer​(org.apache.solr.common.params.ModifiableSolrParams params)
                                                                           throws org.apache.solr.client.solrj.SolrServerException,
                                                                                  IOException
        Overrides:
        queryServer in class BaseDistributedSearchTestCase
        Throws:
        org.apache.solr.client.solrj.SolrServerException
        IOException
      • waitForThingsToLevelOut

        public void waitForThingsToLevelOut()
                                     throws Exception
        Throws:
        Exception
      • waitForThingsToLevelOut

        public void waitForThingsToLevelOut​(int timeout,
                                            TimeUnit unit)
                                     throws Exception
        Throws:
        Exception
      • waitForNoShardInconsistency

        public void waitForNoShardInconsistency()
                                         throws Exception
        Throws:
        Exception
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           String defaultCollection,
                                                                                           boolean shardLeadersOnly,
                                                                                           int connectionTimeoutMillis,
                                                                                           int socketTimeoutMillis)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • createNewSolrClient

        protected org.apache.solr.client.solrj.SolrClient createNewSolrClient​(String coreName,
                                                                              int port)
      • createNewSolrClient

        protected org.apache.solr.client.solrj.SolrClient createNewSolrClient​(String collection,
                                                                              String baseUrl)
      • getDoc

        public static org.apache.solr.common.SolrInputDocument getDoc​(Object... fields)
                                                               throws Exception
        Throws:
        Exception
      • getCommonCloudSolrClient

        protected org.apache.solr.client.solrj.impl.CloudSolrClient getCommonCloudSolrClient()
      • getSolrClient

        protected org.apache.solr.client.solrj.impl.CloudSolrClient getSolrClient​(String collectionName)
      • getUrlFromZk

        public static String getUrlFromZk​(org.apache.solr.common.cloud.ClusterState clusterState,
                                          String collection)
      • waitForNon403or404or503

        public static void waitForNon403or404or503​(org.apache.solr.client.solrj.SolrClient collectionClient,
                                                   String baseUrl)
                                            throws Exception
        Throws:
        Exception
      • createCollection

        protected void createCollection​(String collName,
                                        org.apache.solr.client.solrj.impl.CloudSolrClient client,
                                        int replicationFactor,
                                        int numShards)
                                 throws Exception
        Throws:
        Exception
      • getShardLeader

        protected org.apache.solr.common.cloud.Replica getShardLeader​(String testCollectionName,
                                                                      String shardId,
                                                                      int timeoutSecs)
                                                               throws Exception
        Throws:
        Exception
      • ensureAllReplicasAreActive

        protected List<org.apache.solr.common.cloud.Replica> ensureAllReplicasAreActive​(String testCollectionName,
                                                                                        String shardId,
                                                                                        int shards,
                                                                                        int rf,
                                                                                        int maxWaitSecs)
                                                                                 throws Exception
        Throws:
        Exception
      • reloadCollection

        protected boolean reloadCollection​(org.apache.solr.common.cloud.Replica replica,
                                           String testCollectionName)
                                    throws Exception
        Throws:
        Exception
      • waitForReplicationFromReplicas

        protected void waitForReplicationFromReplicas​(String collectionName,
                                                      org.apache.solr.common.cloud.ZkStateReader zkStateReader,
                                                      org.apache.solr.util.TimeOut timeout)
                                               throws org.apache.zookeeper.KeeperException,
                                                      InterruptedException,
                                                      IOException
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
        IOException
      • getIndexVersion

        protected long getIndexVersion​(org.apache.solr.common.cloud.Replica replica)
                                throws IOException
        Throws:
        IOException
      • attemptCollectionDelete

        protected static boolean attemptCollectionDelete​(org.apache.solr.client.solrj.impl.CloudSolrClient client,
                                                         String collectionName)
        Logs a WARN if collection can't be deleted, but does not fail or throw an exception
        Returns:
        true if success, else false
      • logReplicationDetails

        protected void logReplicationDetails​(org.apache.solr.common.cloud.Replica replica,
                                             StringBuilder builder)
                                      throws IOException
        Throws:
        IOException
      • getRequestStateAfterCompletion

        public static org.apache.solr.client.solrj.response.RequestStatusState getRequestStateAfterCompletion​(String requestId,
                                                                                                              int waitForSeconds,
                                                                                                              org.apache.solr.client.solrj.SolrClient client)
                                                                                                       throws IOException,
                                                                                                              org.apache.solr.client.solrj.SolrServerException
        Throws:
        IOException
        org.apache.solr.client.solrj.SolrServerException
      • setupRestTestHarnesses

        protected void setupRestTestHarnesses()
      • randomRestTestHarness

        protected RestTestHarness randomRestTestHarness()