directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <>
Subject Re: [Mavibot] Update
Date Mon, 30 Jan 2017 09:26:00 GMT
Hi !

End of the week-end...

FTR here is what looks like the insert operation :

        try ( WriteTransaction writeTxn =
recordManager.beginWriteTransaction() )
            btree.insert( writeTxn, 1L, "1" );
            btree.insert( writeTxn, 4L, "4" );
            btree.insert( writeTxn, 2L, "2" );
            btree.insert( writeTxn, 3L, "3" );
            btree.insert( writeTxn, 5L, "5" );

As you can see, we use a try-with-resource, where the transaction is
automatically committed, which makes it really easy for the users. Of
course, one can abort the transaction at any moment, and the auto-commit
will jst do nothing in this case.

The extra advantage is that it's harder to forget to close a transaction :-)

Of course, it's still possible to explicitely commit the transaction, if

One thing that came to my mind is that we don't necessarily need to
detect that we had a crash. Currently, the idea was to save the current
state (ie, the reference to the n-1 revision offsets in the
RecordManagerHeader - the first page in the file -) when we start a txn,
and to replace it with an updated version when we are done with the txn.
If we have a crash in the middle, on restart, we will detect that the
recordManagerHeader is in an intermediary state, and we will be able to
scan the full fine to retrieve unlinked pages - in any case, read and
write are stll possile duting this recovery phase, which is ran
concurrently -. That comes with an extra write for every single txn.

My take is that it's probably less expensive to do this scan on every
start, no matter what, because this is a one-time expense, and this
effort is not impacting reads and writes anyway. That would save one
extra write per write transaction. In any case, the data will always be
consistant, no matter what.

More next week !

Emmanuel Lecharny

View raw message