The wiki pages are not used for documentation any more. Please visit http://bookkeeper.apache.org for latest documentation.

 

When a client adds an entry to a ledger, it sends requests to write that entry to all bookies in a quorum. Once the request reaches the bookie, a good place in the code to start looking is Bookie.addEntryInternal(). Following the steps, we observe essentially the following:

  1. It checks that the master password matches. If not, the operation is not executed;
  2. It adds the entry to the entry log. It buffers the entry and flushes in batches (InterleavedLedgerStorage.addEntry()). Once it returns, the entry is not guaranteed to be flushed;
  3. It adds the entry position in the entry log to the ledger index (InterleavedLedgerStorage.addEntry()). The ledger index is cached in memory (LedgerCache and LedgerCacheImpl), and it is flushed in pages (page size default is 8k);
  4. It adds the entry to the transaction log (Journal.addEntry()) and only returns after syncing the write to disk (Journal.run()).
  • No labels