Package org.apache.solr.cloud
Class AbstractFullDistribZkTestBase
- java.lang.Object
-
- org.junit.Assert
-
- org.apache.lucene.tests.util.LuceneTestCase
-
- org.apache.solr.SolrTestCase
-
- org.apache.solr.SolrTestCaseJ4
-
- org.apache.solr.BaseDistributedSearchTestCase
-
- org.apache.solr.cloud.AbstractDistribZkTestBase
-
- org.apache.solr.cloud.AbstractFullDistribZkTestBase
-
- Direct Known Subclasses:
AbstractBasicDistributedZk2TestBase
,AbstractBasicDistributedZkTestBase
,AbstractChaosMonkeyNothingIsSafeTestBase
,AbstractChaosMonkeySafeLeaderTestBase
,AbstractRestartWhileUpdatingTestBase
,AbstractSyncSliceTestBase
,AbstractTlogReplayBufferedWhileIndexingTestBase
,AbstractUnloadDistributedZkTestBase
public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTestBase
TODO: we should still test this works as a custom update chain as well as what we test now - the default update chain
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractFullDistribZkTestBase.CloudJettyRunner
static class
AbstractFullDistribZkTestBase.CloudSolrServerClient
-
Nested classes/interfaces inherited from class org.apache.solr.BaseDistributedSearchTestCase
BaseDistributedSearchTestCase.RandDate, BaseDistributedSearchTestCase.RandVal, BaseDistributedSearchTestCase.ShardsFixed, BaseDistributedSearchTestCase.ShardsRepeat, BaseDistributedSearchTestCase.ShardsRepeatRule
-
Nested classes/interfaces inherited from class org.apache.solr.SolrTestCaseJ4
SolrTestCaseJ4.BVal, SolrTestCaseJ4.Doc, SolrTestCaseJ4.Fld, SolrTestCaseJ4.FldType, SolrTestCaseJ4.FVal, SolrTestCaseJ4.IRange, SolrTestCaseJ4.IVals, SolrTestCaseJ4.IValsPercent, SolrTestCaseJ4.RandomizingCloudHttp2SolrClientBuilder, SolrTestCaseJ4.RandomizingCloudSolrClientBuilder, SolrTestCaseJ4.SuppressPointFields, SolrTestCaseJ4.SuppressSSL, SolrTestCaseJ4.SVal, SolrTestCaseJ4.Vals, SolrTestCaseJ4.XmlDoc
-
Nested classes/interfaces inherited from class org.apache.lucene.tests.util.LuceneTestCase
org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix, org.apache.lucene.tests.util.LuceneTestCase.BadApple, org.apache.lucene.tests.util.LuceneTestCase.Monster, org.apache.lucene.tests.util.LuceneTestCase.Nightly, org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.tests.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.tests.util.LuceneTestCase.SuppressFsync, org.apache.lucene.tests.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.tests.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.tests.util.LuceneTestCase.ThrowingConsumer<T extends Object>, org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.tests.util.LuceneTestCase.Weekly
-
-
Field Summary
Fields Modifier and Type Field Description protected ChaosMonkey
chaosMonkey
protected org.apache.solr.client.solrj.impl.CloudSolrClient
cloudClient
protected List<AbstractFullDistribZkTestBase.CloudJettyRunner>
cloudJettys
protected org.apache.solr.client.solrj.impl.CloudSolrClient
controlClientCloud
protected List<org.apache.solr.client.solrj.SolrClient>
coreClients
protected boolean
printLayoutOnTearDown
static String
SHARD1
static String
SHARD2
protected Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>>
shardToJetty
protected Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner>
shardToLeaderJetty
protected int
sliceCount
protected Map<String,org.apache.solr.client.solrj.impl.CloudSolrClient>
solrClientByCollection
protected boolean
useJettyDataDir
-
Fields inherited from class org.apache.solr.cloud.AbstractDistribZkTestBase
DEFAULT_COLLECTION, zkServer
-
Fields inherited from class org.apache.solr.BaseDistributedSearchTestCase
clients, context, controlClient, controlJetty, deadServers, executor, fieldNames, flags, FUZZY, handle, id, jettys, nThreads, ORDERED, r, randVals, rdate, rdouble, repeatRule, rfloat, rint, rlong, shards, shardsArr, SKIP, SKIPVAL, stress, testDir, UNORDERED, useExplicitNodeNames, verifyStress
-
Fields inherited from class org.apache.solr.SolrTestCaseJ4
configString, CORE_PROPERTIES_FILENAME, coreName, DEAD_HOST_1, DEAD_HOST_2, DEAD_HOST_3, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_TEST_COLLECTION_NAME, DEFAULT_TEST_CORENAME, h, hdfsDataDir, initCoreDataDir, lrf, NUMERIC_DOCVALUES_SYSPROP, NUMERIC_POINTS_SYSPROP, ONE_ONE, RANDOMIZED_NUMERIC_FIELDTYPES, schemaString, solrConfig, solrTestRules, sslConfig, SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TEST_URL_ALLOW_LIST, testExecutor, testSolrHome, UPDATELOG_SYSPROP, USE_NUMERIC_POINTS_SYSPROP, ZERO_ONE, ZERO_TWO
-
Fields inherited from class org.apache.solr.SolrTestCase
solrClassRules
-
Fields inherited from class org.apache.lucene.tests.util.LuceneTestCase
assertsAreEnabled, classRules, DEFAULT_LINE_DOCS_FILE, INFOSTREAM, JENKINS_LARGE_LINE_DOCS_FILE, LEAVE_TEMPORARY, MAYBE_CACHE_POLICY, RANDOM_MULTIPLIER, ruleChain, suiteFailureMarker, SYSPROP_AWAITSFIX, SYSPROP_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_BADAPPLES, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_THROTTLING, TEST_WEEKLY, VERBOSE
-
-
Constructor Summary
Constructors Constructor Description AbstractFullDistribZkTestBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
afterClass()
protected void
assertDocCounts(boolean verbose)
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 exceptionstatic void
beforeClass()
static void
beforeFullSolrCloudTest()
void
beforeTest()
protected void
checkForCollection(String collectionName, List<Integer> numShardsNumReplicaList, List<String> nodesAllowedToRunShards)
protected void
checkQueries()
protected void
checkShardConsistency()
protected void
checkShardConsistency(boolean checkVsControl, boolean verbose)
protected void
checkShardConsistency(boolean checkVsControl, boolean verbose, Set<String> addFails, Set<String> deleteFails)
protected void
checkShardConsistency(String shard)
Returns a non-null string if replicas within the same shard do not have a consistent number of documents.protected String
checkShardConsistency(String shard, boolean expectFailure, boolean verbose)
Returns a non-null string if replicas within the same shard do not have a consistent number of documents.protected static void
clearErrorHook()
protected void
closeRestTestHarnesses()
protected void
commit()
protected org.apache.solr.client.solrj.impl.CloudSolrClient
createCloudClient(String defaultCollection)
protected org.apache.solr.client.solrj.response.CollectionAdminResponse
createCollection(String collectionName, String configSetName, int numShards, int replicationFactor)
protected void
createCollection(String collName, org.apache.solr.client.solrj.impl.CloudSolrClient client, int replicationFactor, int numShards)
protected org.apache.solr.client.solrj.response.CollectionAdminResponse
createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, int numShards, int replicationFactor, org.apache.solr.client.solrj.SolrClient client, String createNodeSetStr, String configName)
protected org.apache.solr.client.solrj.response.CollectionAdminResponse
createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, String configSetName, int numShards, int replicationFactor, org.apache.solr.client.solrj.SolrClient client, String createNodeSetStr)
protected org.apache.solr.client.solrj.response.CollectionAdminResponse
createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, org.apache.solr.client.solrj.SolrClient client)
protected org.apache.solr.client.solrj.response.CollectionAdminResponse
createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, org.apache.solr.client.solrj.SolrClient client, String confSetName)
protected void
createCollectionRetry(String testCollectionName, String configSetName, int numShards, int replicationFactor)
JettySolrRunner
createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride)
JettySolrRunner
createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, org.apache.solr.common.cloud.Replica.Type replicaType)
JettySolrRunner
createJetty(String dataDir, String ulogDir, String shardList, String solrConfigOverride)
protected List<JettySolrRunner>
createJettys(int numJettys)
protected org.apache.solr.client.solrj.SolrClient
createNewSolrClient(int port)
protected org.apache.solr.client.solrj.SolrClient
createNewSolrClient(String coreName, int port)
protected org.apache.solr.client.solrj.SolrClient
createNewSolrClient(String collection, String baseUrl)
JettySolrRunner
createProxiedJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, org.apache.solr.common.cloud.Replica.Type replicaType)
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.protected void
createServers(int numServers)
protected void
del(String q)
protected void
destroyServers()
void
distribSetUp()
void
distribTearDown()
protected void
enableAutoSoftCommit(int time)
protected List<org.apache.solr.common.cloud.Replica>
ensureAllReplicasAreActive(String testCollectionName, String shardId, int shards, int rf, int maxWaitSecs)
protected void
forAllRestTestHarnesses(Consumer<RestTestHarness> op)
protected String
getBaseUrl(JettySolrRunner jetty)
protected org.apache.solr.client.solrj.SolrClient
getClient(String nodeName)
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.protected org.apache.solr.client.solrj.impl.CloudSolrClient
getCommonCloudSolrClient()
protected String
getDataDir(String dataDir)
static org.apache.solr.common.SolrInputDocument
getDoc(Object... fields)
protected long
getIndexVersion(org.apache.solr.common.cloud.Replica replica)
protected JettySolrRunner
getJettyOnPort(int port)
protected org.apache.solr.common.cloud.ZkCoreNodeProps
getLeaderUrlFromZk(String collection, String slice)
protected org.apache.solr.client.solrj.cloud.SocketProxy
getProxyForReplica(org.apache.solr.common.cloud.Replica replica)
protected int
getPullReplicaCount()
protected int
getReplicaPort(org.apache.solr.common.cloud.Replica replica)
static org.apache.solr.client.solrj.response.RequestStatusState
getRequestStateAfterCompletion(String requestId, int waitForSeconds, org.apache.solr.client.solrj.SolrClient client)
protected org.apache.solr.common.cloud.Replica
getShardLeader(String testCollectionName, String shardId, int timeoutSecs)
protected org.apache.solr.client.solrj.impl.CloudSolrClient
getSolrClient(String collectionName)
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.static String
getUrlFromZk(org.apache.solr.common.cloud.ClusterState clusterState, String collection)
protected void
index_specific(int serverNumber, Object... fields)
protected void
index_specific(org.apache.solr.client.solrj.SolrClient client, Object... fields)
protected void
indexAbunchOfDocs()
protected void
indexDoc(org.apache.solr.common.SolrInputDocument doc)
Indexes the document in both the control client, and a randomly selected clientprotected void
initCloud()
protected void
logReplicationDetails(org.apache.solr.common.cloud.Replica replica, StringBuilder builder)
protected void
logReplicaTypesReplicationInfo(String collectionName, org.apache.solr.common.cloud.ZkStateReader zkStateReader)
protected String
printClusterStateInfo()
protected String
printClusterStateInfo(String collection)
org.apache.solr.client.solrj.response.QueryResponse
queryAndCompareReplicas(org.apache.solr.common.params.SolrParams params, String shard)
Executes a query against each live and active replica of the specified shard and aserts that the results are identical.void
queryAndCompareShards(org.apache.solr.common.params.SolrParams params)
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.protected org.apache.solr.client.solrj.response.QueryResponse
queryServer(org.apache.solr.common.params.ModifiableSolrParams params)
protected void
randomlyEnableAutoSoftCommit()
protected RestTestHarness
randomRestTestHarness()
protected RestTestHarness
randomRestTestHarness(Random random)
protected boolean
reloadCollection(org.apache.solr.common.cloud.Replica replica, String testCollectionName)
protected int
sendDocsWithRetry(String collectionName, List<org.apache.solr.common.SolrInputDocument> batch, int minRf, int maxRetries, int waitBeforeRetry)
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)
protected void
setDistributedParams(org.apache.solr.common.params.ModifiableSolrParams params)
protected static void
setErrorHook()
protected void
setupRestTestHarnesses()
void
showCounts()
protected void
updateMappingsFromZk(List<JettySolrRunner> jettys, List<org.apache.solr.client.solrj.SolrClient> clients)
protected void
updateMappingsFromZk(List<JettySolrRunner> jettys, List<org.apache.solr.client.solrj.SolrClient> clients, boolean allowOverSharding)
protected boolean
useTlogReplicas()
protected void
waitForActiveReplicaCount(org.apache.solr.client.solrj.impl.CloudSolrClient client, String collection, int expectedNumReplicas)
protected void
waitForAllWarmingSearchers()
static void
waitForCollection(org.apache.solr.common.cloud.ZkStateReader reader, String collection, int slices)
protected void
waitForLiveNode(JettySolrRunner j)
static void
waitForNon403or404or503(org.apache.solr.client.solrj.SolrClient collectionClient, String baseUrl)
void
waitForNoShardInconsistency()
protected void
waitForRecoveriesToFinish(boolean verbose)
protected void
waitForRecoveriesToFinish(boolean verbose, long timeoutSeconds)
protected void
waitForRecoveriesToFinish(String collection, boolean verbose)
protected void
waitForReplicationFromReplicas(String collectionName, org.apache.solr.common.cloud.ZkStateReader zkStateReader, org.apache.solr.util.TimeOut timeout)
void
waitForThingsToLevelOut()
void
waitForThingsToLevelOut(int timeout, TimeUnit unit)
-
Methods inherited from class org.apache.solr.cloud.AbstractDistribZkTestBase
assertAllActive, beforeThisClass, copyConfigUp, getCloudSchemaFile, getCloudSolrConfig, printLayout, restartZk, verifyReplicaStatus, waitForCollectionToDisappear, waitForRecoveriesToFinish, waitForRecoveriesToFinish, waitForRecoveriesToFinish, waitForRecoveriesToFinish
-
Methods inherited from class org.apache.solr.BaseDistributedSearchTestCase
add, add, addFields, addRandFields, buildUrl, clearHostContext, clearSolrDisableShardsWhitelist, compare, compare, compare, compare, compare, compare, compare1, compareResponses, compareSolrResponses, createControlJetty, createJetty, createJetty, createJetty, createParams, del, delQ, fixShardCount, flags, getExtraRequestFilters, getExtraServlets, getFieldNames, getRandFields, getRandValues, getServerUrl, getShardCount, getShardsString, getSolrHome, getSolrXml, index, indexDoc, indexDocs, indexDocs, indexr, initHostContext, initialize, query, query, query, query, queryAndCompare, queryAndCompare, seedSolrHome, setSolrDisableShardsWhitelist, setupJettySolrHome, validateControlData
-
Methods inherited from class org.apache.solr.SolrTestCaseJ4
add, addAndGetVersion, addDoc, adoc, adoc, assertExceptionThrownWithMessageContaining, assertFailedU, assertFailedU, assertFieldValues, assertJQ, assertJQ, assertNonBlockingRandomGeneratorAvailable, assertQ, assertQ, assertQEx, assertQEx, assertQEx, assertResponseValues, assertSolrInputFieldEquals, assertU, assertU, assertXmlFile, assumeWorkingMockito, buildJettyConfig, buildUrl, clearIndex, commit, compareSolrDocument, compareSolrDocumentList, compareSolrInputDocument, configset, copyMinConf, copyMinConf, copyMinConf, copyMinFullSetup, copySolrHomeToTemp, copyXmlToHome, createComparator, createComparator, createCore, createCoreContainer, createCoreContainer, createCoreContainer, createDefaultCoreContainer, createDistributedUpdateProcessor, createDoc, createSort, deleteAndGetVersion, deleteByQueryAndGetVersion, deleteCore, delI, delQ, doc, getClassName, getFile, getHttpClient, getHttpSolrClient, getRootCause, getSaferTestName, getSchemaFile, getSimpleClassName, getSolrConfigFile, getWrappedException, hasInitException, hasInitException, ignoreException, indexDocs, initAndGetDataDir, initClassLogLevels, initCore, initCore, initCore, initCore, initMethodLogLevels, invertField, isSSLMode, JQ, json, json, json, jsonAdd, jsonDelId, jsonDelQ, legacyExampleCollection1SolrHome, map, map, newRandomConfig, optimize, params, pickRandom, postSetUp, preTearDown, randomDate, randomSkewedDate, randomXmlUsableUnicodeString, req, req, req, resetExceptionIgnores, resetFactory, resetGlobalTracer, restoreMethodLogLevels, sdoc, sdocs, sdocWithChildren, sdocWithChildren, sdocWithChildren, setUp, setupNoCoreTest, setupTestCases, skewed, startTrackingSearchers, systemClearPropertySolrDisableUrlAllowList, systemClearPropertySolrTestsMergePolicyFactory, systemSetPropertySolrDisableUrlAllowList, systemSetPropertySolrTestsMergePolicyFactory, tearDown, teardownTestCases, TEST_COLL1_CONF, TEST_HOME, TEST_PATH, toJSON, unIgnoreException, updateJ, useFactory, waitForWarming, waitForWarming, whitespaceMockTokenizer, whitespaceMockTokenizer, writeCoreProperties, writeCoreProperties
-
Methods inherited from class org.apache.solr.SolrTestCase
assertJSONEquals, beforeSolrTestCase, checkSyspropForceBeforeAssumptionFailure, checkSyspropForceBeforeClassAssumptionFailure
-
Methods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertFieldInfosEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, assumeWorkingMMapOnWindows, atLeast, atLeast, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getDataPath, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newDirectory, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newIndexWriterConfig, newIOContext, newIOContext, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newMaybeVirusCheckingDirectory, newMaybeVirusCheckingFSDirectory, newMergePolicy, newMergePolicy, newMergePolicy, newMockDirectory, newMockDirectory, newMockDirectory, newMockFSDirectory, newMockFSDirectory, newSearcher, newSearcher, newSearcher, newSearcher, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setupCPUCoreCount, slowFileExists, usually, usually, wrapReader
-
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
-
-
-
Field Detail
-
SHARD1
public static final String SHARD1
- See Also:
- Constant Field Values
-
SHARD2
public static final String SHARD2
- See Also:
- Constant Field Values
-
printLayoutOnTearDown
protected boolean printLayoutOnTearDown
-
sliceCount
protected int sliceCount
-
controlClientCloud
protected volatile org.apache.solr.client.solrj.impl.CloudSolrClient controlClientCloud
-
cloudClient
protected volatile org.apache.solr.client.solrj.impl.CloudSolrClient cloudClient
-
coreClients
protected final List<org.apache.solr.client.solrj.SolrClient> coreClients
-
cloudJettys
protected final List<AbstractFullDistribZkTestBase.CloudJettyRunner> cloudJettys
-
shardToJetty
protected final Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty
-
chaosMonkey
protected volatile ChaosMonkey chaosMonkey
-
shardToLeaderJetty
protected Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty
-
solrClientByCollection
protected Map<String,org.apache.solr.client.solrj.impl.CloudSolrClient> solrClientByCollection
-
useJettyDataDir
protected volatile boolean useJettyDataDir
-
-
Method Detail
-
beforeFullSolrCloudTest
public static void beforeFullSolrCloudTest()
-
beforeTest
public void beforeTest()
-
setErrorHook
protected static void setErrorHook()
-
clearErrorHook
protected static void clearErrorHook()
-
distribSetUp
public void distribSetUp() throws Exception
- Overrides:
distribSetUp
in classAbstractDistribZkTestBase
- Throws:
Exception
-
beforeClass
public static void beforeClass()
-
getDataDir
protected String getDataDir(String dataDir) throws IOException
- Throws:
IOException
-
useTlogReplicas
protected boolean useTlogReplicas()
-
createCloudClient
protected org.apache.solr.client.solrj.impl.CloudSolrClient createCloudClient(String defaultCollection)
-
createServers
protected void createServers(int numServers) throws Exception
- Overrides:
createServers
in classAbstractDistribZkTestBase
- Throws:
Exception
-
waitForCollection
public static void waitForCollection(org.apache.solr.common.cloud.ZkStateReader reader, String collection, int slices) throws Exception
- Throws:
Exception
-
createJettys
protected List<JettySolrRunner> createJettys(int numJettys) throws Exception
- Throws:
Exception
-
waitForLiveNode
protected void waitForLiveNode(JettySolrRunner j) throws InterruptedException, TimeoutException
- Throws:
InterruptedException
TimeoutException
-
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.
-
createJetty
public JettySolrRunner createJetty(String dataDir, String ulogDir, String shardList, String solrConfigOverride) throws Exception
- Throws:
Exception
-
createJetty
public final JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride) throws Exception
- Overrides:
createJetty
in classBaseDistributedSearchTestCase
- Throws:
Exception
-
createJetty
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, org.apache.solr.common.cloud.Replica.Type replicaType) throws Exception
- Throws:
Exception
-
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)
-
getJettyOnPort
protected JettySolrRunner getJettyOnPort(int port)
-
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) 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
-
setDistributedParams
protected void setDistributedParams(org.apache.solr.common.params.ModifiableSolrParams params)
- Overrides:
setDistributedParams
in classBaseDistributedSearchTestCase
-
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
-
indexDoc
protected void indexDoc(org.apache.solr.common.SolrInputDocument doc) throws IOException, org.apache.solr.client.solrj.SolrServerException
Description copied from class:BaseDistributedSearchTestCase
Indexes the document in both the control client, and a randomly selected client- Overrides:
indexDoc
in classBaseDistributedSearchTestCase
- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
index_specific
protected void index_specific(int serverNumber, Object... fields) throws Exception
- Overrides:
index_specific
in classBaseDistributedSearchTestCase
- 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
-
del
protected void del(String q) throws Exception
- Overrides:
del
in classBaseDistributedSearchTestCase
- Throws:
Exception
-
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
-
queryAndCompareReplicas
public org.apache.solr.client.solrj.response.QueryResponse queryAndCompareReplicas(org.apache.solr.common.params.SolrParams params, String shard) throws Exception
Executes a query against each live and active replica of the specified shard and aserts that the results are identical.
-
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(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)
-
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 classBaseDistributedSearchTestCase
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
waitForThingsToLevelOut
public void waitForThingsToLevelOut(int timeout, TimeUnit unit) throws Exception
- Throws:
Exception
-
waitForNoShardInconsistency
public void waitForNoShardInconsistency() throws Exception
- Throws:
Exception
-
distribTearDown
public void distribTearDown() throws Exception
- Overrides:
distribTearDown
in classAbstractDistribZkTestBase
- Throws:
Exception
-
destroyServers
protected void destroyServers() throws Exception
- Overrides:
destroyServers
in classBaseDistributedSearchTestCase
- Throws:
Exception
-
commit
protected void commit() throws Exception
- Overrides:
commit
in classBaseDistributedSearchTestCase
- Throws:
Exception
-
createCollection
protected org.apache.solr.client.solrj.response.CollectionAdminResponse createCollection(String collectionName, String configSetName, int numShards, int replicationFactor) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
createCollection
protected org.apache.solr.client.solrj.response.CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, org.apache.solr.client.solrj.SolrClient client) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
createCollection
protected org.apache.solr.client.solrj.response.CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, org.apache.solr.client.solrj.SolrClient client, String confSetName) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
createCollection
protected org.apache.solr.client.solrj.response.CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, String configSetName, int numShards, int replicationFactor, org.apache.solr.client.solrj.SolrClient client, String createNodeSetStr) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
createCollection
protected org.apache.solr.client.solrj.response.CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, int numShards, int replicationFactor, org.apache.solr.client.solrj.SolrClient client, String createNodeSetStr, String configName) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
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 theCloudSolrClient.Builder
class directly
-
createNewSolrClient
protected org.apache.solr.client.solrj.SolrClient createNewSolrClient(int port)
- Overrides:
createNewSolrClient
in classBaseDistributedSearchTestCase
-
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)
-
getBaseUrl
protected String getBaseUrl(JettySolrRunner jetty)
-
getDoc
public static org.apache.solr.common.SolrInputDocument getDoc(Object... fields) throws Exception
- Throws:
Exception
-
checkForCollection
protected void checkForCollection(String collectionName, List<Integer> numShardsNumReplicaList, List<String> nodesAllowedToRunShards) 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
-
createCollectionRetry
protected void createCollectionRetry(String testCollectionName, String configSetName, int numShards, int replicationFactor) throws org.apache.solr.client.solrj.SolrServerException, IOException, InterruptedException, TimeoutException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
InterruptedException
TimeoutException
-
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
-
printClusterStateInfo
protected String printClusterStateInfo(String collection) throws Exception
- Throws:
Exception
-
reloadCollection
protected boolean reloadCollection(org.apache.solr.common.cloud.Replica replica, String testCollectionName) throws Exception
- Throws:
Exception
-
logReplicaTypesReplicationInfo
protected void logReplicaTypesReplicationInfo(String collectionName, org.apache.solr.common.cloud.ZkStateReader zkStateReader) throws org.apache.zookeeper.KeeperException, InterruptedException, IOException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
IOException
-
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
-
waitForAllWarmingSearchers
protected void waitForAllWarmingSearchers() throws InterruptedException
- Throws:
InterruptedException
-
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()
-
closeRestTestHarnesses
protected void closeRestTestHarnesses() throws IOException
- Throws:
IOException
-
randomRestTestHarness
protected RestTestHarness randomRestTestHarness()
-
randomRestTestHarness
protected RestTestHarness randomRestTestHarness(Random random)
-
forAllRestTestHarnesses
protected void forAllRestTestHarnesses(Consumer<RestTestHarness> op)
-
-