eolivelli commented on a change in pull request #14645:
URL: https://github.com/apache/pulsar/pull/14645#discussion_r827709769



##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedCursor.java
##########
@@ -74,6 +77,17 @@
      */
     void updateLastActive();
 
+    default void addSkipPosition(Position skipPosition) {
+        // do nothing
+    }
+
+    default List<Position> getSkipPositions() {
+        return null;

Review comment:
       what about returning an Collections.emptyList() ?

##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpReadEntry.java
##########
@@ -100,15 +100,16 @@ public void readEntriesFailed(ManagedLedgerException 
exception, Object ctx) {
         } else if (cursor.config.isAutoSkipNonRecoverableData() && exception 
instanceof NonRecoverableLedgerException) {
             log.warn("[{}][{}] read failed from ledger at position:{} : {}", 
cursor.ledger.getName(), cursor.getName(),
                     readPosition, exception.getMessage());
-            // try to find and move to next valid ledger
-            final Position nexReadPosition = 
cursor.getNextLedgerPosition(readPosition.getLedgerId());
+            // try to find and move to next valid entry position
+            PositionImpl nexReadPosition = 
cursor.getNextAvailablePosition(readPosition);

Review comment:
       final ? and it is better to keep Position (instead of using the impl 
class)

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Dispatcher.java
##########
@@ -44,6 +45,9 @@
 
     boolean canUnsubscribe(Consumer consumer);
 
+    default void 
registerAutoSkipNonRecoverableDataListener(java.util.function.Consumer<List<Position>>
 listener) {

Review comment:
       what about creating a specific interface instead of using a generic 
"java.util.function.Consumer<List<Position>>" ?

##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
##########
@@ -247,6 +249,7 @@ public MarkDeleteEntry(PositionImpl newPosition, 
Map<String, Long> properties,
     }
 
     ManagedCursorImpl(BookKeeper bookkeeper, ManagedLedgerConfig config, 
ManagedLedgerImpl ledger, String cursorName) {
+        this.autoSkipEntryPosition = new ArrayList<>();

Review comment:
       this should be a concurrency aware data structure




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to