Search in sources :

Example 26 with Session

use of com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session in project incubator-hugegraph by apache.

the class RocksDBPerfTest method testScanByPrefixAfterUpdate.

@Test
public void testScanByPrefixAfterUpdate() throws RocksDBException {
    Session session = this.rocks.session();
    this.testUpdate();
    int n = 1000;
    // 30w
    int queryTimes = 300;
    for (int j = 0; j < queryTimes; j++) {
        for (int i = 0; i < n; i++) {
            String key = String.format("index:%3d", i);
            Iterator<BackendColumn> iter = session.scan(TABLE, getBytes(key));
            while (iter.hasNext()) {
                iter.next();
            }
        }
    }
}
Also used : BackendColumn(com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn) Session(com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session) Test(org.junit.Test)

Aggregations

Session (com.baidu.hugegraph.backend.store.rocksdb.RocksDBSessions.Session)26 Test (org.junit.Test)21 BackendColumn (com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn)9 BaseUnitTest (com.baidu.hugegraph.unit.BaseUnitTest)8 HashMap (java.util.HashMap)6 Lock (java.util.concurrent.locks.Lock)5 ReadWriteLock (java.util.concurrent.locks.ReadWriteLock)5 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)5 Id (com.baidu.hugegraph.backend.id.Id)2 HugeType (com.baidu.hugegraph.type.HugeType)2 ByteBuffer (java.nio.ByteBuffer)2 Query (com.baidu.hugegraph.backend.query.Query)1 MergeIterator (com.baidu.hugegraph.backend.serializer.MergeIterator)1 BackendAction (com.baidu.hugegraph.backend.store.BackendAction)1 BackendEntry (com.baidu.hugegraph.backend.store.BackendEntry)1 BackendColumnIterator (com.baidu.hugegraph.backend.store.BackendEntry.BackendColumnIterator)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Random (java.util.Random)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1