Skip to content

Commit e6cb006

Browse files
author
Jiang Haiting
committed
Update error log in RemoteManagedCursorImpl
1 parent 160d75d commit e6cb006

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/RemoteManagedCursorImpl.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ void initialize(PositionImpl position, Map<String, Long> properties, VoidCallbac
7373
recoverFromCursorPosition(pos);
7474
callback.operationComplete();
7575
}).exceptionally(throwable -> {
76-
callback.operationFailed(ManagedLedgerException.getManagedLedgerException(throwable));
76+
String errMsg = String.format("[%s] initialize cursor %s failed.", ledger.getName(), name);
77+
log.error(errMsg, throwable);
78+
callback.operationFailed(new ManagedLedgerException(errMsg, throwable));
7779
return null;
7880
});
7981
}
@@ -111,8 +113,9 @@ void recover(VoidCallback callback) {
111113
recoverFromCursorPosition(positionInfo);
112114
callback.operationComplete();
113115
}).exceptionally(throwable -> {
114-
//TODO opt define this exception.
115-
callback.operationFailed(new ManagedLedgerException(throwable));
116+
String errMsg = String.format("[%s] recover existing cursor %s failed", ledger.getName(), name);
117+
log.error(errMsg, throwable);
118+
callback.operationFailed(new ManagedLedgerException(errMsg, throwable));
116119
return null;
117120
});
118121
}
@@ -174,8 +177,7 @@ protected void persistPosition(MarkDeleteEntry mdEntry, VoidCallback callback) {
174177
.thenRun(callback::operationComplete)
175178
.exceptionally(throwable -> {
176179
callback.operationFailed(
177-
new ManagedLedgerException("Persist position to remote writer broker failed.",
178-
throwable));
180+
new ManagedLedgerException("Persist position to remote writer broker failed.", throwable));
179181
return null;
180182
});
181183
}

0 commit comments

Comments
 (0)