Class BlockBalancedTreePostingsWriter
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.bbtree.BlockBalancedTreePostingsWriter
Writes leaf postings and auxiliary posting lists for bbtree nodes. If a node has a posting list attached,
it will contain every row id from all leaves reachable from that node.
Writer is stateful, because it needs to collect data from the balanced tree data structure first to find set of eligible nodes and leaf nodes reachable from them.
The leaf blocks are written in value order (in the order we pass them to the BlockBalancedTreeWriter).
This allows us to skip reading the leaves, instead just order leaf blocks by their offset in the index file,
and correlate them with buffered posting lists.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongfinish(IndexOutputWriter out, List<org.apache.lucene.util.packed.PackedLongValues> leafPostings, IndexIdentifier indexIdentifier) Writes merged posting lists for eligible internal nodes and leaf postings for each leaf in the tree.voidonLeaf(int leafNodeID, long leafBlockFP, org.agrona.collections.IntArrayList pathToRoot) Called when a leaf node is hit as we traverse the packed index.
-
Constructor Details
-
BlockBalancedTreePostingsWriter
public BlockBalancedTreePostingsWriter()
-
-
Method Details
-
onLeaf
public void onLeaf(int leafNodeID, long leafBlockFP, org.agrona.collections.IntArrayList pathToRoot) Called when a leaf node is hit as we traverse the packed index.- Parameters:
leafNodeID- the current leaf node ID in the packed indedleafBlockFP- the file pointer to the on-disk leaf blockpathToRoot- the path to the root leaf above this leaf. Contains all the intermediate leaf node IDs.
-
finish
public long finish(IndexOutputWriter out, List<org.apache.lucene.util.packed.PackedLongValues> leafPostings, IndexIdentifier indexIdentifier) throws IOException Writes merged posting lists for eligible internal nodes and leaf postings for each leaf in the tree. The merged postings list for an internal node contains all postings from the postings lists of leaf nodes in the subtree rooted at that node.After writing out the postings, it writes a map of node ID -> postings file pointer for all nodes with an attached postings list. It then returns the file pointer to this map.
- Throws:
IOException
-