remove tests.processors, this is a reproducibility nightmare
This commit is contained in:
parent
e3e4c02379
commit
e71553556e
1
pom.xml
1
pom.xml
|
@ -589,7 +589,6 @@
|
|||
<tests.bwc.path>${tests.bwc.path}</tests.bwc.path>
|
||||
<tests.bwc.version>${tests.bwc.version}</tests.bwc.version>
|
||||
<tests.jvm.argline>${tests.jvm.argline}</tests.jvm.argline>
|
||||
<tests.processors>${tests.processors}</tests.processors>
|
||||
<tests.appendseed>${tests.appendseed}</tests.appendseed>
|
||||
<tests.iters>${tests.iters}</tests.iters>
|
||||
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
|
||||
|
|
|
@ -36,6 +36,9 @@ public class EsExecutors {
|
|||
*/
|
||||
public static final String PROCESSORS = "processors";
|
||||
|
||||
/** Useful for testing */
|
||||
public static final String DEFAULT_SYSPROP = "es.processors.override";
|
||||
|
||||
/**
|
||||
* Returns the number of processors available but at most <tt>32</tt>.
|
||||
*/
|
||||
|
@ -44,7 +47,11 @@ public class EsExecutors {
|
|||
* ie. >= 48 create too many threads and run into OOM see #3478
|
||||
* We just use an 32 core upper-bound here to not stress the system
|
||||
* too much with too many created threads */
|
||||
return settings.getAsInt(PROCESSORS, Math.min(32, Runtime.getRuntime().availableProcessors()));
|
||||
int defaultValue = Math.min(32, Runtime.getRuntime().availableProcessors());
|
||||
try {
|
||||
defaultValue = Integer.parseInt(System.getProperty(DEFAULT_SYSPROP));
|
||||
} catch (Throwable ignored) {}
|
||||
return settings.getAsInt(PROCESSORS, defaultValue);
|
||||
}
|
||||
|
||||
public static PrioritizedEsThreadPoolExecutor newSinglePrioritizing(ThreadFactory threadFactory) {
|
||||
|
|
|
@ -96,12 +96,6 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void disableQueryCache() {
|
||||
// TODO: Parent/child and other things does not work with the query cache
|
||||
IndexSearcher.setDefaultQueryCache(null);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void restoreFileSystem() {
|
||||
try {
|
||||
|
@ -115,6 +109,24 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpProcessors() {
|
||||
int numCpu = TestUtil.nextInt(random(), 1, 4);
|
||||
System.setProperty(EsExecutors.DEFAULT_SYSPROP, Integer.toString(numCpu));
|
||||
assertEquals(numCpu, EsExecutors.boundedNumberOfProcessors(ImmutableSettings.EMPTY));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void restoreProcessors() {
|
||||
System.clearProperty(EsExecutors.DEFAULT_SYSPROP);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void disableQueryCache() {
|
||||
// TODO: Parent/child and other things does not work with the query cache
|
||||
IndexSearcher.setDefaultQueryCache(null);
|
||||
}
|
||||
|
||||
@After
|
||||
public void ensureNoFieldCacheUse() {
|
||||
// field cache should NEVER get loaded.
|
||||
|
@ -197,25 +209,6 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
public static final String SYSPROP_FAILFAST = "tests.failfast";
|
||||
|
||||
public static final String SYSPROP_INTEGRATION = "tests.integration";
|
||||
|
||||
public static final String SYSPROP_PROCESSORS = "tests.processors";
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Truly immutable fields and constants, initialized once and valid
|
||||
// for all suites ever since.
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
public static final int TESTS_PROCESSORS;
|
||||
|
||||
static {
|
||||
String processors = System.getProperty(SYSPROP_PROCESSORS, ""); // mvn sets "" as default
|
||||
if (processors == null || processors.isEmpty()) {
|
||||
processors = Integer.toString(EsExecutors.boundedNumberOfProcessors(ImmutableSettings.EMPTY));
|
||||
}
|
||||
TESTS_PROCESSORS = Integer.parseInt(processors);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Suite and test case setup/ cleanup.
|
||||
// -----------------------------------------------------------------
|
||||
|
|
|
@ -414,10 +414,10 @@ public final class InternalTestCluster extends TestCluster {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (random.nextInt(10) == 0) {
|
||||
builder.put(EsExecutors.PROCESSORS, 1 + random.nextInt(ESTestCase.TESTS_PROCESSORS));
|
||||
} else {
|
||||
builder.put(EsExecutors.PROCESSORS, ESTestCase.TESTS_PROCESSORS);
|
||||
// node gets an extra cpu this time
|
||||
builder.put(EsExecutors.PROCESSORS, 1 + EsExecutors.boundedNumberOfProcessors(ImmutableSettings.EMPTY));
|
||||
}
|
||||
|
||||
if (random.nextBoolean()) {
|
||||
|
|
|
@ -144,7 +144,6 @@ public class ReproduceInfoPrinter extends RunListener {
|
|||
}
|
||||
appendOpt("tests.locale", Locale.getDefault().toString());
|
||||
appendOpt("tests.timezone", TimeZone.getDefault().getID());
|
||||
appendOpt(ESTestCase.SYSPROP_PROCESSORS, Integer.toString(ESTestCase.TESTS_PROCESSORS));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue