Hi Aayush,

Here are some code snippets maybe help.

org.apache.jena.tdb2.store.StorageTDB

/** Delete a tuple */
public void delete( Tuple<NodeId> t ) {
    if ( tupleLen != t.len() )
        throw new TDBException(format("Mismatch: deleting tuple of length %d 
from a table of tuples of length %d", t.len(), tupleLen));

    for ( TupleIndex index : indexes ) {
        if ( index == null )
            continue;
        index.delete( t );
    }
}

org.apache.jena.tdb2.store.tupletable.TupleTable


/** Delete a tuple */
public void delete( Tuple<NodeId> t ) {
    if ( tupleLen != t.len() )
        throw new TDBException(format("Mismatch: deleting tuple of length %d 
from a table of tuples of length %d", t.len(), tupleLen));

    for ( TupleIndex index : indexes ) {
        if ( index == null )
            continue;
        index.delete( t );
    }
}

org.apache.jena.tdb2.store.tupletable.TupleIndexRecord

@Override
protected void performDelete(Tuple<NodeId> tuple) {
    Record r = TupleLib.record(factory, tuple, tupleMap);
    index.delete(r);
}

org.apache.jena.dboe.trans.bplustree.BPlusTree

public boolean delete(Record record) {
    return this.deleteAndReturnOld(record) != null;
}

public Record deleteAndReturnOld(Record record) {
    this.startUpdateBlkMgr();
    BPTreeNode root = this.getRootWrite();
    Record r = BPTreeNode.delete(root, record);
    this.releaseRootWrite(root);
    this.finishUpdateBlkMgr();
    return r;
}





> On Jan 13, 2022, at 2:33 PM, Aayush Yadav <[email protected]> wrote:
> 
> Hi,
> 
> I just had a query regarding how JENA handles deleted nodes in TDB2? I read
> in the documentation and even saw while implementing, that the nodes that
> are deleted are not removed from storage until compact is run. So how are
> these nodes handled exactly? By handled I mean, how does compact know which
> nodes to delete from storage, and how does running select all skip these
> triples?
> 
> Any insights on this or if anyone could point to which file in the Jena
> code too look into, might help.
> 
> Thanks,
> Aayush.

Reply via email to