Apache Solr open-source search software
add missing succes=true in NRT replicator; remove some dead code
Mike McCandlessde6485ea6a35
diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.javaindex e7d40ac7a60..1ca151965c1 100644--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java@@ -97,6 +97,7 @@ public abstract class ReplicaNode extends Node {state = "init";deleter = new ReplicaFileDeleter(this, dir);+ success = true;} catch (Throwable t) {message("exc on init:");t.printStackTrace(printStream);@@ -219,8 +220,6 @@ public abstract class ReplicaNode extends Node {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!// NOTE: newNRTPoint detects we are still in init (mgr is null) and does not cancel our copy if a flush happenstry {@@ -718,7 +717,6 @@ public abstract class ReplicaNode extends Node {* files that need copying */public List<Map.Entry<String,FileMetaData>> getFilesToCopy(Map<String,FileMetaData> files) throws IOException {- boolean doCopyCommitFiles = false;List<Map.Entry<String,FileMetaData>> toCopy = new ArrayList<>();for (Map.Entry<String,FileMetaData> ent : files.entrySet()) {String fileName = ent.getKey();diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestNRTReplication.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestNRTReplication.javaindex 576186a7af9..f98cf8d08dc 100644--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestNRTReplication.java+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestNRTReplication.java@@ -30,6 +30,9 @@ import java.util.concurrent.atomic.AtomicLong;import java.util.regex.Pattern;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.LineFileDocs;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;@@ -695,6 +698,12 @@ public class TestNRTReplication extends LuceneTestCase {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 {Path path1 = createTempDir("1");@@ -703,6 +712,8 @@ public class TestNRTReplication extends LuceneTestCase {Path path2 = createTempDir("2");NodeProcess replica = startNode(primary.tcpPort, 1, path2, -1, true);+ assertWriteLockHeld(path2);+sendReplicasToPrimary(primary, replica);// Index 10 docs into primary: