java.lang.Object
org.apache.lucene.index.PendingDeletes
- Direct Known Subclasses:
PendingSoftDeletes
This class handles accounting and applying pending deletes for live segment readers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SegmentCommitInfo
private Bits
(package private) boolean
protected int
private FixedBitSet
-
Constructor Summary
ConstructorsConstructorDescriptionPendingDeletes
(SegmentCommitInfo info, Bits liveDocs, boolean liveDocsInitialized) PendingDeletes
(SegmentReader reader, SegmentCommitInfo info) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
assertCheckLiveDocs
(Bits bits, int expectedLength, int expectedDeleteCount) (package private) boolean
delete
(int docID) Marks a document as deleted in this segment and return true if a document got actually deleted or if the document was already deleted.(package private) void
Resets the pending docs(package private) final int
Returns the number of deleted docs in the segment.(package private) Bits
Returns a snapshot of the hard live docs.(package private) Bits
Returns a snapshot of the current live docs.protected FixedBitSet
(package private) boolean
isFullyDeleted
(IOSupplier<CodecReader> readerIOSupplier) Returnstrue
iff the segment represented by thisPendingDeletes
is fully deleted(package private) boolean
Returnstrue
if we have to initialize this PendingDeletes beforedelete(int)
; otherwise this PendingDeletes is ready to accept deletes.(package private) final boolean
needsRefresh
(CodecReader reader) Returns true if the given reader needs to be refreshed in order to see the latest deletes(package private) int
numDeletesToMerge
(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier) (package private) final int
numDocs()
Returns the number of live documents in this segmentprotected int
Returns the number of pending deletes that are not written to disk.(package private) void
onDocValuesUpdate
(FieldInfo info, DocValuesFieldUpdates.Iterator iterator) Called for every field update for the given field at flush time(package private) void
onNewReader
(CodecReader reader, SegmentCommitInfo info) Called once a new reader is opened for this segment ie.toString()
(package private) boolean
verifyDocCounts
(CodecReader reader) (package private) boolean
writeLiveDocs
(Directory dir) Writes the live docs to disk and returnstrue
if any new docs were written.
-
Field Details
-
info
-
liveDocs
-
writeableLiveDocs
-
pendingDeleteCount
protected int pendingDeleteCount -
liveDocsInitialized
boolean liveDocsInitialized
-
-
Constructor Details
-
PendingDeletes
PendingDeletes(SegmentReader reader, SegmentCommitInfo info) -
PendingDeletes
PendingDeletes(SegmentCommitInfo info) -
PendingDeletes
PendingDeletes(SegmentCommitInfo info, Bits liveDocs, boolean liveDocsInitialized)
-
-
Method Details
-
getMutableBits
-
delete
Marks a document as deleted in this segment and return true if a document got actually deleted or if the document was already deleted.- Throws:
IOException
-
getLiveDocs
Bits getLiveDocs()Returns a snapshot of the current live docs. -
getHardLiveDocs
Bits getHardLiveDocs()Returns a snapshot of the hard live docs. -
numPendingDeletes
protected int numPendingDeletes()Returns the number of pending deletes that are not written to disk. -
onNewReader
Called once a new reader is opened for this segment ie. when deletes or updates are applied.- Throws:
IOException
-
assertCheckLiveDocs
-
dropChanges
void dropChanges()Resets the pending docs -
toString
-
writeLiveDocs
Writes the live docs to disk and returnstrue
if any new docs were written.- Throws:
IOException
-
isFullyDeleted
Returnstrue
iff the segment represented by thisPendingDeletes
is fully deleted- Throws:
IOException
-
onDocValuesUpdate
Called for every field update for the given field at flush time- Parameters:
info
- the field info of the field that's updatediterator
- the values to apply- Throws:
IOException
-
numDeletesToMerge
int numDeletesToMerge(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier) throws IOException - Throws:
IOException
-
needsRefresh
Returns true if the given reader needs to be refreshed in order to see the latest deletes -
getDelCount
final int getDelCount()Returns the number of deleted docs in the segment. -
numDocs
final int numDocs()Returns the number of live documents in this segment -
verifyDocCounts
-
mustInitOnDelete
boolean mustInitOnDelete()Returnstrue
if we have to initialize this PendingDeletes beforedelete(int)
; otherwise this PendingDeletes is ready to accept deletes. A PendingDeletes can be initialized by providing it a reader viaonNewReader(CodecReader, SegmentCommitInfo)
.
-