Skip to content

Apache Lucene open-source search software

LUCENE-4055: more nocommits

Michael McCandless54f5444796ab
diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index 62cf95594f4..47bcbc6d0ac 100644
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@ -88,9 +88,6 @@ public class CheckIndex {
/** Number of segments in the index. */
public int numSegments;
- /** String description of the version of the index. */
- public String segmentFormat;
-
/** Empty unless you passed specific segments list to check as optional 3rd argument.
* @see CheckIndex#checkIndex(List) */
public List<String> segmentsChecked = new ArrayList<String>();
@@ -410,31 +407,8 @@ public class CheckIndex {
String sFormat = "";
boolean skip = false;
- // nocommit fixme
- /*
- if (format == SegmentInfos.FORMAT_DIAGNOSTICS) {
- sFormat = "FORMAT_DIAGNOSTICS [Lucene 2.9]";
- } else if (format == SegmentInfos.FORMAT_HAS_VECTORS) {
- sFormat = "FORMAT_HAS_VECTORS [Lucene 3.1]";
- } else if (format == SegmentInfos.FORMAT_3_1) {
- sFormat = "FORMAT_3_1 [Lucene 3.1+]";
- } else if (format == SegmentInfos.FORMAT_4_0) {
- sFormat = "FORMAT_4_0 [Lucene 4.0]";
- } else if (format == SegmentInfos.FORMAT_CURRENT) {
- throw new RuntimeException("BUG: You should update this tool!");
- } else if (format < SegmentInfos.FORMAT_CURRENT) {
- sFormat = "int=" + format + " [newer version of Lucene than this tool supports]";
- skip = true;
- } else if (format > SegmentInfos.FORMAT_MINIMUM) {
- sFormat = "int=" + format + " [older version of Lucene than this tool supports]";
- skip = true;
- }
- */
- sFormat = "nocommit not working yet";
-
result.segmentsFileName = segmentsFileName;
result.numSegments = numSegments;
- result.segmentFormat = sFormat;
result.userData = sis.getUserData();
String userDataString;
if (sis.getUserData().size() > 0) {
diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
index c69281a7ac9..ab23d0d8727 100644
--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
@@ -96,7 +96,7 @@ public final class FieldInfo {
assert normType == null;
assert indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
} else {
- // nocommit this trips:
+ // nocommit trips:
//assert omitNorms || normType != null;
assert indexOptions != null;
}
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 f157424b143..2768a9ecdf1 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -3525,7 +3525,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
}
}
- // nocommit why do we set success back to false here!?
+ // nocommit why on earth do we suddenly set success back to false here!?
success = false;
synchronized(this) {
diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java
index 17975deb64f..5910e32ed70 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java
@@ -41,6 +41,7 @@ import org.apache.lucene.util.Constants;
*
* @lucene.experimental
*/
+// nocommit final...?
public class SegmentInfo implements Cloneable {
// TODO: remove these from this class, for now this is the representation
@@ -196,7 +197,6 @@ public class SegmentInfo implements Cloneable {
clearFilesCache();
}
- // nocommit this is dangerous... because we lose the codec's customzied class...
@Override
public SegmentInfo clone() {
final HashMap<Integer,Long> clonedNormGen;
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 6df915d9dd8..006a6f2e5c7 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
@@ -93,8 +93,6 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
// also i think this class should write this, somehow we let
// preflexrw hackishly override this (like seek backwards and overwrite it)
- // nocommit fix to read 3.x...
-
public static final int VERSION_40 = 0;
/** Used for the segments.gen file only!
@@ -289,8 +287,6 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
}
userData = input.readStringStringMap();
} else {
- // nocommit 3.x needs normGens too ... we can push
- // down to make this 3.x private????
Lucene3xSegmentInfosReader.readLegacyInfos(this, directory, input, format);
Codec codec = Codec.forName("Lucene3x");
for (SegmentInfo info : this) {
diff --git a/lucene/core/src/java/org/apache/lucene/store/RateLimiter.java b/lucene/core/src/java/org/apache/lucene/store/RateLimiter.java
index 59ecbc23ca3..8e099758838 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RateLimiter.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RateLimiter.java
@@ -62,6 +62,9 @@ public class RateLimiter {
* might exceed the target). It's best to call this
* with a biggish count, not one byte at a time. */
public void pause(long bytes) {
+ if (bytes == 1) {
+ return;
+ }
// TODO: this is purely instantaneous rate; maybe we
// should also offer decayed recent history one?
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestStressAdvance.java b/lucene/core/src/test/org/apache/lucene/index/TestStressAdvance.java
index 9fd67723157..5ac8c506fd5 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestStressAdvance.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestStressAdvance.java
@@ -42,6 +42,9 @@ public class TestStressAdvance extends LuceneTestCase {
final Field idField = newField("id", "", StringField.TYPE_STORED);
doc.add(idField);
int num = atLeast(4097);
+ if (VERBOSE) {
+ System.out.println("\nTEST: numDocs=" + num);
+ }
for(int id=0;id<num;id++) {
if (random().nextInt(4) == 3) {
f.setStringValue("a");
@@ -51,6 +54,9 @@ public class TestStressAdvance extends LuceneTestCase {
}
idField.setStringValue(""+id);
w.addDocument(doc);
+ if (VERBOSE) {
+ System.out.println("\nTEST: doc upto " + id);
+ }
}
w.forceMerge(1);
diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java
index 9658110e006..1b9b1adee68 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java
@@ -78,7 +78,7 @@ public class MockIndexOutputWrapper extends IndexOutput {
long freeSpace = dir.maxSize == 0 ? 0 : dir.maxSize - dir.sizeInBytes();
long realUsage = 0;
- if (dir.rateLimiter != null) {
+ if (dir.rateLimiter != null && len >= 10) {
dir.rateLimiter.pause(len);
}