Hi,

I've encountered a BufferOverflowException using MVStore when stuffing a 
load of xml files into a store. It only seems to occur with a specific 
number of writes of various sizes. I've distilled the test case down about 
as far as I can.

Can you please check if it breaks for you.

I've using the a build of the latest SVN trunk.

The exception is:

java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
at java.nio.ByteBuffer.put(ByteBuffer.java:832)
at org.h2.mvstore.WriteBuffer.put(WriteBuffer.java:158)
at 
org.h2.mvstore.type.ObjectDataType$ObjectArrayType.write(ObjectDataType.java:1350)
at org.h2.mvstore.type.ObjectDataType.write(ObjectDataType.java:114)
at org.h2.mvstore.Page.write(Page.java:819)
at org.h2.mvstore.Page.writeUnsavedRecursive(Page.java:878)
at org.h2.mvstore.Page.writeUnsavedRecursive(Page.java:873)
at org.h2.mvstore.Page.writeUnsavedRecursive(Page.java:873)
at org.h2.mvstore.MVStore.storeNow(MVStore.java:882)
at org.h2.mvstore.MVStore.commitAndSave(MVStore.java:811)
at org.h2.mvstore.MVStore.commit(MVStore.java:772)
at ajr.h2mvstore.StoreTest3.writeTest(StoreTest3.java:31)

Test case below.

Thanks,

Andrew





package ajr.h2mvstore;

import java.io.File;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.MVStore;
import org.junit.Test;

public class StoreTest3
{
    int[] fileSizes = new 
int[]{1973187,1977133,1976605,160876,160941,160941,161014,160958,159042,158976,151795,150083,155193,155330,155330,1969571,153294,153294,153357,151395,151395,151476,151458,149495,149500,149495,149500,149532,29960,17080,17087,17093,147784,147595,147595,147595,147595,147716,17088,16872,15933,15928,145819,138512,138640,138582,14830,14600,28573,16596,137033,136957,53663,53684,53637,53648,136615,136615,136724,42123,42138,42197,42197,140201,134712,134712,134714,138126,138126,136303,136309,129405,134342,134342,129207,127157,127157,127157,127266,127265,127284,127270,127271,125254,125255,125316,125278,125276,125316,123547,128657,127182,127232,127041,127091,121471,121471,746087,746203,124882,124958,121355,117875,122983,122982,123110,123005,115346,115346,115346,115346,115346,115346,115346,115346,115346,115346,115346,115346,115346,115345,115346,15840,15836,15840,15836,15839,15839,15834,15834,121286,121286,121286,121286,121286,121286,121286,121286,121285,121285,121285,121286,121285,48875,119391,119391,119391,119391,119391,119391,119391,119391,119391,119389,40607,39414,15874,15872,15874,117499,117565,117499,14620,14619,115601,115614,115614,115614,115614,115614,115614,115614,115614,115614,115614,15837,15834,15837,15834,163185,161874,113718,113718,113718,113718,113718,113718,113718,113718,113718,69385,111815,111831,111832,111831,111832,111832,111832,111881,68161,68183,109917,16865,42831,109933,109933,109933,14604,14604,107829,107830,107830,107829,107830,14676,16560,16557,106119,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,100634,200082,199999,14615,49014,98747,98747,98747,98747,98746,98747,98747,98747,98747,98747,98747,98747};

    @Test
    public void writeTest()
    {
        String file = "StoreTest.mvs";
        new File(file).delete();
        MVStore store = new MVStore.Builder().fileName(file).open();

        MVMap<String, byte[]> map = store.openMap("data");

        int i = 0;
        for(int fileSize: fileSizes) {
            byte[] data = new byte[fileSize];
            String key = "key"+i;
            map.put(key, data);
            i++;
            //System.out.println(i + " - " + fileSize);
        }
        store.commit();
        store.close();
    }
}


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to