dlg99 commented on a change in pull request #2936:
URL: https://github.com/apache/bookkeeper/pull/2936#discussion_r779107568
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
##########
@@ -1013,4 +1077,91 @@ public void diskJustWritable(File disk) {
}
};
}
+
+ @Override
+ public void setLimboState(long ledgerId) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("setLimboState. ledger: {}", ledgerId);
+ }
+ ledgerIndex.setLimbo(ledgerId);
+ }
+
+ @Override
+ public boolean hasLimboState(long ledgerId) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("hasLimboState. ledger: {}", ledgerId);
+ }
+ return ledgerIndex.get(ledgerId).getLimbo();
+ }
+
+ @Override
+ public void clearLimboState(long ledgerId) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("clearLimboState. ledger: {}", ledgerId);
+ }
+ ledgerIndex.clearLimbo(ledgerId);
+ }
+
+ private void throwIfLimbo(long ledgerId) throws IOException,
BookieException {
Review comment:
this is mostly for the convenience of the IDE code generation (+
documentation) and a rather generic discussion:
if the method throws BookieException, the IDE-generated catch will put one
catch block and developer may need to chase code down to understand what
specifically can happen.
If the exceptions in throws are specified as "throws DataUnknownException,
OperationRejectedException, MetadataStoreException" one can easily see that
exception handling might need to be different (or use catch BookieException if
it does not).
This one is a private method with limited scope of use but, if its exception
is rethrown, more specific exception in throws lets one define more specific
exception in the throws of method that uses it.
--
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]