Hi,

I found and fixed the problem now. It wasn't a concurrency problem at all
(although I did fix a potential concurrency issue as well). The problem was
the same page could be freed up twice, which ended up with a negative fill
ratio for the chunk. This is fixed now in the trunk.

By the way, the reason why it doesn't show up earlier is that the problem
only appeared when the background thread was compacting, and this is done
after 45 seconds (so that data in the file is not overwritten for 45
seconds). This is done for added data protection in case of power failure
and to avoid having to call fsync, see also
http://stackoverflow.com/questions/13650134/after-how-many-seconds-are-file-system-write-buffers-typically-flushed-
but for testing you could change it using
MVStore.setRetentionTime(1000).

Regards,
Thomas



On Tue, Jul 16, 2013 at 7:03 PM, Thomas Mueller <
[email protected]> wrote:

> Hi,
>
> Thanks a lot! Yes, I can reproduce the problem now. I guess it is related
> to concurrency, but I'm not completely sure; I will check. Also annoying is
> that the error is only written to the .trace.db file, but not in the main
> thread, so the error is hidden; I will change this as well.
>
> Regards,
> Thomas
>
>
>
> On Tue, Jul 16, 2013 at 4:11 PM, Nicolas Fortin (OrbisGIS) <
> [email protected]> wrote:
>
>> Hi Thomas,
>>
>> Even with your last MVStore I still have the corruption issue:
>>
>> The following branch is the merge of your last change and my last changes:
>> https://github.com/nicolas-f/h2database/tree/h2-spatial
>>
>> The last unsaved page count is now 687 instead of 688 but a trace file is
>> created:
>>
>>> 07-16 16:08:53 database: flush
>>> java.lang.IllegalStateException: Corrupt page count -1 [1.3.172/3]
>>>     at
>>> org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:691)
>>>     at org.h2.mvstore.MVStore.applyFreedPages(MVStore.java:1034)
>>>     at org.h2.mvstore.MVStore.store(MVStore.java:900)
>>>     at org.h2.mvstore.MVStore.beforeWrite(MVStore.java:1524)
>>>     at org.h2.mvstore.MVMap.beforeWrite(MVMap.java:930)
>>>     at org.h2.mvstore.MVMap.remove(MVMap.java:545)
>>>     at org.h2.mvstore.MVStore.copyLive(MVStore.java:1268)
>>>     at org.h2.mvstore.MVStore.compact(MVStore.java:1228)
>>>     at
>>> org.h2.mvstore.db.MVTableEngine$Store.store(MVTableEngine.java:162)
>>>     at org.h2.engine.Database.flush(Database.java:1821)
>>>
>>>     at org.h2.store.WriterThread.run(WriterThread.java:87)
>>>     at java.lang.Thread.run(Thread.java:662)
>>>
>>
>> Best regards,
>>
>> -Nicolas Fortin
>> GIS Workshop
>> IRSTV FR CNRS 2488
>>
>> Le mardi 16 juillet 2013 08:42:15 UTC+2, Thomas Mueller a écrit :
>>>
>>> Hi,
>>>
>>> Hm, I couldn't reproduce the problem so far. What I did was run you test
>>> with the H2 trunk. At first, I got an exception because Geometry
>>> serialization for the MVTableEngine wasn't implemented yet, I guess you
>>> used a patched version of H2. But then I have implemented that missing
>>> piece (it is committed in the trunk), and now the test works with the
>>> following output:
>>>
>>> 0 store.getUnsavedPageCount()==**616
>>> 1 store.getUnsavedPageCount()==5
>>> 2 store.getUnsavedPageCount()==5
>>> ...
>>> 34 store.getUnsavedPageCount()==5
>>> 35 store.getUnsavedPageCount()==5
>>> 36 store.getUnsavedPageCount()==3
>>> 37 store.getUnsavedPageCount()==3
>>> 38 store.getUnsavedPageCount()==2
>>> 39 store.getUnsavedPageCount()==**22
>>> 40 store.getUnsavedPageCount()==2
>>> 41 store.getUnsavedPageCount()==2
>>> 42 store.getUnsavedPageCount()==2
>>> 43 store.getUnsavedPageCount()==2
>>> 44 store.getUnsavedPageCount()==3
>>> 45 store.getUnsavedPageCount()==4
>>>
>>> Regards,
>>> Thomas
>>>
>>  --
>> 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.
>>
>>
>>
>
>

-- 
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