You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/11/02 07:18:41 UTC
svn commit: r1538146 [1/3] - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/codecs/ lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/
lucene/core/ lucene/core/src/java/org/apache/lucene/codecs/
lucene/core/src/java/org/apache/lucene/cod...
Author: shaie
Date: Sat Nov 2 06:18:40 2013
New Revision: 1538146
URL: http://svn.apache.org/r1538146
Log:
LUCENE-5189: rename internal API following NumericDocValues updates
Added:
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdates.java
- copied unchanged from r1538143, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/BufferedUpdates.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java
- copied, changed from r1538143, lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CoalescedUpdates.java
- copied unchanged from r1538143, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CoalescedUpdates.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FrozenBufferedUpdates.java
- copied unchanged from r1538143, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/FrozenBufferedUpdates.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java
- copied, changed from r1538143, lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/ReadersAndLiveDocs.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentCommitInfo.java
- copied, changed from r1538143, lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentInfoPerCommit.java
Removed:
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletes.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CoalescedDeletes.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FrozenBufferedDeletes.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/ReadersAndLiveDocs.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentInfoPerCommit.java
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/codecs/ (props changed)
lucene/dev/branches/branch_4x/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextLiveDocsFormat.java
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushQueue.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/LogByteSizeMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/LogDocMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/NoMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SegmentWriteState.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (contents, props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility3x.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestConsistentFieldNumbers.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDoc.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestRollingUpdates.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java
lucene/dev/branches/branch_4x/lucene/misc/ (props changed)
lucene/dev/branches/branch_4x/lucene/misc/src/java/org/apache/lucene/index/IndexSplitter.java
lucene/dev/branches/branch_4x/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingMergePolicy.java
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/AlcoholicMergePolicy.java
lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java
lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java
lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/RandomMergePolicy.java
Modified: lucene/dev/branches/branch_4x/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextLiveDocsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextLiveDocsFormat.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextLiveDocsFormat.java (original)
+++ lucene/dev/branches/branch_4x/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextLiveDocsFormat.java Sat Nov 2 06:18:40 2013
@@ -23,7 +23,7 @@ import java.util.Collection;
import org.apache.lucene.codecs.LiveDocsFormat;
import org.apache.lucene.index.IndexFileNames;
-import org.apache.lucene.index.SegmentInfoPerCommit;
+import org.apache.lucene.index.SegmentCommitInfo;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
@@ -63,7 +63,7 @@ public class SimpleTextLiveDocsFormat ex
}
@Override
- public Bits readLiveDocs(Directory dir, SegmentInfoPerCommit info, IOContext context) throws IOException {
+ public Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws IOException {
assert info.hasDeletions();
BytesRef scratch = new BytesRef();
CharsRef scratchUTF16 = new CharsRef();
@@ -105,7 +105,7 @@ public class SimpleTextLiveDocsFormat ex
}
@Override
- public void writeLiveDocs(MutableBits bits, Directory dir, SegmentInfoPerCommit info, int newDelCount, IOContext context) throws IOException {
+ public void writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws IOException {
BitSet set = ((SimpleTextBits) bits).bits;
int size = bits.length();
BytesRef scratch = new BytesRef();
@@ -138,7 +138,7 @@ public class SimpleTextLiveDocsFormat ex
}
@Override
- public void files(SegmentInfoPerCommit info, Collection<String> files) throws IOException {
+ public void files(SegmentCommitInfo info, Collection<String> files) throws IOException {
if (info.hasDeletions()) {
files.add(IndexFileNames.fileNameFromGeneration(info.info.name, LIVEDOCS_EXTENSION, info.getDelGen()));
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java Sat Nov 2 06:18:40 2013
@@ -20,7 +20,7 @@ package org.apache.lucene.codecs;
import java.io.IOException;
import java.util.Collection;
-import org.apache.lucene.index.SegmentInfoPerCommit;
+import org.apache.lucene.index.SegmentCommitInfo;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.util.Bits;
@@ -42,13 +42,13 @@ public abstract class LiveDocsFormat {
public abstract MutableBits newLiveDocs(Bits existing) throws IOException;
/** Read live docs bits. */
- public abstract Bits readLiveDocs(Directory dir, SegmentInfoPerCommit info, IOContext context) throws IOException;
+ public abstract Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws IOException;
/** Persist live docs bits. Use {@link
- * SegmentInfoPerCommit#getNextDelGen} to determine the
+ * SegmentCommitInfo#getNextDelGen} to determine the
* generation of the deletes file you should write to. */
- public abstract void writeLiveDocs(MutableBits bits, Directory dir, SegmentInfoPerCommit info, int newDelCount, IOContext context) throws IOException;
+ public abstract void writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws IOException;
- /** Records all files in use by this {@link SegmentInfoPerCommit} into the files argument. */
- public abstract void files(SegmentInfoPerCommit info, Collection<String> files) throws IOException;
+ /** Records all files in use by this {@link SegmentCommitInfo} into the files argument. */
+ public abstract void files(SegmentCommitInfo info, Collection<String> files) throws IOException;
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java Sat Nov 2 06:18:40 2013
@@ -30,7 +30,7 @@ import org.apache.lucene.index.IndexFile
import org.apache.lucene.index.IndexFormatTooNewException;
import org.apache.lucene.index.IndexFormatTooOldException;
import org.apache.lucene.index.SegmentInfo;
-import org.apache.lucene.index.SegmentInfoPerCommit;
+import org.apache.lucene.index.SegmentCommitInfo;
import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.store.CompoundFileDirectory;
import org.apache.lucene.store.Directory;
@@ -51,7 +51,7 @@ public class Lucene3xSegmentInfoReader e
infos.counter = input.readInt(); // read counter
Lucene3xSegmentInfoReader reader = new Lucene3xSegmentInfoReader();
for (int i = input.readInt(); i > 0; i--) { // read segmentInfos
- SegmentInfoPerCommit siPerCommit = reader.readLegacySegmentInfo(directory, format, input);
+ SegmentCommitInfo siPerCommit = reader.readLegacySegmentInfo(directory, format, input);
SegmentInfo si = siPerCommit.info;
if (si.getVersion() == null) {
@@ -122,7 +122,7 @@ public class Lucene3xSegmentInfoReader e
}
/** reads from legacy 3.x segments_N */
- private SegmentInfoPerCommit readLegacySegmentInfo(Directory dir, int format, IndexInput input) throws IOException {
+ private SegmentCommitInfo readLegacySegmentInfo(Directory dir, int format, IndexInput input) throws IOException {
// check that it is a format we can understand
if (format > Lucene3xSegmentInfoFormat.FORMAT_DIAGNOSTICS) {
throw new IndexFormatTooOldException(input, format,
@@ -244,7 +244,7 @@ public class Lucene3xSegmentInfoReader e
null, diagnostics, Collections.unmodifiableMap(attributes));
info.setFiles(files);
- SegmentInfoPerCommit infoPerCommit = new SegmentInfoPerCommit(info, delCount, delGen, -1);
+ SegmentCommitInfo infoPerCommit = new SegmentCommitInfo(info, delCount, delGen, -1);
return infoPerCommit;
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java Sat Nov 2 06:18:40 2013
@@ -23,7 +23,7 @@ import java.util.Collection;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.LiveDocsFormat;
import org.apache.lucene.index.IndexFileNames;
-import org.apache.lucene.index.SegmentInfoPerCommit;
+import org.apache.lucene.index.SegmentCommitInfo;
import org.apache.lucene.store.DataOutput; // javadocs
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
@@ -85,7 +85,7 @@ public class Lucene40LiveDocsFormat exte
}
@Override
- public Bits readLiveDocs(Directory dir, SegmentInfoPerCommit info, IOContext context) throws IOException {
+ public Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws IOException {
String filename = IndexFileNames.fileNameFromGeneration(info.info.name, DELETES_EXTENSION, info.getDelGen());
final BitVector liveDocs = new BitVector(dir, filename, context);
assert liveDocs.count() == info.info.getDocCount() - info.getDelCount():
@@ -95,7 +95,7 @@ public class Lucene40LiveDocsFormat exte
}
@Override
- public void writeLiveDocs(MutableBits bits, Directory dir, SegmentInfoPerCommit info, int newDelCount, IOContext context) throws IOException {
+ public void writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws IOException {
String filename = IndexFileNames.fileNameFromGeneration(info.info.name, DELETES_EXTENSION, info.getNextDelGen());
final BitVector liveDocs = (BitVector) bits;
assert liveDocs.count() == info.info.getDocCount() - info.getDelCount() - newDelCount;
@@ -104,7 +104,7 @@ public class Lucene40LiveDocsFormat exte
}
@Override
- public void files(SegmentInfoPerCommit info, Collection<String> files) throws IOException {
+ public void files(SegmentCommitInfo info, Collection<String> files) throws IOException {
if (info.hasDeletions()) {
files.add(IndexFileNames.fileNameFromGeneration(info.info.name, DELETES_EXTENSION, info.getDelGen()));
}
Copied: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java (from r1538143, lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java?p2=lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java&p1=lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java&r1=1538143&r2=1538146&rev=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java Sat Nov 2 06:18:40 2013
@@ -51,10 +51,10 @@ import org.apache.lucene.util.InfoStream
* track which BufferedDeletes packets to apply to any given
* segment. */
-class BufferedDeletesStream { // TODO (DVU_RENAME) BufferedUpdatesStream
+class BufferedUpdatesStream {
// TODO: maybe linked list?
- private final List<FrozenBufferedDeletes> deletes = new ArrayList<FrozenBufferedDeletes>();
+ private final List<FrozenBufferedUpdates> updates = new ArrayList<FrozenBufferedUpdates>();
// Starts at 1 so that SegmentInfos that have never had
// deletes applied (whose bufferedDelGen defaults to 0)
@@ -68,13 +68,13 @@ class BufferedDeletesStream { // TODO (D
private final AtomicLong bytesUsed = new AtomicLong();
private final AtomicInteger numTerms = new AtomicInteger();
- public BufferedDeletesStream(InfoStream infoStream) {
+ public BufferedUpdatesStream(InfoStream infoStream) {
this.infoStream = infoStream;
}
// Appends a new packet of buffered deletes to the stream,
// setting its generation:
- public synchronized long push(FrozenBufferedDeletes packet) {
+ public synchronized long push(FrozenBufferedUpdates packet) {
/*
* The insert operation must be atomic. If we let threads increment the gen
* and push the packet afterwards we risk that packets are out of order.
@@ -86,19 +86,19 @@ class BufferedDeletesStream { // TODO (D
assert packet.any();
assert checkDeleteStats();
assert packet.delGen() < nextGen;
- assert deletes.isEmpty() || deletes.get(deletes.size()-1).delGen() < packet.delGen() : "Delete packets must be in order";
- deletes.add(packet);
+ assert updates.isEmpty() || updates.get(updates.size()-1).delGen() < packet.delGen() : "Delete packets must be in order";
+ updates.add(packet);
numTerms.addAndGet(packet.numTermDeletes);
bytesUsed.addAndGet(packet.bytesUsed);
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "push deletes " + packet + " delGen=" + packet.delGen() + " packetCount=" + deletes.size() + " totBytesUsed=" + bytesUsed.get());
+ infoStream.message("BD", "push deletes " + packet + " delGen=" + packet.delGen() + " packetCount=" + updates.size() + " totBytesUsed=" + bytesUsed.get());
}
assert checkDeleteStats();
return packet.delGen();
}
public synchronized void clear() {
- deletes.clear();
+ updates.clear();
nextGen = 1;
numTerms.set(0);
bytesUsed.set(0);
@@ -125,9 +125,9 @@ class BufferedDeletesStream { // TODO (D
public final long gen;
// If non-null, contains segments that are 100% deleted
- public final List<SegmentInfoPerCommit> allDeleted;
+ public final List<SegmentCommitInfo> allDeleted;
- ApplyDeletesResult(boolean anyDeletes, long gen, List<SegmentInfoPerCommit> allDeleted) {
+ ApplyDeletesResult(boolean anyDeletes, long gen, List<SegmentCommitInfo> allDeleted) {
this.anyDeletes = anyDeletes;
this.gen = gen;
this.allDeleted = allDeleted;
@@ -135,9 +135,9 @@ class BufferedDeletesStream { // TODO (D
}
// Sorts SegmentInfos from smallest to biggest bufferedDelGen:
- private static final Comparator<SegmentInfoPerCommit> sortSegInfoByDelGen = new Comparator<SegmentInfoPerCommit>() {
+ private static final Comparator<SegmentCommitInfo> sortSegInfoByDelGen = new Comparator<SegmentCommitInfo>() {
@Override
- public int compare(SegmentInfoPerCommit si1, SegmentInfoPerCommit si2) {
+ public int compare(SegmentCommitInfo si1, SegmentCommitInfo si2) {
final long cmp = si1.getBufferedDeletesGen() - si2.getBufferedDeletesGen();
if (cmp > 0) {
return 1;
@@ -152,7 +152,7 @@ class BufferedDeletesStream { // TODO (D
/** Resolves the buffered deleted Term/Query/docIDs, into
* actual deleted docIDs in the liveDocs MutableBits for
* each SegmentReader. */
- public synchronized ApplyDeletesResult applyDeletes(IndexWriter.ReaderPool readerPool, List<SegmentInfoPerCommit> infos) throws IOException {
+ public synchronized ApplyDeletesResult applyDeletesAndUpdates(IndexWriter.ReaderPool readerPool, List<SegmentCommitInfo> infos) throws IOException {
final long t0 = System.currentTimeMillis();
if (infos.size() == 0) {
@@ -169,34 +169,34 @@ class BufferedDeletesStream { // TODO (D
}
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "applyDeletes: infos=" + infos + " packetCount=" + deletes.size());
+ infoStream.message("BD", "applyDeletes: infos=" + infos + " packetCount=" + updates.size());
}
final long gen = nextGen++;
- List<SegmentInfoPerCommit> infos2 = new ArrayList<SegmentInfoPerCommit>();
+ List<SegmentCommitInfo> infos2 = new ArrayList<SegmentCommitInfo>();
infos2.addAll(infos);
Collections.sort(infos2, sortSegInfoByDelGen);
- CoalescedDeletes coalescedDeletes = null;
+ CoalescedUpdates coalescedUpdates = null;
boolean anyNewDeletes = false;
int infosIDX = infos2.size()-1;
- int delIDX = deletes.size()-1;
+ int delIDX = updates.size()-1;
- List<SegmentInfoPerCommit> allDeleted = null;
+ List<SegmentCommitInfo> allDeleted = null;
while (infosIDX >= 0) {
//System.out.println("BD: cycle delIDX=" + delIDX + " infoIDX=" + infosIDX);
- final FrozenBufferedDeletes packet = delIDX >= 0 ? deletes.get(delIDX) : null;
- final SegmentInfoPerCommit info = infos2.get(infosIDX);
+ final FrozenBufferedUpdates packet = delIDX >= 0 ? updates.get(delIDX) : null;
+ final SegmentCommitInfo info = infos2.get(infosIDX);
final long segGen = info.getBufferedDeletesGen();
if (packet != null && segGen < packet.delGen()) {
// System.out.println(" coalesce");
- if (coalescedDeletes == null) {
- coalescedDeletes = new CoalescedDeletes();
+ if (coalescedUpdates == null) {
+ coalescedUpdates = new CoalescedUpdates();
}
if (!packet.isSegmentPrivate) {
/*
@@ -206,7 +206,7 @@ class BufferedDeletesStream { // TODO (D
* its segPrivate packet (higher delGen) have been applied, the segPrivate packet has not been
* removed.
*/
- coalescedDeletes.update(packet);
+ coalescedUpdates.update(packet);
}
delIDX--;
@@ -216,17 +216,17 @@ class BufferedDeletesStream { // TODO (D
// Lock order: IW -> BD -> RP
assert readerPool.infoIsLive(info);
- final ReadersAndLiveDocs rld = readerPool.get(info, true);
+ final ReadersAndUpdates rld = readerPool.get(info, true);
final SegmentReader reader = rld.getReader(IOContext.READ);
int delCount = 0;
final boolean segAllDeletes;
try {
Map<String,NumericFieldUpdates> fieldUpdates = null;
- if (coalescedDeletes != null) {
+ if (coalescedUpdates != null) {
//System.out.println(" del coalesced");
- delCount += applyTermDeletes(coalescedDeletes.termsIterable(), rld, reader);
- delCount += applyQueryDeletes(coalescedDeletes.queriesIterable(), rld, reader);
- fieldUpdates = applyNumericDocValuesUpdates(coalescedDeletes.numericDVUpdates, rld, reader, fieldUpdates);
+ delCount += applyTermDeletes(coalescedUpdates.termsIterable(), rld, reader);
+ delCount += applyQueryDeletes(coalescedUpdates.queriesIterable(), rld, reader);
+ fieldUpdates = applyNumericDocValuesUpdates(coalescedUpdates.numericDVUpdates, rld, reader, fieldUpdates);
}
//System.out.println(" del exact");
// Don't delete by Term here; DocumentsWriterPerThread
@@ -247,17 +247,17 @@ class BufferedDeletesStream { // TODO (D
if (segAllDeletes) {
if (allDeleted == null) {
- allDeleted = new ArrayList<SegmentInfoPerCommit>();
+ allDeleted = new ArrayList<SegmentCommitInfo>();
}
allDeleted.add(info);
}
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "seg=" + info + " segGen=" + segGen + " segDeletes=[" + packet + "]; coalesced deletes=[" + (coalescedDeletes == null ? "null" : coalescedDeletes) + "] newDelCount=" + delCount + (segAllDeletes ? " 100% deleted" : ""));
+ infoStream.message("BD", "seg=" + info + " segGen=" + segGen + " segDeletes=[" + packet + "]; coalesced deletes=[" + (coalescedUpdates == null ? "null" : coalescedUpdates) + "] newDelCount=" + delCount + (segAllDeletes ? " 100% deleted" : ""));
}
- if (coalescedDeletes == null) {
- coalescedDeletes = new CoalescedDeletes();
+ if (coalescedUpdates == null) {
+ coalescedUpdates = new CoalescedUpdates();
}
/*
@@ -272,17 +272,17 @@ class BufferedDeletesStream { // TODO (D
} else {
//System.out.println(" gt");
- if (coalescedDeletes != null) {
+ if (coalescedUpdates != null) {
// Lock order: IW -> BD -> RP
assert readerPool.infoIsLive(info);
- final ReadersAndLiveDocs rld = readerPool.get(info, true);
+ final ReadersAndUpdates rld = readerPool.get(info, true);
final SegmentReader reader = rld.getReader(IOContext.READ);
int delCount = 0;
final boolean segAllDeletes;
try {
- delCount += applyTermDeletes(coalescedDeletes.termsIterable(), rld, reader);
- delCount += applyQueryDeletes(coalescedDeletes.queriesIterable(), rld, reader);
- Map<String,NumericFieldUpdates> fieldUpdates = applyNumericDocValuesUpdates(coalescedDeletes.numericDVUpdates, rld, reader, null);
+ delCount += applyTermDeletes(coalescedUpdates.termsIterable(), rld, reader);
+ delCount += applyQueryDeletes(coalescedUpdates.queriesIterable(), rld, reader);
+ Map<String,NumericFieldUpdates> fieldUpdates = applyNumericDocValuesUpdates(coalescedUpdates.numericDVUpdates, rld, reader, null);
if (!fieldUpdates.isEmpty()) {
rld.writeFieldUpdates(info.info.dir, fieldUpdates);
}
@@ -297,13 +297,13 @@ class BufferedDeletesStream { // TODO (D
if (segAllDeletes) {
if (allDeleted == null) {
- allDeleted = new ArrayList<SegmentInfoPerCommit>();
+ allDeleted = new ArrayList<SegmentCommitInfo>();
}
allDeleted.add(info);
}
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "seg=" + info + " segGen=" + segGen + " coalesced deletes=[" + coalescedDeletes + "] newDelCount=" + delCount + (segAllDeletes ? " 100% deleted" : ""));
+ infoStream.message("BD", "seg=" + info + " segGen=" + segGen + " coalesced deletes=[" + coalescedUpdates + "] newDelCount=" + delCount + (segAllDeletes ? " 100% deleted" : ""));
}
}
info.setBufferedDeletesGen(gen);
@@ -332,16 +332,16 @@ class BufferedDeletesStream { // TODO (D
public synchronized void prune(SegmentInfos segmentInfos) {
assert checkDeleteStats();
long minGen = Long.MAX_VALUE;
- for(SegmentInfoPerCommit info : segmentInfos) {
+ for(SegmentCommitInfo info : segmentInfos) {
minGen = Math.min(info.getBufferedDeletesGen(), minGen);
}
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "prune sis=" + segmentInfos + " minGen=" + minGen + " packetCount=" + deletes.size());
+ infoStream.message("BD", "prune sis=" + segmentInfos + " minGen=" + minGen + " packetCount=" + updates.size());
}
- final int limit = deletes.size();
+ final int limit = updates.size();
for(int delIDX=0;delIDX<limit;delIDX++) {
- if (deletes.get(delIDX).delGen() >= minGen) {
+ if (updates.get(delIDX).delGen() >= minGen) {
prune(delIDX);
assert checkDeleteStats();
return;
@@ -357,21 +357,21 @@ class BufferedDeletesStream { // TODO (D
private synchronized void prune(int count) {
if (count > 0) {
if (infoStream.isEnabled("BD")) {
- infoStream.message("BD", "pruneDeletes: prune " + count + " packets; " + (deletes.size() - count) + " packets remain");
+ infoStream.message("BD", "pruneDeletes: prune " + count + " packets; " + (updates.size() - count) + " packets remain");
}
for(int delIDX=0;delIDX<count;delIDX++) {
- final FrozenBufferedDeletes packet = deletes.get(delIDX);
+ final FrozenBufferedUpdates packet = updates.get(delIDX);
numTerms.addAndGet(-packet.numTermDeletes);
assert numTerms.get() >= 0;
bytesUsed.addAndGet(-packet.bytesUsed);
assert bytesUsed.get() >= 0;
}
- deletes.subList(0, count).clear();
+ updates.subList(0, count).clear();
}
}
// Delete by Term
- private synchronized long applyTermDeletes(Iterable<Term> termsIter, ReadersAndLiveDocs rld, SegmentReader reader) throws IOException {
+ private synchronized long applyTermDeletes(Iterable<Term> termsIter, ReadersAndUpdates rld, SegmentReader reader) throws IOException {
long delCount = 0;
Fields fields = reader.fields();
if (fields == null) {
@@ -446,7 +446,7 @@ class BufferedDeletesStream { // TODO (D
// NumericDocValues Updates
// If otherFieldUpdates != null, we need to merge the updates into them
private synchronized Map<String,NumericFieldUpdates> applyNumericDocValuesUpdates(Iterable<NumericUpdate> updates,
- ReadersAndLiveDocs rld, SegmentReader reader, Map<String,NumericFieldUpdates> otherFieldUpdates) throws IOException {
+ ReadersAndUpdates rld, SegmentReader reader, Map<String,NumericFieldUpdates> otherFieldUpdates) throws IOException {
Fields fields = reader.fields();
if (fields == null) {
// This reader has no postings
@@ -534,7 +534,7 @@ class BufferedDeletesStream { // TODO (D
}
// Delete by query
- private static long applyQueryDeletes(Iterable<QueryAndLimit> queriesIter, ReadersAndLiveDocs rld, final SegmentReader reader) throws IOException {
+ private static long applyQueryDeletes(Iterable<QueryAndLimit> queriesIter, ReadersAndUpdates rld, final SegmentReader reader) throws IOException {
long delCount = 0;
final AtomicReaderContext readerContext = reader.getContext();
boolean any = false;
@@ -581,7 +581,7 @@ class BufferedDeletesStream { // TODO (D
private boolean checkDeleteStats() {
int numTerms2 = 0;
long bytesUsed2 = 0;
- for(FrozenBufferedDeletes packet : deletes) {
+ for(FrozenBufferedUpdates packet : updates) {
numTerms2 += packet.numTermDeletes;
bytesUsed2 += packet.bytesUsed;
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java Sat Nov 2 06:18:40 2013
@@ -404,7 +404,7 @@ public class CheckIndex {
String oldSegs = null;
boolean foundNonNullVersion = false;
Comparator<String> versionComparator = StringHelper.getVersionComparator();
- for (SegmentInfoPerCommit si : sis) {
+ for (SegmentCommitInfo si : sis) {
String version = si.info.getVersion();
if (version == null) {
// pre-3.1 segment
@@ -498,7 +498,7 @@ public class CheckIndex {
result.maxSegmentName = -1;
for(int i=0;i<numSegments;i++) {
- final SegmentInfoPerCommit info = sis.info(i);
+ final SegmentCommitInfo info = sis.info(i);
int segmentName = Integer.parseInt(info.info.name.substring(1), Character.MAX_RADIX);
if (segmentName > result.maxSegmentName) {
result.maxSegmentName = segmentName;
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java Sat Nov 2 06:18:40 2013
@@ -136,7 +136,7 @@ final class DocumentsWriter {
flushPolicy = config.getFlushPolicy();
this.writer = writer;
this.events = new ConcurrentLinkedQueue<Event>();
- flushControl = new DocumentsWriterFlushControl(this, config, writer.bufferedDeletesStream);
+ flushControl = new DocumentsWriterFlushControl(this, config, writer.bufferedUpdatesStream);
}
synchronized boolean deleteQueries(final Query... queries) throws IOException {
@@ -323,7 +323,7 @@ final class DocumentsWriter {
}
public int getBufferedDeleteTermsSize() {
- return deleteQueue.getBufferedDeleteTermsSize();
+ return deleteQueue.getBufferedUpdatesTermsSize();
}
//for testing
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java Sat Nov 2 06:18:40 2013
@@ -39,7 +39,7 @@ import org.apache.lucene.search.Query;
* single linked the garbage collector takes care of pruning the list for us.
* All nodes in the list that are still relevant should be either directly or
* indirectly referenced by one of the DWPT's private {@link DeleteSlice} or by
- * the global {@link BufferedDeletes} slice.
+ * the global {@link BufferedUpdates} slice.
* <p>
* Each DWPT as well as the global delete pool maintain their private
* DeleteSlice instance. In the DWPT case updating a slice is equivalent to
@@ -52,7 +52,7 @@ import org.apache.lucene.search.Query;
* <li>updates its private {@link DeleteSlice} either by calling
* {@link #updateSlice(DeleteSlice)} or {@link #add(Term, DeleteSlice)} (if the
* document has a delTerm)</li>
- * <li>applies all deletes in the slice to its private {@link BufferedDeletes}
+ * <li>applies all deletes in the slice to its private {@link BufferedUpdates}
* and resets it</li>
* <li>increments its internal document id</li>
* </ol>
@@ -72,7 +72,7 @@ final class DocumentsWriterDeleteQueue {
.newUpdater(DocumentsWriterDeleteQueue.class, Node.class, "tail");
private final DeleteSlice globalSlice;
- private final BufferedDeletes globalBufferedDeletes;
+ private final BufferedUpdates globalBufferedUpdates;
/* only acquired to update the global deletes */
private final ReentrantLock globalBufferLock = new ReentrantLock();
@@ -83,11 +83,11 @@ final class DocumentsWriterDeleteQueue {
}
DocumentsWriterDeleteQueue(long generation) {
- this(new BufferedDeletes(), generation);
+ this(new BufferedUpdates(), generation);
}
- DocumentsWriterDeleteQueue(BufferedDeletes globalBufferedDeletes, long generation) {
- this.globalBufferedDeletes = globalBufferedDeletes;
+ DocumentsWriterDeleteQueue(BufferedUpdates globalBufferedUpdates, long generation) {
+ this.globalBufferedUpdates = globalBufferedUpdates;
this.generation = generation;
/*
* we use a sentinel instance as our initial tail. No slice will ever try to
@@ -177,9 +177,9 @@ final class DocumentsWriterDeleteQueue {
/*
* check if all items in the global slice were applied
* and if the global slice is up-to-date
- * and if globalBufferedDeletes has changes
+ * and if globalBufferedUpdates has changes
*/
- return globalBufferedDeletes.any() || !globalSlice.isEmpty() || globalSlice.sliceTail != tail
+ return globalBufferedUpdates.any() || !globalSlice.isEmpty() || globalSlice.sliceTail != tail
|| tail.next != null;
} finally {
globalBufferLock.unlock();
@@ -197,7 +197,7 @@ final class DocumentsWriterDeleteQueue {
try {
if (updateSlice(globalSlice)) {
// System.out.println(Thread.currentThread() + ": apply globalSlice");
- globalSlice.apply(globalBufferedDeletes, BufferedDeletes.MAX_INT);
+ globalSlice.apply(globalBufferedUpdates, BufferedUpdates.MAX_INT);
}
} finally {
globalBufferLock.unlock();
@@ -205,7 +205,7 @@ final class DocumentsWriterDeleteQueue {
}
}
- FrozenBufferedDeletes freezeGlobalBuffer(DeleteSlice callerSlice) {
+ FrozenBufferedUpdates freezeGlobalBuffer(DeleteSlice callerSlice) {
globalBufferLock.lock();
/*
* Here we freeze the global buffer so we need to lock it, apply all
@@ -222,13 +222,13 @@ final class DocumentsWriterDeleteQueue {
try {
if (globalSlice.sliceTail != currentTail) {
globalSlice.sliceTail = currentTail;
- globalSlice.apply(globalBufferedDeletes, BufferedDeletes.MAX_INT);
+ globalSlice.apply(globalBufferedUpdates, BufferedUpdates.MAX_INT);
}
// System.out.println(Thread.currentThread().getName() + ": now freeze global buffer " + globalBufferedDeletes);
- final FrozenBufferedDeletes packet = new FrozenBufferedDeletes(
- globalBufferedDeletes, false);
- globalBufferedDeletes.clear();
+ final FrozenBufferedUpdates packet = new FrozenBufferedUpdates(
+ globalBufferedUpdates, false);
+ globalBufferedUpdates.clear();
return packet;
} finally {
globalBufferLock.unlock();
@@ -262,7 +262,7 @@ final class DocumentsWriterDeleteQueue {
sliceHead = sliceTail = currentTail;
}
- void apply(BufferedDeletes del, int docIDUpto) {
+ void apply(BufferedUpdates del, int docIDUpto) {
if (sliceHead == sliceTail) {
// 0 length slice
return;
@@ -302,7 +302,7 @@ final class DocumentsWriterDeleteQueue {
}
public int numGlobalTermDeletes() {
- return globalBufferedDeletes.numTermDeletes.get();
+ return globalBufferedUpdates.numTermDeletes.get();
}
void clear() {
@@ -310,7 +310,7 @@ final class DocumentsWriterDeleteQueue {
try {
final Node<?> currentTail = tail;
globalSlice.sliceHead = globalSlice.sliceTail = currentTail;
- globalBufferedDeletes.clear();
+ globalBufferedUpdates.clear();
} finally {
globalBufferLock.unlock();
}
@@ -328,7 +328,7 @@ final class DocumentsWriterDeleteQueue {
static final AtomicReferenceFieldUpdater<Node,Node> nextUpdater = AtomicReferenceFieldUpdater
.newUpdater(Node.class, Node.class, "next");
- void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
+ void apply(BufferedUpdates bufferedDeletes, int docIDUpto) {
throw new IllegalStateException("sentinel item must never be applied");
}
@@ -344,7 +344,7 @@ final class DocumentsWriterDeleteQueue {
}
@Override
- void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
+ void apply(BufferedUpdates bufferedDeletes, int docIDUpto) {
bufferedDeletes.addTerm(item, docIDUpto);
}
@@ -360,9 +360,9 @@ final class DocumentsWriterDeleteQueue {
}
@Override
- void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
+ void apply(BufferedUpdates bufferedUpdates, int docIDUpto) {
for (Query query : item) {
- bufferedDeletes.addQuery(query, docIDUpto);
+ bufferedUpdates.addQuery(query, docIDUpto);
}
}
}
@@ -373,9 +373,9 @@ final class DocumentsWriterDeleteQueue {
}
@Override
- void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
+ void apply(BufferedUpdates bufferedUpdates, int docIDUpto) {
for (Term term : item) {
- bufferedDeletes.addTerm(term, docIDUpto);
+ bufferedUpdates.addTerm(term, docIDUpto);
}
}
@@ -392,8 +392,8 @@ final class DocumentsWriterDeleteQueue {
}
@Override
- void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
- bufferedDeletes.addNumericUpdate(item, docIDUpto);
+ void apply(BufferedUpdates bufferedUpdates, int docIDUpto) {
+ bufferedUpdates.addNumericUpdate(item, docIDUpto);
}
@Override
@@ -408,26 +408,26 @@ final class DocumentsWriterDeleteQueue {
try {
if (globalSlice.sliceTail != currentTail) {
globalSlice.sliceTail = currentTail;
- globalSlice.apply(globalBufferedDeletes, BufferedDeletes.MAX_INT);
+ globalSlice.apply(globalBufferedUpdates, BufferedUpdates.MAX_INT);
}
- return globalBufferedDeletes.any();
+ return globalBufferedUpdates.any();
} finally {
globalBufferLock.unlock();
}
}
- public int getBufferedDeleteTermsSize() {
+ public int getBufferedUpdatesTermsSize() {
globalBufferLock.lock();
try {
forceApplyGlobalSlice();
- return globalBufferedDeletes.terms.size();
+ return globalBufferedUpdates.terms.size();
} finally {
globalBufferLock.unlock();
}
}
public long bytesUsed() {
- return globalBufferedDeletes.bytesUsed.get();
+ return globalBufferedUpdates.bytesUsed.get();
}
@Override
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java Sat Nov 2 06:18:40 2013
@@ -68,10 +68,10 @@ final class DocumentsWriterFlushControl
private boolean closed = false;
private final DocumentsWriter documentsWriter;
private final LiveIndexWriterConfig config;
- private final BufferedDeletesStream bufferedDeletesStream;
+ private final BufferedUpdatesStream bufferedUpdatesStream;
private final InfoStream infoStream;
- DocumentsWriterFlushControl(DocumentsWriter documentsWriter, LiveIndexWriterConfig config, BufferedDeletesStream bufferedDeletesStream) {
+ DocumentsWriterFlushControl(DocumentsWriter documentsWriter, LiveIndexWriterConfig config, BufferedUpdatesStream bufferedUpdatesStream) {
this.infoStream = config.getInfoStream();
this.stallControl = new DocumentsWriterStallControl();
this.perThreadPool = documentsWriter.perThreadPool;
@@ -79,7 +79,7 @@ final class DocumentsWriterFlushControl
this.config = config;
this.hardMaxBytesPerDWPT = config.getRAMPerThreadHardLimitMB() * 1024 * 1024;
this.documentsWriter = documentsWriter;
- this.bufferedDeletesStream = bufferedDeletesStream;
+ this.bufferedUpdatesStream = bufferedUpdatesStream;
}
public synchronized long activeBytes() {
@@ -418,11 +418,11 @@ final class DocumentsWriterFlushControl
* Returns the number of delete terms in the global pool
*/
public int getNumGlobalTermDeletes() {
- return documentsWriter.deleteQueue.numGlobalTermDeletes() + bufferedDeletesStream.numTerms();
+ return documentsWriter.deleteQueue.numGlobalTermDeletes() + bufferedUpdatesStream.numTerms();
}
public long getDeleteBytesUsed() {
- return documentsWriter.deleteQueue.bytesUsed() + bufferedDeletesStream.bytesUsed();
+ return documentsWriter.deleteQueue.bytesUsed() + bufferedUpdatesStream.bytesUsed();
}
synchronized int numFlushingDWPT() {
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushQueue.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushQueue.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushQueue.java Sat Nov 2 06:18:40 2013
@@ -164,12 +164,12 @@ class DocumentsWriterFlushQueue {
}
static abstract class FlushTicket {
- protected FrozenBufferedDeletes frozenDeletes;
+ protected FrozenBufferedUpdates frozenUpdates;
protected boolean published = false;
- protected FlushTicket(FrozenBufferedDeletes frozenDeletes) {
- assert frozenDeletes != null;
- this.frozenDeletes = frozenDeletes;
+ protected FlushTicket(FrozenBufferedUpdates frozenUpdates) {
+ assert frozenUpdates != null;
+ this.frozenUpdates = frozenUpdates;
}
protected abstract void publish(IndexWriter writer) throws IOException;
@@ -181,51 +181,51 @@ class DocumentsWriterFlushQueue {
* publishing operation is synced on IW -> BDS so that the {@link SegmentInfo}'s
* delete generation is always GlobalPacket_deleteGeneration + 1
*/
- protected final void publishFlushedSegment(IndexWriter indexWriter, FlushedSegment newSegment, FrozenBufferedDeletes globalPacket)
+ protected final void publishFlushedSegment(IndexWriter indexWriter, FlushedSegment newSegment, FrozenBufferedUpdates globalPacket)
throws IOException {
assert newSegment != null;
assert newSegment.segmentInfo != null;
- final FrozenBufferedDeletes segmentDeletes = newSegment.segmentDeletes;
+ final FrozenBufferedUpdates segmentUpdates = newSegment.segmentUpdates;
//System.out.println("FLUSH: " + newSegment.segmentInfo.info.name);
if (indexWriter.infoStream.isEnabled("DW")) {
- indexWriter.infoStream.message("DW", "publishFlushedSegment seg-private deletes=" + segmentDeletes);
+ indexWriter.infoStream.message("DW", "publishFlushedSegment seg-private updates=" + segmentUpdates);
}
- if (segmentDeletes != null && indexWriter.infoStream.isEnabled("DW")) {
- indexWriter.infoStream.message("DW", "flush: push buffered seg private deletes: " + segmentDeletes);
+ if (segmentUpdates != null && indexWriter.infoStream.isEnabled("DW")) {
+ indexWriter.infoStream.message("DW", "flush: push buffered seg private updates: " + segmentUpdates);
}
// now publish!
- indexWriter.publishFlushedSegment(newSegment.segmentInfo, segmentDeletes, globalPacket);
+ indexWriter.publishFlushedSegment(newSegment.segmentInfo, segmentUpdates, globalPacket);
}
- protected final void finishFlush(IndexWriter indexWriter, FlushedSegment newSegment, FrozenBufferedDeletes bufferedDeletes)
+ protected final void finishFlush(IndexWriter indexWriter, FlushedSegment newSegment, FrozenBufferedUpdates bufferedUpdates)
throws IOException {
// Finish the flushed segment and publish it to IndexWriter
if (newSegment == null) {
- assert bufferedDeletes != null;
- if (bufferedDeletes != null && bufferedDeletes.any()) {
- indexWriter.publishFrozenDeletes(bufferedDeletes);
+ assert bufferedUpdates != null;
+ if (bufferedUpdates != null && bufferedUpdates.any()) {
+ indexWriter.publishFrozenUpdates(bufferedUpdates);
if (indexWriter.infoStream.isEnabled("DW")) {
- indexWriter.infoStream.message("DW", "flush: push buffered deletes: " + bufferedDeletes);
+ indexWriter.infoStream.message("DW", "flush: push buffered updates: " + bufferedUpdates);
}
}
} else {
- publishFlushedSegment(indexWriter, newSegment, bufferedDeletes);
+ publishFlushedSegment(indexWriter, newSegment, bufferedUpdates);
}
}
}
static final class GlobalDeletesTicket extends FlushTicket {
- protected GlobalDeletesTicket(FrozenBufferedDeletes frozenDeletes) {
- super(frozenDeletes);
+ protected GlobalDeletesTicket(FrozenBufferedUpdates frozenUpdates) {
+ super(frozenUpdates);
}
@Override
protected void publish(IndexWriter writer) throws IOException {
assert !published : "ticket was already publised - can not publish twice";
published = true;
// its a global ticket - no segment to publish
- finishFlush(writer, null, frozenDeletes);
+ finishFlush(writer, null, frozenUpdates);
}
@Override
@@ -238,7 +238,7 @@ class DocumentsWriterFlushQueue {
private FlushedSegment segment;
private boolean failed = false;
- protected SegmentFlushTicket(FrozenBufferedDeletes frozenDeletes) {
+ protected SegmentFlushTicket(FrozenBufferedUpdates frozenDeletes) {
super(frozenDeletes);
}
@@ -246,7 +246,7 @@ class DocumentsWriterFlushQueue {
protected void publish(IndexWriter writer) throws IOException {
assert !published : "ticket was already publised - can not publish twice";
published = true;
- finishFlush(writer, segment, frozenDeletes);
+ finishFlush(writer, segment, frozenUpdates);
}
protected void setSegment(FlushedSegment segment) {
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java Sat Nov 2 06:18:40 2013
@@ -124,17 +124,17 @@ class DocumentsWriterPerThread {
}
static class FlushedSegment {
- final SegmentInfoPerCommit segmentInfo;
+ final SegmentCommitInfo segmentInfo;
final FieldInfos fieldInfos;
- final FrozenBufferedDeletes segmentDeletes;
+ final FrozenBufferedUpdates segmentUpdates;
final MutableBits liveDocs;
final int delCount;
- private FlushedSegment(SegmentInfoPerCommit segmentInfo, FieldInfos fieldInfos,
- BufferedDeletes segmentDeletes, MutableBits liveDocs, int delCount) {
+ private FlushedSegment(SegmentCommitInfo segmentInfo, FieldInfos fieldInfos,
+ BufferedUpdates segmentUpdates, MutableBits liveDocs, int delCount) {
this.segmentInfo = segmentInfo;
this.fieldInfos = fieldInfos;
- this.segmentDeletes = segmentDeletes != null && segmentDeletes.any() ? new FrozenBufferedDeletes(segmentDeletes, true) : null;
+ this.segmentUpdates = segmentUpdates != null && segmentUpdates.any() ? new FrozenBufferedUpdates(segmentUpdates, true) : null;
this.liveDocs = liveDocs;
this.delCount = delCount;
}
@@ -156,7 +156,7 @@ class DocumentsWriterPerThread {
} catch (Throwable t) {
}
- pendingDeletes.clear();
+ pendingUpdates.clear();
createdFiles.addAll(directory.getCreatedFiles());
} finally {
aborting = false;
@@ -174,8 +174,8 @@ class DocumentsWriterPerThread {
final Counter bytesUsed;
SegmentWriteState flushState;
- // Deletes for our still-in-RAM (to be flushed next) segment
- final BufferedDeletes pendingDeletes;
+ // Updates for our still-in-RAM (to be flushed next) segment
+ final BufferedUpdates pendingUpdates;
private final SegmentInfo segmentInfo; // Current segment we are working on
boolean aborting = false; // True if an abort is pending
boolean hasAborted = false; // True if the last exception throws by #updateDocument was aborting
@@ -203,11 +203,11 @@ class DocumentsWriterPerThread {
this.docState.similarity = indexWriterConfig.getSimilarity();
bytesUsed = Counter.newCounter();
byteBlockAllocator = new DirectTrackingAllocator(bytesUsed);
- pendingDeletes = new BufferedDeletes();
+ pendingUpdates = new BufferedUpdates();
intBlockAllocator = new IntBlockAllocator(bytesUsed);
this.deleteQueue = deleteQueue;
assert numDocsInRAM == 0 : "num docs " + numDocsInRAM;
- pendingDeletes.clear();
+ pendingUpdates.clear();
deleteSlice = deleteQueue.newSlice();
segmentInfo = new SegmentInfo(directoryOrig, Constants.LUCENE_MAIN_VERSION, segmentName, -1, false, codec, null);
@@ -329,7 +329,7 @@ class DocumentsWriterPerThread {
if (delTerm != null) {
deleteQueue.add(delTerm, deleteSlice);
assert deleteSlice.isTailItem(delTerm) : "expected the delete term as the tail item";
- deleteSlice.apply(pendingDeletes, numDocsInRAM-docCount);
+ deleteSlice.apply(pendingUpdates, numDocsInRAM-docCount);
}
} finally {
@@ -367,7 +367,7 @@ class DocumentsWriterPerThread {
}
if (applySlice) {
- deleteSlice.apply(pendingDeletes, numDocsInRAM);
+ deleteSlice.apply(pendingUpdates, numDocsInRAM);
} else { // if we don't need to apply we must reset!
deleteSlice.reset();
}
@@ -377,7 +377,7 @@ class DocumentsWriterPerThread {
// Buffer a specific docID for deletion. Currently only
// used when we hit an exception when adding a document
void deleteDocID(int docIDUpto) {
- pendingDeletes.addDocID(docIDUpto);
+ pendingUpdates.addDocID(docIDUpto);
// NOTE: we do not trigger flush here. This is
// potentially a RAM leak, if you have an app that tries
// to add docs but every single doc always hits a
@@ -394,7 +394,7 @@ class DocumentsWriterPerThread {
*/
public int numDeleteTerms() {
// public for FlushPolicy
- return pendingDeletes.numTermDeletes.get();
+ return pendingUpdates.numTermDeletes.get();
}
/**
@@ -411,18 +411,18 @@ class DocumentsWriterPerThread {
* {@link DocumentsWriterDeleteQueue}s global buffer and apply all pending
* deletes to this DWPT.
*/
- FrozenBufferedDeletes prepareFlush() {
+ FrozenBufferedUpdates prepareFlush() {
assert numDocsInRAM > 0;
- final FrozenBufferedDeletes globalDeletes = deleteQueue.freezeGlobalBuffer(deleteSlice);
+ final FrozenBufferedUpdates globalUpdates = deleteQueue.freezeGlobalBuffer(deleteSlice);
/* deleteSlice can possibly be null if we have hit non-aborting exceptions during indexing and never succeeded
adding a document. */
if (deleteSlice != null) {
// apply all deletes before we flush and release the delete slice
- deleteSlice.apply(pendingDeletes, numDocsInRAM);
+ deleteSlice.apply(pendingUpdates, numDocsInRAM);
assert deleteSlice.isEmpty();
deleteSlice.reset();
}
- return globalDeletes;
+ return globalUpdates;
}
/** Flush all pending docs to a new segment */
@@ -432,20 +432,20 @@ class DocumentsWriterPerThread {
segmentInfo.setDocCount(numDocsInRAM);
final SegmentWriteState flushState = new SegmentWriteState(infoStream, directory, segmentInfo, fieldInfos.finish(),
indexWriterConfig.getTermIndexInterval(),
- pendingDeletes, new IOContext(new FlushInfo(numDocsInRAM, bytesUsed())));
+ pendingUpdates, new IOContext(new FlushInfo(numDocsInRAM, bytesUsed())));
final double startMBUsed = bytesUsed() / 1024. / 1024.;
// Apply delete-by-docID now (delete-byDocID only
// happens when an exception is hit processing that
// doc, eg if analyzer has some problem w/ the text):
- if (pendingDeletes.docIDs.size() > 0) {
+ if (pendingUpdates.docIDs.size() > 0) {
flushState.liveDocs = codec.liveDocsFormat().newLiveDocs(numDocsInRAM);
- for(int delDocID : pendingDeletes.docIDs) {
+ for(int delDocID : pendingUpdates.docIDs) {
flushState.liveDocs.clear(delDocID);
}
- flushState.delCountOnFlush = pendingDeletes.docIDs.size();
- pendingDeletes.bytesUsed.addAndGet(-pendingDeletes.docIDs.size() * BufferedDeletes.BYTES_PER_DEL_DOCID);
- pendingDeletes.docIDs.clear();
+ flushState.delCountOnFlush = pendingUpdates.docIDs.size();
+ pendingUpdates.bytesUsed.addAndGet(-pendingUpdates.docIDs.size() * BufferedUpdates.BYTES_PER_DEL_DOCID);
+ pendingUpdates.docIDs.clear();
}
if (aborting) {
@@ -463,10 +463,10 @@ class DocumentsWriterPerThread {
try {
consumer.flush(flushState);
- pendingDeletes.terms.clear();
+ pendingUpdates.terms.clear();
segmentInfo.setFiles(new HashSet<String>(directory.getCreatedFiles()));
- final SegmentInfoPerCommit segmentInfoPerCommit = new SegmentInfoPerCommit(segmentInfo, 0, -1L, -1L);
+ final SegmentCommitInfo segmentInfoPerCommit = new SegmentCommitInfo(segmentInfo, 0, -1L, -1L);
if (infoStream.isEnabled("DWPT")) {
infoStream.message("DWPT", "new segment has " + (flushState.liveDocs == null ? 0 : (flushState.segmentInfo.getDocCount() - flushState.delCountOnFlush)) + " deleted docs");
infoStream.message("DWPT", "new segment has " +
@@ -479,12 +479,12 @@ class DocumentsWriterPerThread {
infoStream.message("DWPT", "flushed codec=" + codec);
}
- final BufferedDeletes segmentDeletes;
- if (pendingDeletes.queries.isEmpty() && pendingDeletes.numericUpdates.isEmpty()) {
- pendingDeletes.clear();
+ final BufferedUpdates segmentDeletes;
+ if (pendingUpdates.queries.isEmpty() && pendingUpdates.numericUpdates.isEmpty()) {
+ pendingUpdates.clear();
segmentDeletes = null;
} else {
- segmentDeletes = pendingDeletes;
+ segmentDeletes = pendingUpdates;
}
if (infoStream.isEnabled("DWPT")) {
@@ -522,7 +522,7 @@ class DocumentsWriterPerThread {
void sealFlushedSegment(FlushedSegment flushedSegment) throws IOException {
assert flushedSegment != null;
- SegmentInfoPerCommit newSegment = flushedSegment.segmentInfo;
+ SegmentCommitInfo newSegment = flushedSegment.segmentInfo;
IndexWriter.setDiagnostics(newSegment.info, IndexWriter.SOURCE_FLUSH);
@@ -564,7 +564,7 @@ class DocumentsWriterPerThread {
// carry the changes; there's no reason to use
// filesystem as intermediary here.
- SegmentInfoPerCommit info = flushedSegment.segmentInfo;
+ SegmentCommitInfo info = flushedSegment.segmentInfo;
Codec codec = info.info.getCodec();
codec.liveDocsFormat().writeLiveDocs(flushedSegment.liveDocs, directory, info, delCount, context);
newSegment.setDelCount(delCount);
@@ -588,7 +588,7 @@ class DocumentsWriterPerThread {
}
long bytesUsed() {
- return bytesUsed.get() + pendingDeletes.bytesUsed.get();
+ return bytesUsed.get() + pendingUpdates.bytesUsed.get();
}
/* Initial chunks size of the shared byte[] blocks used to
@@ -626,7 +626,7 @@ class DocumentsWriterPerThread {
@Override
public String toString() {
- return "DocumentsWriterPerThread [pendingDeletes=" + pendingDeletes
+ return "DocumentsWriterPerThread [pendingDeletes=" + pendingUpdates
+ ", segment=" + (segmentInfo != null ? segmentInfo.name : "null") + ", aborting=" + aborting + ", numDocsInRAM="
+ numDocsInRAM + ", deleteQueue=" + deleteQueue + "]";
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java?rev=1538146&r1=1538145&r2=1538146&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java Sat Nov 2 06:18:40 2013
@@ -365,8 +365,8 @@ final class FreqProxTermsWriterPerField
assert !writeOffsets || writePositions;
final Map<Term,Integer> segDeletes;
- if (state.segDeletes != null && state.segDeletes.terms.size() > 0) {
- segDeletes = state.segDeletes.terms;
+ if (state.segUpdates != null && state.segUpdates.terms.size() > 0) {
+ segDeletes = state.segUpdates.terms;
} else {
segDeletes = null;
}