5

I am looking for an embeddable library for doing atomic file I/O from java. I need the library to support the following features.

  • basic page management -- allocate/free pages and read/write
  • atomic (all or nothing) writes (basically journaled I/O)
  • A simple binary page format (needs to be readable by C++)

  • It does not need to be that fast (or concurrent), just simple and reliable.

Has anyone used something in the past which fits the bill?

Things I have looked into

I found the internals for the kaha db project to be useful, but development seems to have switched to a fusesoure project called hawtdb. Hawt currently seems to rely memory mapped I/O which sounds good at first, but limits the size of the page file you can access to 2GB unless you go to a 64bit JVM + OS (due to JVM address space limitations).

Some alternatives I am considering are the Cassandra project, but I don't know if its embeddable. I've looked into derby (which created lots of files when run) and H2 (which seemed promising, but I didn't look too deeply). These seemed to have relatively complex page file formats and seem to provide far more than I need. MySQL did provide docs for the page file format, but it too was a bit complex.

Justin
  • 4,437
  • 6
  • 32
  • 52

3 Answers3

2

HOWL

HOWL is a logger implementation providing features required by the ObjectWeb JOTM project, with a public API that is generally usable by any Transaction Manager. HOWL uses unformatted binary logs to maximize performance and specifies a journalization API with methods necessary to support JOTM recovery operations.

HOWL is intended to be used for logging of temporary data such as XA transaction events

maximdim
  • 8,041
  • 3
  • 33
  • 48
  • This is actually an older implementation, written in part by the same author as kaha and hawt. It is still useful. – Justin Oct 28 '10 at 03:46
0
  • Berkley DB? (The traditional version with JNI, not the Java version if you also want to access via C++). I haven't used it, but seems to fit your requirements more closely than some of the alternatives that you've listed.

  • SQLLite? Similar but more relational database focused. Native, but with Java bindings.

Just some other ideas. These might not provide low enough access for page based file i/o though.

kaliatech
  • 17,579
  • 5
  • 72
  • 84
  • 1
    You might also want to watch for answers to this question in case you decided to build your own: http://stackoverflow.com/questions/3759311/memory-mapped-files-and-atomic-writes-of-single-blocks – kaliatech Oct 20 '10 at 22:22
  • I have to say SQLLite really does have well commented code, it reads more like a novel than source. – Justin Oct 21 '10 at 13:58
0

An oldie, but goodie JDBM

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67
  • Great comment in their javadoc `The set of dirty records on the in-use list constitutes a transaction. Later on, we will send these records to some recovery thingy.` – Justin Oct 25 '10 at 18:06