SOLR-10079: TestInPlaceUpdates(Distrib|Standalone) failures

This commit is contained in:
Cao Manh Dat 2017-03-29 08:09:40 +07:00 committed by Shalin Shekhar Mangar
parent 0a6ba6fb0c
commit 63295f838f
2 changed files with 10 additions and 14 deletions

View File

@ -369,7 +369,7 @@ public class TestInjection {
Pair<Boolean,Integer> pair = parseValue(waitForReplicasInSync); Pair<Boolean,Integer> pair = parseValue(waitForReplicasInSync);
boolean enabled = pair.first(); boolean enabled = pair.first();
if (!enabled) return true; if (!enabled) return true;
long t = System.currentTimeMillis() - 100; long t = System.currentTimeMillis() - 200;
try { try {
for (int i = 0; i < pair.second(); i++) { for (int i = 0; i < pair.second(); i++) {
if (core.isClosed()) return true; if (core.isClosed()) return true;

View File

@ -201,7 +201,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
assertEquals(2, NONLEADERS.size()); assertEquals(2, NONLEADERS.size());
} }
final int NUM_RETRIES = 100, WAIT_TIME = 10; final int NUM_RETRIES = 100, WAIT_TIME = 50;
// The following should work: full update to doc 0, in-place update for doc 0, delete doc 0 // The following should work: full update to doc 0, in-place update for doc 0, delete doc 0
private void reorderedDBQsSimpleTest() throws Exception { private void reorderedDBQsSimpleTest() throws Exception {
@ -266,8 +266,6 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
} }
log.info("reorderedDBQsSimpleTest: This test passed fine..."); log.info("reorderedDBQsSimpleTest: This test passed fine...");
clearIndex();
commit();
} }
private void reorderedDBQIndividualReplicaTest() throws Exception { private void reorderedDBQIndividualReplicaTest() throws Exception {
@ -324,7 +322,8 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
private void docValuesUpdateTest() throws Exception { private void docValuesUpdateTest() throws Exception {
// number of docs we're testing (0 <= id), index may contain additional random docs (id < 0) // number of docs we're testing (0 <= id), index may contain additional random docs (id < 0)
final int numDocs = atLeast(100); int numDocs = atLeast(100);
if (onlyLeaderIndexes) numDocs = TestUtil.nextInt(random(), 10, 50);
log.info("Trying num docs = " + numDocs); log.info("Trying num docs = " + numDocs);
final List<Integer> ids = new ArrayList<Integer>(numDocs); final List<Integer> ids = new ArrayList<Integer>(numDocs);
for (int id = 0; id < numDocs; id++) { for (int id = 0; id < numDocs; id++) {
@ -667,8 +666,6 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
} }
log.info("outOfOrderUpdatesIndividualReplicaTest: This test passed fine..."); log.info("outOfOrderUpdatesIndividualReplicaTest: This test passed fine...");
clearIndex();
commit();
} }
// The following should work: full update to doc 0, in-place update for doc 0, delete doc 0 // The following should work: full update to doc 0, in-place update for doc 0, delete doc 0
@ -733,8 +730,6 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
} }
log.info("reorderedDeletesTest: This test passed fine..."); log.info("reorderedDeletesTest: This test passed fine...");
clearIndex();
commit();
} }
/* Test for a situation when a document requiring in-place update cannot be "resurrected" /* Test for a situation when a document requiring in-place update cannot be "resurrected"
@ -972,10 +967,11 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
assertEquals("Field: " + fieldName, expected, rsp.getField()); assertEquals("Field: " + fieldName, expected, rsp.getField());
} }
private static class AsyncUpdateWithRandomCommit implements Callable<UpdateResponse> { private class AsyncUpdateWithRandomCommit implements Callable<UpdateResponse> {
UpdateRequest update; UpdateRequest update;
SolrClient solrClient; SolrClient solrClient;
final Random rnd; final Random rnd;
int commitBound = onlyLeaderIndexes ? 50 : 3;
public AsyncUpdateWithRandomCommit (UpdateRequest update, SolrClient solrClient, long seed) { public AsyncUpdateWithRandomCommit (UpdateRequest update, SolrClient solrClient, long seed) {
this.update = update; this.update = update;
@ -986,7 +982,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
@Override @Override
public UpdateResponse call() throws Exception { public UpdateResponse call() throws Exception {
UpdateResponse resp = update.process(solrClient); //solrClient.request(update); UpdateResponse resp = update.process(solrClient); //solrClient.request(update);
if (rnd.nextInt(3) == 0) if (rnd.nextInt(commitBound) == 0)
solrClient.commit(); solrClient.commit();
return resp; return resp;
} }
@ -1113,9 +1109,9 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
* @return the versions of each of the specials document returned when indexing it * @return the versions of each of the specials document returned when indexing it
*/ */
protected List<Long> buildRandomIndex(Float initFloat, List<Integer> specialIds) throws Exception { protected List<Long> buildRandomIndex(Float initFloat, List<Integer> specialIds) throws Exception {
int id = -1; // used for non special docs int id = -1; // used for non special docs
final int numPreDocs = rarely() ? TestUtil.nextInt(random(),0,9) : atLeast(10); final int numPreDocs = rarely() || onlyLeaderIndexes ? TestUtil.nextInt(random(),0,9) : atLeast(10);
for (int i = 1; i <= numPreDocs; i++) { for (int i = 1; i <= numPreDocs; i++) {
addDocAndGetVersion("id", id, "title_s", "title" + id, "id_i", id); addDocAndGetVersion("id", id, "title_s", "title" + id, "id_i", id);
id--; id--;
@ -1128,7 +1124,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
versions.add(addDocAndGetVersion("id", special, "title_s", "title" + special, "id_i", special, versions.add(addDocAndGetVersion("id", special, "title_s", "title" + special, "id_i", special,
"inplace_updatable_float", initFloat)); "inplace_updatable_float", initFloat));
} }
final int numPostDocs = rarely() ? TestUtil.nextInt(random(),0,9) : atLeast(10); final int numPostDocs = rarely() || onlyLeaderIndexes ? TestUtil.nextInt(random(),0,2) : atLeast(10);
for (int i = 1; i <= numPostDocs; i++) { for (int i = 1; i <= numPostDocs; i++) {
addDocAndGetVersion("id", id, "title_s", "title" + id, "id_i", id); addDocAndGetVersion("id", id, "title_s", "title" + id, "id_i", id);
id--; id--;