Skip to content
Browse files
Interface for entrylogger
Define the interface and contract for entrylogger. This is mostly
taking the entrylogger methods used by other components and prettying
them up a bit.

Notable changes are:
- internalReadEntry is now readEntry. There is no 'validate'
  flag. Instead there are two overloads for the method, and validation
  only runs if ledgerId and entryId are passed in.
- shutdown has been renamed to close.
- the compaction entrylog methods have been put behind an
  interface. As it was they were leaking implementation
  details. Ultimitely compaction itself should be hidden behind the
  entrylogger, but that's a larger refactor.
  • Loading branch information
Ivan Kelly authored and mauricebarnum committed Apr 7, 2022
1 parent 67c963a commit c927f4b0128e2b1f0f4b30c41ce442b366d5009c
Showing 27 changed files with 694 additions and 281 deletions.
@@ -57,7 +57,10 @@ public AbstractLogCompactor(ServerConfiguration conf, LogRemovalListener logRemo
public void cleanUpAndRecover() {}

static class Throttler {
* class Throttler.
public static class Throttler {
private final RateLimiter rateLimiter;
private final boolean isThrottleByBytes;

@@ -22,7 +22,7 @@
package org.apache.bookkeeper.bookie;


* Interface that identifies LedgerStorage implementations using EntryLogger and running periodic entries compaction.
@@ -31,7 +31,7 @@ public interface CompactableLedgerStorage extends LedgerStorage {
* @return the EntryLogger used by the ledger storage
EntryLogger getEntryLogger();
EntryLoggerIface getEntryLogger();

* Get an iterator over a range of ledger ids stored in the bookie.
@@ -27,7 +27,10 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.bookkeeper.conf.ServerConfiguration;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -40,13 +43,13 @@ public class EntryLogCompactor extends AbstractLogCompactor {
private static final Logger LOG = LoggerFactory.getLogger(EntryLogCompactor.class);

final CompactionScannerFactory scannerFactory = new CompactionScannerFactory();
final EntryLogger entryLogger;
final EntryLoggerIface entryLogger;
final CompactableLedgerStorage ledgerStorage;
private final int maxOutstandingRequests;

public EntryLogCompactor(
ServerConfiguration conf,
EntryLogger entryLogger,
EntryLoggerIface entryLogger,
CompactableLedgerStorage ledgerStorage,
LogRemovalListener logRemover) {
super(conf, logRemover);
@@ -82,9 +85,9 @@ public boolean compact(EntryLogMetadata entryLogMeta) {
class CompactionScannerFactory {
List<EntryLocation> offsets = new ArrayList<EntryLocation>();

EntryLogger.EntryLogScanner newScanner(final EntryLogMetadata meta) {
EntryLogScanner newScanner(final EntryLogMetadata meta) {

return new EntryLogger.EntryLogScanner() {
return new EntryLogScanner() {
public boolean accept(long ledgerId) {
return meta.containsLedger(ledgerId);

0 comments on commit c927f4b

Please sign in to comment.