Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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, the bookie processes it as followsa 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 transaction log (log device of the bookie)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 identifier log to the ledger index cache. This is a memory operation(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 queues adds the entry and flushes the entries in the queue in batches to make the writes more efficient. Such writes are asynchronous, and a response to the client is not dependent upon success of the ledger device writethe transaction log (Journal.addEntry()) and only returns after syncing the write to disk (Journal.run()).