Hi,

Looking at the code in Bookie.java I noticed that write to journal (which
is supposed to be a write-ahead log as I understand) happened after write
to ledger storage.
This looks counter-intuitive, can someone explain why is it done in this
order?

My primary concern is that ledger storage write can be delayed (i.e.
EntryMemTable's addEntry can do throttleWriters() in some cases) thus
dragging overall client's view of add latency up even though it is possible
that journal's write (i.e. in case of dedicated journal disk) will complete
faster.

    private void addEntryInternal(LedgerDescriptor handle, ByteBuffer
entry, WriteCallback cb, Object ctx)

            throws IOException, BookieException {

        long ledgerId = handle.getLedgerId();

        entry.rewind();

*// ledgerStorage.addEntry() is happening here*

        long entryId = handle.addEntry(entry);


        entry.rewind();

        writeBytes.add(entry.remaining());


        LOG.trace("Adding {}@{}", entryId, ledgerId);

*// journal add entry is happening here*

*// callback/response to client is sent after journal add is done.*

        journal.logAddEntry(entry, cb, ctx);

    }



----------
Andrey Yegorov

Reply via email to