Skip to content
Permalink
Browse files
BP-47 (task3): Abstract interface for entrylogger (#3197)
* 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.

(cherry picked from commit c927f4b)

* abstract interface for entrylogger

* format code

* format code

* address comments

* Apply suggestions from code review

Co-authored-by: Andrey Yegorov <8622884+dlg99@users.noreply.github.com>

* address comments

* format code

Co-authored-by: Ivan Kelly <ikelly@splunk.com>
Co-authored-by: Andrey Yegorov <8622884+dlg99@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 29, 2022
1 parent 80ca1f8 commit 6f85e6d5fa735dfea035ba4761c6669fbf5c6880
Showing 40 changed files with 863 additions and 438 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;

@@ -38,6 +38,7 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.bookkeeper.bookie.storage.EntryLogger;
import org.apache.bookkeeper.client.LedgerEntry;
import org.apache.bookkeeper.client.api.LedgerMetadata;
import org.apache.bookkeeper.common.annotation.InterfaceAudience.Private;
@@ -2441,7 +2442,7 @@ public static void main(String[] argv) throws Exception {
private synchronized void initEntryLogger() throws IOException {
if (null == entryLogger) {
// provide read only entry logger
entryLogger = new ReadOnlyEntryLogger(bkConf);
entryLogger = new ReadOnlyDefaultEntryLogger(bkConf);
}
}

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

import java.io.IOException;

import org.apache.bookkeeper.bookie.storage.EntryLogger;
/**
* Interface that identifies LedgerStorage implementations using EntryLogger and running periodic entries compaction.
*/

0 comments on commit 6f85e6d

Please sign in to comment.