- java.lang.Object
-
- org.apache.lucene.index.FrozenBufferedUpdates
-
final class FrozenBufferedUpdates extends java.lang.Object
Holds buffered deletes and updates by term or query, once pushed. Pushed deletes/updates are write-once, so we shift to more memory efficient data structure to hold them. We don't hold docIDs because these are applied on flush.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
FrozenBufferedUpdates.TermDocsIterator
This class helps iterating a term dictionary and consuming all the docs for each terms.
-
Field Summary
Fields Modifier and Type Field Description java.util.concurrent.CountDownLatch
applied
Counts down once all deletes/updates have been appliedprivate java.util.concurrent.locks.ReentrantLock
applyLock
(package private) static int
BYTES_PER_DEL_QUERY
(package private) int
bytesUsed
(package private) Query[]
deleteQueries
(package private) int[]
deleteQueryLimits
(package private) PrefixCodedTerms
deleteTerms
private long
delGen
private java.util.Map<java.lang.String,FieldUpdatesBuffer>
fieldUpdates
private int
fieldUpdatesCount
private InfoStream
infoStream
(package private) SegmentCommitInfo
privateSegment
long
totalDelCount
How many total documents were deleted/updated.
-
Constructor Summary
Constructors Constructor Description FrozenBufferedUpdates(InfoStream infoStream, BufferedUpdates updates, SegmentCommitInfo privateSegment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
any()
(package private) long
apply(BufferedUpdatesStream.SegmentState[] segStates)
Applies pending delete-by-term, delete-by-query and doc values updates to all segments in the index, returning the number of new deleted or updated documents.private long
applyDocValuesUpdates(BufferedUpdatesStream.SegmentState[] segStates)
private static long
applyDocValuesUpdates(BufferedUpdatesStream.SegmentState segState, java.util.Map<java.lang.String,FieldUpdatesBuffer> updates, long delGen, boolean segmentPrivateDeletes)
private long
applyQueryDeletes(BufferedUpdatesStream.SegmentState[] segStates)
private long
applyTermDeletes(BufferedUpdatesStream.SegmentState[] segStates)
long
delGen()
(package private) boolean
isApplied()
Returns true iff this buffered updates instance was already applied(package private) void
lock()
locks this buffered update instancevoid
setDelGen(long delGen)
java.lang.String
toString()
(package private) boolean
tryLock()
Tries to lock this buffered update instance(package private) void
unlock()
Releases the lock of this buffered update instance
-
-
-
Field Detail
-
BYTES_PER_DEL_QUERY
static final int BYTES_PER_DEL_QUERY
-
deleteTerms
final PrefixCodedTerms deleteTerms
-
deleteQueries
final Query[] deleteQueries
-
deleteQueryLimits
final int[] deleteQueryLimits
-
applied
public final java.util.concurrent.CountDownLatch applied
Counts down once all deletes/updates have been applied
-
applyLock
private final java.util.concurrent.locks.ReentrantLock applyLock
-
fieldUpdates
private final java.util.Map<java.lang.String,FieldUpdatesBuffer> fieldUpdates
-
totalDelCount
public long totalDelCount
How many total documents were deleted/updated.
-
fieldUpdatesCount
private final int fieldUpdatesCount
-
bytesUsed
final int bytesUsed
-
delGen
private long delGen
-
privateSegment
final SegmentCommitInfo privateSegment
-
infoStream
private final InfoStream infoStream
-
-
Constructor Detail
-
FrozenBufferedUpdates
public FrozenBufferedUpdates(InfoStream infoStream, BufferedUpdates updates, SegmentCommitInfo privateSegment)
-
-
Method Detail
-
tryLock
boolean tryLock()
Tries to lock this buffered update instance- Returns:
- true if the lock was successfully acquired. otherwise false.
-
lock
void lock()
locks this buffered update instance
-
unlock
void unlock()
Releases the lock of this buffered update instance
-
isApplied
boolean isApplied()
Returns true iff this buffered updates instance was already applied
-
apply
long apply(BufferedUpdatesStream.SegmentState[] segStates) throws java.io.IOException
Applies pending delete-by-term, delete-by-query and doc values updates to all segments in the index, returning the number of new deleted or updated documents.- Throws:
java.io.IOException
-
applyDocValuesUpdates
private long applyDocValuesUpdates(BufferedUpdatesStream.SegmentState[] segStates) throws java.io.IOException
- Throws:
java.io.IOException
-
applyDocValuesUpdates
private static long applyDocValuesUpdates(BufferedUpdatesStream.SegmentState segState, java.util.Map<java.lang.String,FieldUpdatesBuffer> updates, long delGen, boolean segmentPrivateDeletes) throws java.io.IOException
- Throws:
java.io.IOException
-
applyQueryDeletes
private long applyQueryDeletes(BufferedUpdatesStream.SegmentState[] segStates) throws java.io.IOException
- Throws:
java.io.IOException
-
applyTermDeletes
private long applyTermDeletes(BufferedUpdatesStream.SegmentState[] segStates) throws java.io.IOException
- Throws:
java.io.IOException
-
setDelGen
public void setDelGen(long delGen)
-
delGen
public long delGen()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
any
boolean any()
-
-