[broker] Do not log stacktrace for 'Failed to flush mark-delete position' case
@@ -1729,7 +1729,7 @@ public class ManagedCursorImpl implements ManagedCursor {
*/
PositionImpl setAcknowledgedPosition(PositionImpl newMarkDeletePosition) {
if (newMarkDeletePosition.compareTo(markDeletePosition) < 0) {
- throw new IllegalArgumentException(
+ throw new MarkDeletingMarkedPosition(
"Mark deleting an already mark-deleted position. Current mark-delete: " + markDeletePosition
+ " -- attempted mark delete: " + newMarkDeletePosition);
}
@@ -1800,6 +1800,12 @@ public class ManagedCursorImpl implements ManagedCursor {
asyncMarkDelete(position, Collections.emptyMap(), callback, ctx);
}
+ private final class MarkDeletingMarkedPosition extends IllegalArgumentException {
+ public MarkDeletingMarkedPosition(String s) {
+ super(s);
+ }
+ }
+
@Override
public void asyncMarkDelete(final Position position, Map<String, Long> properties,
final MarkDeleteCallback callback, final Object ctx) {
@@ -3289,8 +3295,14 @@ public class ManagedCursorImpl implements ManagedCursor {
@Override
public void markDeleteFailed(ManagedLedgerException exception, Object ctx) {
+ if (exception.getCause() instanceof MarkDeletingMarkedPosition) {
+ // this is not actually a problem, we should not log a stacktrace
+ log.info("[{}][{}] Cannot flush mark-delete position: {}", ledger.getName(),
+ name, exception.getCause().getMessage());
+ } else {
log.warn("[{}][{}] Failed to flush mark-delete position", ledger.getName(), name, exception);
}
+ }
}, null);
}
