use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.
the class RocksDBStore method commitTx.
@Override
public void commitTx() {
Lock readLock = this.storeLock.readLock();
readLock.lock();
try {
this.checkOpened();
// Unable to guarantee atomicity when committing multi sessions
for (Session session : this.session()) {
Object count = session.commit();
if (LOG.isDebugEnabled()) {
LOG.debug("Store {} committed {} items", this.store, count);
}
}
} finally {
readLock.unlock();
}
}
use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.
the class RocksDBStore method rollbackTx.
@Override
public void rollbackTx() {
Lock readLock = this.storeLock.readLock();
readLock.lock();
try {
this.checkOpened();
for (Session session : this.session()) {
session.rollback();
}
} finally {
readLock.unlock();
}
}
use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.
the class RocksDBStore method beginTx.
@Override
public void beginTx() {
Lock readLock = this.storeLock.readLock();
readLock.lock();
try {
this.checkOpened();
for (Session session : this.session()) {
assert !session.hasChanges();
}
} finally {
readLock.unlock();
}
}
use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.
the class RocksDBStore method mutate.
@Override
public void mutate(BackendMutation mutation) {
Lock readLock = this.storeLock.readLock();
readLock.lock();
try {
this.checkOpened();
if (LOG.isDebugEnabled()) {
LOG.debug("Store {} mutation: {}", this.store, mutation);
}
for (HugeType type : mutation.types()) {
Session session = this.session(type);
for (Iterator<BackendAction> it = mutation.mutation(type); it.hasNext(); ) {
this.mutate(session, it.next());
}
}
} finally {
readLock.unlock();
}
}
use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.
the class RocksDBPerfTest method testMultiGet3Keys.
@Test
public void testMultiGet3Keys() throws RocksDBException {
put("person:1gname", "James");
put("person:1gage", "19");
put("person:1gcity", "Beijing");
put("person:2gname", "Lisa");
put("person:2gage", "20");
put("person:2gcity", "Beijing");
Session session = this.rocks.session();
BackendColumnIterator iter;
for (int i = 0; i < TIMES; i++) {
List<byte[]> keys = Arrays.asList(getBytes("person:1gname"), getBytes("person:1gage"), getBytes("person:1gcity"));
iter = session.get(TABLE, keys);
iter.next();
iter.next();
iter.next();
}
}
Aggregations