LUCENE-3023: manually merged missed chunks from trunk and minor cleanup after review patch from re-integration

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1097440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-04-28 12:55:12 +00:00
parent f47c3e8298
commit 0ee7cba028
12 changed files with 62 additions and 81 deletions

View File

@ -6,6 +6,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -6,6 +6,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -6,6 +6,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test-framework" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/dist" />

View File

@ -7,6 +7,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/java/tools" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -10,7 +10,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/webapp/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/webapp/web" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/scripts" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test-files" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test-framework" isTestSource="true" />

View File

@ -21,14 +21,14 @@ import java.io.IOException;
import java.util.Map;
abstract class DocFieldConsumer {
/** Called when DocumentsWriter decides to create a new
/** Called when DocumentsWriterPerThread decides to create a new
* segment */
abstract void flush(Map<FieldInfo, DocFieldConsumerPerField> fieldsToFlush, SegmentWriteState state) throws IOException;
/** Called when an aborting exception is hit */
abstract void abort();
/** Called when DocumentsWriter is using too much RAM.
/** Called when DocumentsWriterPerThread is using too much RAM.
* The consumer should free RAM, if possible, returning
* true if any RAM was in fact freed. */
abstract boolean freeRAM();

View File

@ -200,6 +200,6 @@ final class DocInverterPerField extends DocFieldConsumerPerField {
@Override
FieldInfo getFieldInfo() {
return this.fieldInfo;
return fieldInfo;
}
}

View File

@ -73,11 +73,11 @@ public final class SegmentInfo {
private volatile long sizeInBytesNoStore = -1; // total byte size of all but the store files (computed on demand)
private volatile long sizeInBytesWithStore = -1; // total byte size of all of our files (computed on demand)
@Deprecated private int docStoreOffset; // if this segment shares stored fields & vectors, this
private int docStoreOffset; // if this segment shares stored fields & vectors, this
// offset is where in that file this segment's docs begin
@Deprecated private String docStoreSegment; // name used to derive fields/vectors file we share with
private String docStoreSegment; // name used to derive fields/vectors file we share with
// other segments
@Deprecated private boolean docStoreIsCompoundFile; // whether doc store files are stored in compound file (*.cfx)
private boolean docStoreIsCompoundFile; // whether doc store files are stored in compound file (*.cfx)
private int delCount; // How many deleted docs in this segment
@ -467,23 +467,19 @@ public final class SegmentInfo {
assert delCount <= docCount;
}
@Deprecated
public int getDocStoreOffset() {
return docStoreOffset;
}
@Deprecated
public boolean getDocStoreIsCompoundFile() {
return docStoreIsCompoundFile;
}
@Deprecated
public void setDocStoreIsCompoundFile(boolean docStoreIsCompoundFile) {
this.docStoreIsCompoundFile = docStoreIsCompoundFile;
clearFilesCache();
}
@Deprecated
void setDocStore(int offset, String segment, boolean isCompoundFile) {
docStoreOffset = offset;
docStoreSegment = segment;
@ -491,18 +487,15 @@ public final class SegmentInfo {
clearFilesCache();
}
@Deprecated
public String getDocStoreSegment() {
return docStoreSegment;
}
@Deprecated
void setDocStoreOffset(int offset) {
docStoreOffset = offset;
clearFilesCache();
}
@Deprecated
public void setDocStoreSegment(String docStoreSegment) {
this.docStoreSegment = docStoreSegment;
}
@ -516,14 +509,12 @@ public final class SegmentInfo {
output.writeString(name);
output.writeInt(docCount);
output.writeLong(delGen);
output.writeInt(docStoreOffset);
if (docStoreOffset != -1) {
output.writeString(docStoreSegment);
output.writeByte((byte) (docStoreIsCompoundFile ? 1:0));
}
if (normGen == null) {
output.writeInt(NO);
} else {

View File

@ -19,6 +19,7 @@ import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.ReaderUtil;
import org.apache.lucene.util._TestUtil;
import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;
@ -172,16 +173,7 @@ public class QueryUtils {
}
w.commit();
w.deleteDocuments( new MatchAllDocsQuery() );
try {
// Carefully invoke what is a package-private (test
// only, internal) method on IndexWriter:
Method m = IndexWriter.class.getDeclaredMethod("keepFullyDeletedSegments");
m.setAccessible(true);
m.invoke(w);
} catch (Exception e) {
// Should not happen?
throw new RuntimeException(e);
}
_TestUtil.keepFullyDeletedSegments(w);
w.commit();
if (0 < numDeletedDocs)

View File

@ -726,7 +726,7 @@ public abstract class LuceneTestCase extends Assert {
}
/**
* Convinience method for logging an iterator.
* Convenience method for logging an iterator.
*
* @param label String logged before/after the items in the iterator
* @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.
@ -746,7 +746,7 @@ public abstract class LuceneTestCase extends Assert {
}
/**
* Convinience method for logging an array. Wraps the array in an iterator and delegates
* Convenience method for logging an array. Wraps the array in an iterator and delegates
*
* @see #dumpIterator(String,Iterator,PrintStream)
*/
@ -761,6 +761,7 @@ public abstract class LuceneTestCase extends Assert {
return newIndexWriterConfig(random, v, a);
}
/** create a new index writer config with random defaults using the specified random */
public static IndexWriterConfig newIndexWriterConfig(Random r, Version v, Analyzer a) {
IndexWriterConfig c = new IndexWriterConfig(v, a);
if (r.nextBoolean()) {
@ -937,14 +938,12 @@ public abstract class LuceneTestCase extends Assert {
return dir;
}
/** Returns a new field instance.
* See {@link #newField(String, String, Field.Store, Field.Index, Field.TermVector)} for more information */
public static Field newField(String name, String value, Index index) {
return newField(random, name, value, index);
}
/** Returns a new field instance.
* See {@link #newField(String, String, Field.Store, Field.Index, Field.TermVector)} for more information */
public static Field newField(String name, String value, Store store, Index index) {
@ -964,21 +963,18 @@ public abstract class LuceneTestCase extends Assert {
return newField(random, name, value, store, index, tv);
}
/** Returns a new field instance, using the specified random.
* See {@link #newField(String, String, Field.Store, Field.Index, Field.TermVector)} for more information */
public static Field newField(Random random, String name, String value, Index index) {
return newField(random, name, value, Store.NO, index);
}
/** Returns a new field instance, using the specified random.
* See {@link #newField(String, String, Field.Store, Field.Index, Field.TermVector)} for more information */
public static Field newField(Random random, String name, String value, Store store, Index index) {
return newField(random, name, value, store, index, TermVector.NO);
}
/** Returns a new field instance, using the specified random.
* See {@link #newField(String, String, Field.Store, Field.Index, Field.TermVector)} for more information */
public static Field newField(Random random, String name, String value, Store store, Index index, TermVector tv) {
@ -1318,7 +1314,7 @@ public abstract class LuceneTestCase extends Assert {
}
@Override
public String toString() {
public synchronized String toString() {
return "RandomCodecProvider: " + previousMappings.toString();
}
}

View File

@ -32,13 +32,12 @@ import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Version;
public class TestPerSegmentDeletes extends LuceneTestCase {
public void testDeletes1() throws Exception {
//IndexWriter.debug2 = System.out;
Directory dir = new MockDirectoryWrapper(new Random(random.nextLong()), new RAMDirectory());
IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_CURRENT,
IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random));
iwc.setMergeScheduler(new SerialMergeScheduler());
iwc.setMaxBufferedDocs(5000);