java.lang.Object
org.apache.lucene.index.ReadersAndUpdates
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classThis class merges the current on-disk DV with an incoming update DV instance and merges the two instances giving the incoming update precedence in terms of values, in other words the values of the update always wins over the on-disk version. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int(package private) final SegmentCommitInfoprivate booleanprivate final Map<String, List<DocValuesFieldUpdates>> private final PendingDeletesprivate final Map<String, List<DocValuesFieldUpdates>> (package private) final AtomicLongprivate SegmentReaderprivate final AtomicInteger(package private) Sorter.DocMap -
Constructor Summary
ConstructorsConstructorDescriptionReadersAndUpdates(int indexCreatedVersionMajor, SegmentCommitInfo info, PendingDeletes pendingDeletes) ReadersAndUpdates(int indexCreatedVersionMajor, SegmentReader reader, PendingDeletes pendingDeletes) Init from a previously opened SegmentReader. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDVUpdate(DocValuesFieldUpdates update) Adds a new resolved (meaning it maps docIDs to new values) doc values packet.private booleanassertNoDupGen(List<DocValuesFieldUpdates> fieldUpdates, DocValuesFieldUpdates update) private FieldInfocloneFieldInfo(FieldInfo fi, int fieldNumber) private SegmentReadervoiddecRef()booleandelete(int docID) voidvoidDrops all merging updates.voidintReturns the live-docs bits excluding documents that are not live due to soft-deletesprivate CodecReaderReturns a snapshot of the live docs.longReturns aSegmentReader.(package private) MergePolicy.MergeReadergetReaderForMerge(IOContext context, IOConsumer<MergePolicy.MergeReader> readerConsumer) Returns a reader for merge, with the latest doc values updates and deletions.getReadOnlyClone(IOContext context) Returns a ref to a clone.private voidhandleDVUpdates(FieldInfos infos, Directory dir, DocValuesFormat dvFormat, SegmentReader reader, Map<Integer, Set<String>> fieldFiles, long maxDelGen, InfoStream infoStream) voidincRef()boolean(package private) boolean(package private) booleankeepFullyDeletedSegment(MergePolicy mergePolicy) (package private) intnumDeletesToMerge(MergePolicy policy) intrefCount()voidrelease(SegmentReader sr) (package private) voidprivate voidtoString()writeFieldInfosGen(FieldInfos fieldInfos, Directory dir, FieldInfosFormat infosFormat) booleanwriteFieldUpdates(Directory dir, FieldInfos.FieldNumbers fieldNumbers, long maxDelGen, InfoStream infoStream) booleanwriteLiveDocs(Directory dir)
-
Field Details
-
info
-
refCount
-
reader
-
pendingDeletes
-
indexCreatedVersionMajor
private final int indexCreatedVersionMajor -
isMerging
private boolean isMerging -
pendingDVUpdates
-
mergingDVUpdates
-
sortMap
Sorter.DocMap sortMap -
ramBytesUsed
-
-
Constructor Details
-
ReadersAndUpdates
ReadersAndUpdates(int indexCreatedVersionMajor, SegmentCommitInfo info, PendingDeletes pendingDeletes) -
ReadersAndUpdates
ReadersAndUpdates(int indexCreatedVersionMajor, SegmentReader reader, PendingDeletes pendingDeletes) throws IOException Init from a previously opened SegmentReader.NOTE: steals incoming ref from reader.
- Throws:
IOException
-
-
Method Details
-
incRef
public void incRef() -
decRef
public void decRef() -
refCount
public int refCount() -
getDelCount
public int getDelCount() -
assertNoDupGen
private boolean assertNoDupGen(List<DocValuesFieldUpdates> fieldUpdates, DocValuesFieldUpdates update) -
addDVUpdate
Adds a new resolved (meaning it maps docIDs to new values) doc values packet. We buffer these in RAM and write to disk when too much RAM is used or when a merge needs to kick off, or a commit/refresh.- Throws:
IOException
-
getNumDVUpdates
public long getNumDVUpdates() -
getReader
Returns aSegmentReader.- Throws:
IOException
-
release
- Throws:
IOException
-
delete
- Throws:
IOException
-
dropReaders
- Throws:
IOException
-
getReadOnlyClone
Returns a ref to a clone. NOTE: you should decRef() the reader when you're done (ie do not call close()).- Throws:
IOException
-
numDeletesToMerge
- Throws:
IOException
-
getLatestReader
- Throws:
IOException
-
getLiveDocs
Returns a snapshot of the live docs. -
getHardLiveDocs
Returns the live-docs bits excluding documents that are not live due to soft-deletes -
dropChanges
public void dropChanges() -
writeLiveDocs
- Throws:
IOException
-
handleDVUpdates
private void handleDVUpdates(FieldInfos infos, Directory dir, DocValuesFormat dvFormat, SegmentReader reader, Map<Integer, Set<String>> fieldFiles, long maxDelGen, InfoStream infoStream) throws IOException- Throws:
IOException
-
writeFieldInfosGen
private Set<String> writeFieldInfosGen(FieldInfos fieldInfos, Directory dir, FieldInfosFormat infosFormat) throws IOException - Throws:
IOException
-
writeFieldUpdates
public boolean writeFieldUpdates(Directory dir, FieldInfos.FieldNumbers fieldNumbers, long maxDelGen, InfoStream infoStream) throws IOException - Throws:
IOException
-
cloneFieldInfo
-
createNewReaderWithLatestLiveDocs
- Throws:
IOException
-
swapNewReaderWithLatestLiveDocs
- Throws:
IOException
-
setIsMerging
void setIsMerging() -
isMerging
boolean isMerging() -
getReaderForMerge
MergePolicy.MergeReader getReaderForMerge(IOContext context, IOConsumer<MergePolicy.MergeReader> readerConsumer) throws IOException Returns a reader for merge, with the latest doc values updates and deletions.- Throws:
IOException
-
dropMergingUpdates
public void dropMergingUpdates()Drops all merging updates. Called from IndexWriter after this segment finished merging (whether successfully or not). -
getMergingDVUpdates
-
toString
-
isFullyDeleted
- Throws:
IOException
-
keepFullyDeletedSegment
- Throws:
IOException
-