DocumentsWriterDeleteQueue

DocumentsWriterDeleteQueue is a non-blocking linked pending deletes queue. In contrast to other queue implementation we only maintain the tail of the queue. A delete queue is always used in a context of a set of DWPTs and a global delete pool. Each of the DWPT and the global pool need to maintain their 'own' head of the queue (as a DeleteSlice instance per [ ]). The difference between the DWPT and the global pool is that the DWPT starts maintaining a head once it has added its first document since for its segments private deletes only the deletes after that document are relevant. The global pool instead starts maintaining the head once this instance is created by taking the sentinel instance as its initial head.

Since each DeleteSlice maintains its own head and the list is only 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 [ ] or by the global BufferedUpdates slice.

Each DWPT as well as the global delete pool maintain their private DeleteSlice instance. In the DWPT case updating a slice is equivalent to atomically finishing the document. The slice update guarantees a "happens before" relationship to all other updates in the same indexing session. When a DWPT updates a document it:

  1. consumes a document and finishes its processing

  2. updates its private DeleteSlice either by calling .updateSlice or .add (if the document has a delTerm)

  3. applies all deletes in the slice to its private BufferedUpdates and resets it

  4. increments its internal document id

The DWPT also doesn't apply its current documents delete term until it has updated its delete slice which ensures the consistency of the update. If the update fails before the DeleteSlice could have been updated the deleteTerm will also not be added to its private deletes neither to the global deletes.

Constructors

Link copied to clipboard
constructor(infoStream: InfoStream)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard
open class Node<T>(val item: T)

Properties

Link copied to clipboard
Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the maximum sequence number for this queue. This value will change once this queue is advanced.

Link copied to clipboard

Functions

Link copied to clipboard

invariant for document update

Link copied to clipboard
fun addDelete(vararg terms: Term): Long
fun addDelete(vararg queries: Query): Long
Link copied to clipboard
Link copied to clipboard

Advances the queue to the next queue on flush. This carries over the generation to the next queue and set the .getMaxSeqNo based on the given maxNumPendingOps. This method can only be called once, subsequently the returned queue should be used.

Link copied to clipboard
Link copied to clipboard
fun clear()
Link copied to clipboard
open override fun close()
Link copied to clipboard

This may freeze the global buffer unless the delete queue has already been closed. If the queue has been closed this method will return null

Link copied to clipboard
Link copied to clipboard

For test purposes.

Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard

Inserts a gap in the sequence numbers. This is used by IW during flush or commit to ensure any in-flight threads get sequence numbers inside the gap

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
Link copied to clipboard

Negative result means there were new deletes since we last applied

Link copied to clipboard

Just like updateSlice, but does not assign a sequence number