Persistence module for Doozer clusters

143 views
Skip to first unread message

Aram Hăvărneanu

unread,
Mar 26, 2012, 1:14:43 PM3/26/12
to Keith Rarick, Blake Mizerany, Gustavo Niemeyer, doo...@googlegroups.com, Aram Hăvărneanu, Aram Hăvărneanu
I have implemented a persistence module for doozer. You can use it
to add persistence to your cluster. It's implemented outside of the
doozerd server process, it's a regular client that speaks the doozer
protocol, connects to the cluster, listens for I/O and saves the I/O
to disk. Being outside of doozerd it implements persistence
in an asynchronous manner, however, there's a mechanism clients can
use if they wish to have synchronous semantics.

Being a regular client, you can run 1, 10, 100 or any other
non-negative integral number of instances and these instances can
run on any number or machines.

The persistence client, temporarily named doozerp, works like this:

1) it listens on /, say /one/hello is modified.
2) it records the change to disk.
3) it acknowledges successful logging by setting the key
/ctl/persistence/<id>/one/hello with the revision number of the
change. Each persistence client maintains a mirrored tree of
every change, and every interested party can monitor this mirror
tree to know when a particular change has been made. Only the
namespace is mirrored, not the contents of the keys. The keys
are set to the revision of the original change so that clients
can know when a particular change has been recorded. <id> is
an integer client-id, each persistence instance has a different
id. Clients chose which persistence client to listen to.

We only care about synchronous semantics, so there's a library,
temporarily named doozerl, that is 100% compatible with the regular
client-side doozer library but waits for each change to be recorded
to disk before returning control to the client.

The persistence mechanism has been designed in such a way that each
interested party can implement its own client, for its own specific
needs. They only need to implement the trivial protocol of mirroring
changes in /ctl/persistence.

If you want to take a look at it, there's a github mirror:
https://github.com/4ad/doozerd

Everything is in the persistence directory, persistence itself is the
journaling library, {dump,write}journal are tools to help view and
set journals, doozerl is the library and doozerp is the persistence
client. Everything is simple and everything seems to work.

This is a preview, doozerl has no place in the doozerd tree because
the doozer client libraries aren't there either. Maybe everything
needs a different place so the final names and structure will likely
be different.

To test things (use most recent Go weekly):

rm -rf $GOPATH/src/github.com/ha/doozerd
mkdir -p $GOPATH/src/github.com/ha
cd $GOPATH/src/github.com/ha
git clone git://github.com/4ad/doozerd.git cd doozerd
./all.sh

All tests should pass.

By default doozerp will not restore the journal, use -r flag for
that. Also if the journal is broken, it will exit, you need to specify
the -f flag to try to repair the journal. -f is off by default because
it's potentially destructive, -r is off by default because not every
time you want to start a client you want to restore from backup.

Feedback welcome.

Thanks,

--
Aram Hăvărneanu

Reply all
Reply to author
Forward
0 new messages