Search in sources :

Example 6 with ObjectDataType

use of org.h2.mvstore.type.ObjectDataType in project h2database by h2database.

the class TestMVStore method testLargeImport.

private void testLargeImport() {
    String fileName = getBaseDir() + "/" + getTestName();
    FileUtils.delete(fileName);
    int len = 1000;
    for (int j = 0; j < 5; j++) {
        FileUtils.delete(fileName);
        MVStore s = openStore(fileName, 40);
        MVMap<Integer, Object[]> m = s.openMap("data", new MVMap.Builder<Integer, Object[]>().valueType(new RowDataType(new DataType[] { new ObjectDataType(), StringDataType.INSTANCE, StringDataType.INSTANCE })));
        // long t = System.nanoTime();
        for (int i = 0; i < len; ) {
            Object[] o = new Object[3];
            o[0] = i;
            o[1] = "Hello World";
            o[2] = "World";
            m.put(i, o);
            i++;
            if (i % 10000 == 0) {
                s.commit();
            }
        }
        s.close();
    // System.out.println(prof.getTop(5));
    // System.out.println("store time " +
    // TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t));
    // System.out.println("store size " +
    // FileUtils.size(fileName));
    }
}
Also used : MVStore(org.h2.mvstore.MVStore) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ObjectDataType(org.h2.mvstore.type.ObjectDataType)

Aggregations

ObjectDataType (org.h2.mvstore.type.ObjectDataType)6 Random (java.util.Random)2 MVStore (org.h2.mvstore.MVStore)2 WriteBuffer (org.h2.mvstore.WriteBuffer)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 ByteBuffer (java.nio.ByteBuffer)1 Timestamp (java.sql.Timestamp)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 UUID (java.util.UUID)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 MVMap (org.h2.mvstore.MVMap)1 TransactionStore (org.h2.mvstore.db.TransactionStore)1 Transaction (org.h2.mvstore.db.TransactionStore.Transaction)1 Task (org.h2.util.Task)1