From 564047059333ba391595f0dfb080ef2c3157d3c0 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Tue, 9 Feb 2016 10:43:36 -0500 Subject: [PATCH] cleanup some precommit failures --- .../java/org/apache/lucene/index/DirectoryReader.java | 2 +- .../src/java/org/apache/lucene/index/IndexWriter.java | 11 +++++++++-- .../java/org/apache/lucene/index/SegmentInfos.java | 2 +- .../apache/lucene/replicator/nrt/SimpleServer.java | 2 ++ .../lucene/replicator/nrt/TestNRTReplication.java | 2 ++ .../replicator/nrt/TestStressNRTReplication.java | 4 +++- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java index c60e6c3b536..7f65d15c275 100644 --- a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java @@ -93,7 +93,7 @@ public abstract class DirectoryReader extends BaseCompositeReader { * gain some performance by passing false. * @param writeAllDeletes If true, new deletes will be written * down to index files instead of carried over from writer to - * reader in heap + * reader directly in heap * * @see #open(IndexWriter) * diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java index bde56867e60..eee17fc5ac1 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java @@ -438,7 +438,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable { anyChanges |= maybeApplyDeletes(applyAllDeletes); if (writeAllDeletes) { // Must move the deletes to disk: - System.out.println("IW: now readerPool.commit"); readerPool.commit(segmentInfos); } @@ -1174,7 +1173,9 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable { return docWriter.getNumDocs() + segmentInfos.totalMaxDoc(); } - /** If {@link SegmentInfos#getVersion} is below {@code newVersion} then update it to this value. */ + /** If {@link SegmentInfos#getVersion} is below {@code newVersion} then update it to this value. + * + * @lucene.internal */ public synchronized void advanceSegmentInfosVersion(long newVersion) { ensureOpen(); if (segmentInfos.getVersion() < newVersion) { @@ -2897,6 +2898,12 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable { setCommitData(commitUserData, true); } + /** + * Sets the commit user data map, controlling whether to advance the {@link SegmentInfos#getVersion}. + * + * @see #setCommitData(Map) + * + * @lucene.internal */ public final synchronized void setCommitData(Map commitUserData, boolean doIncrementVersion) { segmentInfos.setUserData(new HashMap<>(commitUserData), doIncrementVersion); changeCount.incrementAndGet(); diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java index 3b95f25d90d..324f8ddace1 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java @@ -887,7 +887,7 @@ public final class SegmentInfos implements Cloneable, Iterable clientThreads = Collections.synchronizedSet(new HashSet<>()); 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.java index 262e68e01d6..773390e3ece 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 @@ -35,6 +35,7 @@ import org.apache.lucene.util.LineFileDocs; import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.SuppressForbidden; import org.apache.lucene.util.TestUtil; import com.carrotsearch.randomizedtesting.SeedUtils; @@ -53,6 +54,7 @@ public class TestNRTReplication extends LuceneTestCase { LineFileDocs docs; /** Launches a child "server" (separate JVM), which is either primary or replica node */ + @SuppressForbidden(reason = "ProcessBuilder requires java.io.File for CWD") private NodeProcess startNode(int primaryTCPPort, final int id, Path indexPath, long forcePrimaryVersion, boolean willCrash) throws IOException { List cmd = new ArrayList<>(); diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java index d9222c0330c..630058925f9 100644 --- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java +++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java @@ -50,9 +50,10 @@ import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.MockDirectoryWrapper; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.LineFileDocs; -import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks; +import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.SuppressForbidden; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.ThreadInterruptedException; @@ -502,6 +503,7 @@ public class TestStressNRTReplication extends LuceneTestCase { } /** Launches a child "server" (separate JVM), which is either primary or replica node */ + @SuppressForbidden(reason = "ProcessBuilder requires java.io.File for CWD") NodeProcess startNode(final int id, Path indexPath, boolean isPrimary, long forcePrimaryVersion) throws IOException { nodeTimeStamps[id] = System.nanoTime(); List cmd = new ArrayList<>();