The following is cited from the zookeeper book by Flavio Junqueira and Benjamin 
Reed:

dataDir is the directory where the fuzzy snapshots of the in-memory database 
willbe stored. If this server is part of an ensemble, the myid file will also 
be in this directory.
The dataDir does not need to reside on a dedicated device. The snapshots are 
written using a background thread that does not lock the database, and the 
writes to storage are not synced until the snapshot is complete.

I don't quiet understand The snapshots are written using a background thread 
that does not lock the database.Does it mean that the in memory database is not 
locked while the background thread reads it and writes the snapshot to dataDir? 
If this is the case, then if the in-memory data keeps changing while the 
background thread reads it, then there must be some mechanism for the snapshot 
to write completely and correctly(one scenario is the data that the thread has 
just read,but the in-memory database has just changed it).

Also I don't understand the writes to storage are not synced until the snapshot 
is complete, what's the process of writing to storage, snapshot complets,sync.

Can someone explain more?Thanks.



Reply via email to