OmniBase and Commits

Yanni Chiu yanni at rogers.com
Tue Apr 26 18:17:05 UTC 2005


Daniel Salama wrote:
> 
> I'm trying to test uploading several thousand objects into an OmniBase
> db and I'm trying to figure out how to commit every 100th object.
> 
> txn := db newTransaction.
> 1 to: 1000 do: [:i|
> base := txn root at: 'linkedlist'.
> base add: anObject.
> (i \\ 100) = 0 ifTrue: [ txn commit. txn := db newTransaction]]

How about:

base := txn root at: 'linkedlist'.
txn := db newTransaction.
1 to: 1000 do: [:i|
    base add: anObject.
    base markDirty. "If you're not using a persistent collection"
    (i \\ 100) = 0 ifTrue: [ txn checkpoint ]].
txn commit

If you look at the implementation of ODBLocalTransaction>>commit
it just does a checkpoint and an abort. The abort makes it so that
the transaction can't be checkpoint'ed again. So I think your
loop would be simpler if you just checkpoint every 100, and do
one final commit.

BTW, I've got my framework working with OmniBase, so I'll update
the timings I made for your test data.




More information about the Squeak-dev mailing list