Search in sources :

Example 1 with OSBTreeCollectionManagerShared

use of com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManagerShared in project orientdb by orientechnologies.

the class SBTreeBagDeleteTest method testDeleteRidbagTx.

@Test
public void testDeleteRidbagTx() {
    ODocument doc = new ODocument();
    ORidBag bag = new ORidBag();
    int size = OGlobalConfiguration.INDEX_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.getValueAsInteger() * 2;
    for (int i = 0; i < size; i++) bag.add(new ORecordId(10, i));
    doc.field("bag", bag);
    ORID id = db.save(doc).getIdentity();
    bag = doc.field("bag");
    OBonsaiCollectionPointer pointer = bag.getPointer();
    db.begin();
    db.delete(doc);
    db.commit();
    doc = db.load(id);
    assertNull(doc);
    ((OSBTreeCollectionManagerShared) db.getSbTreeCollectionManager()).clear();
    OSBTreeBonsai<OIdentifiable, Integer> tree = db.getSbTreeCollectionManager().loadSBTree(pointer);
    assertNull(tree);
}
Also used : OBonsaiCollectionPointer(com.orientechnologies.orient.core.db.record.ridbag.sbtree.OBonsaiCollectionPointer) ORidBag(com.orientechnologies.orient.core.db.record.ridbag.ORidBag) ORID(com.orientechnologies.orient.core.id.ORID) OSBTreeCollectionManagerShared(com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManagerShared) OIdentifiable(com.orientechnologies.orient.core.db.record.OIdentifiable) ORecordId(com.orientechnologies.orient.core.id.ORecordId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Example 2 with OSBTreeCollectionManagerShared

use of com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManagerShared in project orientdb by orientechnologies.

the class SBTreeBagDeleteTest method testDeleteRidbagNoTx.

@Test
public void testDeleteRidbagNoTx() {
    ODocument doc = new ODocument();
    ORidBag bag = new ORidBag();
    int size = OGlobalConfiguration.INDEX_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.getValueAsInteger() * 2;
    for (int i = 0; i < size; i++) bag.add(new ORecordId(10, i));
    doc.field("bag", bag);
    ORID id = db.save(doc).getIdentity();
    bag = doc.field("bag");
    OBonsaiCollectionPointer pointer = bag.getPointer();
    db.delete(doc);
    doc = db.load(id);
    assertNull(doc);
    ((OSBTreeCollectionManagerShared) db.getSbTreeCollectionManager()).clear();
    OSBTreeBonsai<OIdentifiable, Integer> tree = db.getSbTreeCollectionManager().loadSBTree(pointer);
    assertNull(tree);
}
Also used : OBonsaiCollectionPointer(com.orientechnologies.orient.core.db.record.ridbag.sbtree.OBonsaiCollectionPointer) ORidBag(com.orientechnologies.orient.core.db.record.ridbag.ORidBag) ORID(com.orientechnologies.orient.core.id.ORID) OSBTreeCollectionManagerShared(com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManagerShared) OIdentifiable(com.orientechnologies.orient.core.db.record.OIdentifiable) ORecordId(com.orientechnologies.orient.core.id.ORecordId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Aggregations

OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)2 ORidBag (com.orientechnologies.orient.core.db.record.ridbag.ORidBag)2 OBonsaiCollectionPointer (com.orientechnologies.orient.core.db.record.ridbag.sbtree.OBonsaiCollectionPointer)2 OSBTreeCollectionManagerShared (com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManagerShared)2 ORID (com.orientechnologies.orient.core.id.ORID)2 ORecordId (com.orientechnologies.orient.core.id.ORecordId)2 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)2 Test (org.junit.Test)2