Hi,
Please note that setVersionsToKeep only affects in-memory stores. In your
case, it is simply ignored.
> Do I have to call compactMoveChunks or the store is compacted
automatically?
The store is not compacted automatically. The SQL database engine calls it
in a loop, as follows:
public void compactFile(long maxCompactTime) {
store.setRetentionTime(0);
long start = System.currentTimeMillis();
while (store.compact(95, 16 * 1024 * 1024)) {
store.sync();
store.compactMoveChunks(95, 16 * 1024 * 1024);
long time = System.currentTimeMillis() - start;
if (time > maxCompactTime) {
break;
}
}
}
However, if you want to compact it fully, you should use MVStoreTool
compact / compactCleanUp.
> what if I call sync() and closeImmediatelly()? is it the same as calling
close() only?
No. Sync does not store at all, it just syncs what is already stored.
> I had called close() before and it corrupted the DB on android
That's strange. Do you have a simple, reproducible test case? Best just a
"main" methods.
Regards,
Thomas
On Thursday, December 31, 2015, Jan Juno <[email protected]> wrote:
> Do I have to call compactMoveChunks or the store is compacted
> automatically? couldn't find that in help..
> I suspect that call causes corruption(not sync, close..)
>
> On Wednesday, December 30, 2015 at 10:44:40 AM UTC+1, Jan Juno wrote:
>>
>> what if I call
>>
>> sync()
>> and closeImmediatelly()?
>>
>> is it the same as calling close() only?
>>
>> I had called close() before and it corrupted the DB on android
>>
>> commit()
>> closeImmediatelly() didnt't help
>>
>> so now I will try calling
>>
>> sync()
>> closeImmediatelly()
>>
>>
>> seems that commit, sync and close write changes to the file am getting
>> little bit confused here..
>>
>> help ;P
>>
>>
>> On Monday, December 28, 2015 at 5:11:38 PM UTC+1, Jan Juno wrote:
>>>
>>> Hi All
>>>
>>> I am using MVStore on android and the store get's sometimes corrupted. I
>>> have uses close() when closing DB.
>>>
>>> store = new
>>> MVStore.Builder().autoCommitDisabled().compressHigh().fileName(dbName).open();
>>> store.setVersionsToKeep(0);
>>> store.setReuseSpace(true);
>>>
>>> I call store.commit() regularly and DB is closed with call
>>> closeImmediatelly()
>>>
>>> What's the difference between calling
>>>
>>> store.setVersionsToKeep(0);
>>> store.commit()
>>> store.closeImmediatelly()
>>>
>>> and calling only
>>>
>>> store.close()
>>>
>>> no commit() is called, and autoCommitDisabled()
>>>
>> --
> 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]
> <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>
--
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 https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.