Search in sources :

Example 1 with PrimitiveLongArrayQueue

use of org.neo4j.collection.PrimitiveLongArrayQueue in project neo4j by neo4j.

the class GBPTreeGenericCountsStore method updateTxIdInformationInTree.

private void updateTxIdInformationInTree(OutOfOrderSequence.Snapshot txIdSnapshot, CursorContext cursorContext) throws IOException {
    PrimitiveLongArrayQueue strayIds = new PrimitiveLongArrayQueue();
    visitStrayTxIdsInTree(strayIds::enqueue, cursorContext);
    try (Writer<CountsKey, CountsValue> writer = tree.unsafeWriter(cursorContext)) {
        // First clear all the stray ids from the previous checkpoint
        CountsValue value = new CountsValue();
        while (!strayIds.isEmpty()) {
            long strayTxId = strayIds.dequeue();
            writer.remove(strayTxId(strayTxId));
        }
        // And write all stray txIds into the tree
        value.initialize(0);
        long[][] strayTxIds = txIdSnapshot.idsOutOfOrder();
        for (long[] strayTxId : strayTxIds) {
            long txId = strayTxId[0];
            writer.put(strayTxId(txId), value);
        }
    }
}
Also used : PrimitiveLongArrayQueue(org.neo4j.collection.PrimitiveLongArrayQueue)

Aggregations

PrimitiveLongArrayQueue (org.neo4j.collection.PrimitiveLongArrayQueue)1