mirror of https://github.com/apache/lucene.git
SOLR-9310: PeerSync fails on a node restart due to IndexFingerPrint mismatch, precommit errors fixed
This commit is contained in:
parent
c2e769450f
commit
80f9167807
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.apache.solr.cloud;
|
package org.apache.solr.cloud;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -7,12 +25,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
|
@ -32,24 +45,6 @@ import org.apache.solr.handler.ReplicationHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test sync peer sync when a node restarts and documents are indexed when node was down.
|
* Test sync peer sync when a node restarts and documents are indexed when node was down.
|
||||||
*
|
*
|
||||||
|
@ -178,22 +173,22 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Future<Void> indexInBackground(int numDocs) {
|
private void indexInBackground(int numDocs) {
|
||||||
ExecutorService executorService = Executors.newSingleThreadExecutor();
|
new Thread(() -> {
|
||||||
Future<Void> f = (Future<Void>) executorService.submit(new Callable<Void>() {
|
try {
|
||||||
|
for (int i = 0; i < numDocs; i++) {
|
||||||
|
indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
|
||||||
|
// slow down adds, to get documents indexed while in PeerSync
|
||||||
|
Thread.sleep(100);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void call() throws Exception {
|
|
||||||
for (int i = 0; i < numDocs; i++) {
|
|
||||||
indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
|
|
||||||
// slow down adds, to get documents indexed while in PeerSync
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
}, getClassName())
|
||||||
|
.start();
|
||||||
|
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -343,7 +338,7 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
|
||||||
SolrInputDocument doc = new SolrInputDocument();
|
SolrInputDocument doc = new SolrInputDocument();
|
||||||
|
|
||||||
addFields(doc, fields);
|
addFields(doc, fields);
|
||||||
addFields(doc, "rnd_s", RandomStringUtils.random(new Random().nextInt(100) + 100));
|
addFields(doc, "rnd_s", RandomStringUtils.random(random().nextInt(100) + 100));
|
||||||
|
|
||||||
UpdateRequest ureq = new UpdateRequest();
|
UpdateRequest ureq = new UpdateRequest();
|
||||||
ureq.add(doc);
|
ureq.add(doc);
|
||||||
|
|
Loading…
Reference in New Issue