mirror of https://github.com/apache/lucene.git
add missing succes=true in NRT replicator; remove some dead code
This commit is contained in:
parent
15526e776a
commit
012fb76f7d
|
@ -97,6 +97,7 @@ public abstract class ReplicaNode extends Node {
|
||||||
|
|
||||||
state = "init";
|
state = "init";
|
||||||
deleter = new ReplicaFileDeleter(this, dir);
|
deleter = new ReplicaFileDeleter(this, dir);
|
||||||
|
success = true;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
message("exc on init:");
|
message("exc on init:");
|
||||||
t.printStackTrace(printStream);
|
t.printStackTrace(printStream);
|
||||||
|
@ -219,8 +220,6 @@ public abstract class ReplicaNode extends Node {
|
||||||
|
|
||||||
message("top: init: sync sis.version=" + job.getCopyState().version);
|
message("top: init: sync sis.version=" + job.getCopyState().version);
|
||||||
|
|
||||||
Collection<String> fileNamesToCopy = job.getFileNamesToCopy();
|
|
||||||
|
|
||||||
// Force this copy job to finish while we wait, now. Note that this can be very time consuming!
|
// Force this copy job to finish while we wait, now. Note that this can be very time consuming!
|
||||||
// NOTE: newNRTPoint detects we are still in init (mgr is null) and does not cancel our copy if a flush happens
|
// NOTE: newNRTPoint detects we are still in init (mgr is null) and does not cancel our copy if a flush happens
|
||||||
try {
|
try {
|
||||||
|
@ -718,7 +717,6 @@ public abstract class ReplicaNode extends Node {
|
||||||
* files that need copying */
|
* files that need copying */
|
||||||
public List<Map.Entry<String,FileMetaData>> getFilesToCopy(Map<String,FileMetaData> files) throws IOException {
|
public List<Map.Entry<String,FileMetaData>> getFilesToCopy(Map<String,FileMetaData> files) throws IOException {
|
||||||
|
|
||||||
boolean doCopyCommitFiles = false;
|
|
||||||
List<Map.Entry<String,FileMetaData>> toCopy = new ArrayList<>();
|
List<Map.Entry<String,FileMetaData>> toCopy = new ArrayList<>();
|
||||||
for (Map.Entry<String,FileMetaData> ent : files.entrySet()) {
|
for (Map.Entry<String,FileMetaData> ent : files.entrySet()) {
|
||||||
String fileName = ent.getKey();
|
String fileName = ent.getKey();
|
||||||
|
|
|
@ -30,6 +30,9 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
|
import org.apache.lucene.index.IndexWriter;
|
||||||
|
import org.apache.lucene.store.FSDirectory;
|
||||||
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.LineFileDocs;
|
import org.apache.lucene.util.LineFileDocs;
|
||||||
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
||||||
|
@ -695,6 +698,12 @@ public class TestNRTReplication extends LuceneTestCase {
|
||||||
replica.close();
|
replica.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertWriteLockHeld(Path path) throws Exception {
|
||||||
|
try (FSDirectory dir = FSDirectory.open(path)) {
|
||||||
|
expectThrows(LockObtainFailedException.class, () -> {dir.obtainLock(IndexWriter.WRITE_LOCK_NAME);});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testCrashReplica() throws Exception {
|
public void testCrashReplica() throws Exception {
|
||||||
|
|
||||||
Path path1 = createTempDir("1");
|
Path path1 = createTempDir("1");
|
||||||
|
@ -703,6 +712,8 @@ public class TestNRTReplication extends LuceneTestCase {
|
||||||
Path path2 = createTempDir("2");
|
Path path2 = createTempDir("2");
|
||||||
NodeProcess replica = startNode(primary.tcpPort, 1, path2, -1, true);
|
NodeProcess replica = startNode(primary.tcpPort, 1, path2, -1, true);
|
||||||
|
|
||||||
|
assertWriteLockHeld(path2);
|
||||||
|
|
||||||
sendReplicasToPrimary(primary, replica);
|
sendReplicasToPrimary(primary, replica);
|
||||||
|
|
||||||
// Index 10 docs into primary:
|
// Index 10 docs into primary:
|
||||||
|
|
Loading…
Reference in New Issue