You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Ivan Kelly (JIRA)" <ji...@apache.org> on 2013/05/06 15:10:17 UTC
[jira] [Commented] (BOOKKEEPER-257) Ability to list all ledgers
[ https://issues.apache.org/jira/browse/BOOKKEEPER-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13649728#comment-13649728 ]
Ivan Kelly commented on BOOKKEEPER-257:
---------------------------------------
This will give an OutOfMemory in the case where there's a lot of ledgers. It would be better to implement iterable like
{code}
LedgerRangeIterator iterator = bkc.getLedgerManager().getLedgerRanges();
return new Iterable<Long>() {
Iterator<Long> iterator() {
return new Iterator<Long>() {
LedgerRange currentRange = null;
boolean hasNext() {
if (currentRange == null && iterator.hasNext()) {
return true;
} else if (currentRange.hasNext() || iterator.hasNext()) {
return true;
} else {
return false;
}
}
Long next() {
if (currentRange == null) {
currentRange = iterator.next();
}
return currentRange.next();
}
}
}
}
{code}
> Ability to list all ledgers
> ---------------------------
>
> Key: BOOKKEEPER-257
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-257
> Project: Bookkeeper
> Issue Type: New Feature
> Reporter: Ivan Kelly
> Assignee: Flavio Junqueira
> Fix For: 4.3.0
>
> Attachments: BOOKKEEPER-257.patch
>
>
> When an application is using bookkeeper it must keep a copy of the ledger ids it creates so that they can be used later, and once they are no longer useful, deleted. However, in the case of a crash between ledger creation and persisting the application copy of the id, the ledger will be dangling. Therefore I propose we have the ability to get a list of all ledger ids, which clients can use for garbage collection. However, I don't think it should be part of the BookKeeper class, rather part of a new BookKeeperAdmin class.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira