directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@symas.com>
Subject [Mavibot] Revision implementation
Date Fri, 03 Jan 2014 19:42:11 GMT
Hi guys, and an Happy New Year !

I'm currently working on revamping Mavibot to make it possible to use
revisions (something which is currently not available).

I have created a JIRA for that
(https://issues.apache.org/jira/browse/MAVIBOT-34)

The way it will be implemented implies a huge refactoring of the current
code base. We will add a BtreeOfBtrees storing tuple of <<btree name,
revision>, offset of Btree Header>. This btree will keep a track of each
btree for each revision currently in use. When a Btree is updated, we
add an entry in this BOB (BtreeOfBtrees) so that we can access it and
still have access to the previous revisions of the same btree, if
needed. The RecordManagerHeader will point to the latest BOB Header.

Updating a Btree follos those steps :

- start the transaction
  - create new Btree rootPage[N+1]
  - add <N+1, copied pages> into the CopiedPages Btree :
    - create a new CopiedPage RootPage
    - create a new CopiedPages Header
  - create new Btree Header[N+1]
  - add <<Btree, N+1>, Btree Header[N+1]> into BOB :
    - create new BOB RootPage
    - create new BOB Header
  - make the RMHeader to point on the new BOB Header
  - move the old BOB RootPage to the free page list
  - move the old BOB Header to the free page list
  - move the old CopiedPages RootPage to the free page list
  - move the old CopiedPages Header to the free page list
  - cleanup the pages from the btree that can be recovered and move then
to the free page list     
- commit the transaction
  - update the RMheader

It seems complicated, but this is probably the only way we can guarantee
the file will be readable after a crash, whenever it occurs.

Now, there are still a lot of thing to think about if we have a crash,
like cleaning up the pages that aren't linked with the RM Header
(otherwise they will stay on the file untouched forever). We can keep a
track of the previous BOB header in the RMHeader for that purpose, when
we start the transaction. It's a small price to pay to avoid a big
cleanup at startup.

I'm currently in the middle of this refactoring, Ill keep you informed
of the progress.

Any feedback is extreelly welcome !

Mime
View raw message