final class BufferedUpdatesStream extends java.lang.Object implements Accountable
FrozenBufferedUpdates
.
When DocumentsWriterPerThread flushes, its buffered
deletes and updates are appended to this stream and immediately
resolved (to actual docIDs, per segment) using the indexing
thread that triggered the flush for concurrency. When a
merge kicks off, we sync to ensure all resolving packets
complete. We also apply to all segments when NRT reader is pulled,
commit/close is called, or when too many deletes or updates are
buffered and must be flushed (by RAM usage or by count).
Each packet is assigned a generation, and each flushed or
merged segment is also assigned a generation, so we can
track which BufferedDeletes packets to apply to any given
segment.Modifier and Type | Class and Description |
---|---|
(package private) static class |
BufferedUpdatesStream.ApplyDeletesResult |
private static class |
BufferedUpdatesStream.FinishedSegments
Tracks the contiguous range of packets that have finished resolving.
|
(package private) static class |
BufferedUpdatesStream.SegmentState
Holds all per-segment internal state used while resolving deletions.
|
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicLong |
bytesUsed |
private BufferedUpdatesStream.FinishedSegments |
finishedSegments |
private InfoStream |
infoStream |
private long |
nextGen |
private java.util.concurrent.atomic.AtomicInteger |
numTerms |
private java.util.Set<FrozenBufferedUpdates> |
updates |
Constructor and Description |
---|
BufferedUpdatesStream(InfoStream infoStream) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
any() |
private boolean |
checkDeleteStats() |
(package private) void |
clear()
Only used by IW.rollback
|
(package private) void |
finished(FrozenBufferedUpdates packet)
Called by indexing threads once they are fully done resolving all deletes for the provided
delGen.
|
(package private) void |
finishedSegment(long delGen) |
(package private) long |
getCompletedDelGen()
All frozen packets up to and including this del gen are guaranteed to be finished.
|
(package private) long |
getNextGen() |
(package private) int |
getPendingUpdatesCount() |
(package private) int |
numTerms() |
(package private) long |
push(FrozenBufferedUpdates packet) |
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
(package private) boolean |
stillRunning(long delGen)
Returns true if this delGen is still running.
|
private void |
waitApply(java.util.Set<FrozenBufferedUpdates> waitFor,
IndexWriter writer) |
(package private) void |
waitApplyAll(IndexWriter writer)
Waits for all in-flight packets, which are already being resolved concurrently
by indexing threads, to finish.
|
(package private) void |
waitApplyForMerge(java.util.List<SegmentCommitInfo> mergeInfos,
IndexWriter writer)
Waits only for those in-flight packets that apply to these merge segments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources
private final java.util.Set<FrozenBufferedUpdates> updates
private long nextGen
private final BufferedUpdatesStream.FinishedSegments finishedSegments
private final InfoStream infoStream
private final java.util.concurrent.atomic.AtomicLong bytesUsed
private final java.util.concurrent.atomic.AtomicInteger numTerms
BufferedUpdatesStream(InfoStream infoStream)
long push(FrozenBufferedUpdates packet)
int getPendingUpdatesCount()
void clear()
boolean any()
int numTerms()
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
void waitApplyAll(IndexWriter writer) throws java.io.IOException
java.io.IOException
boolean stillRunning(long delGen)
void finishedSegment(long delGen)
void finished(FrozenBufferedUpdates packet)
long getCompletedDelGen()
void waitApplyForMerge(java.util.List<SegmentCommitInfo> mergeInfos, IndexWriter writer) throws java.io.IOException
java.io.IOException
private void waitApply(java.util.Set<FrozenBufferedUpdates> waitFor, IndexWriter writer) throws java.io.IOException
java.io.IOException
long getNextGen()
private boolean checkDeleteStats()