[
https://issues.apache.org/jira/browse/BOOKKEEPER-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484023#comment-13484023
]
Ivan Kelly commented on BOOKKEEPER-346:
---------------------------------------
Yes, you can put it in getActiveLedger(), though I think you should rename this
to getActiveLedgersOnInit() to hint that it should only ever be called on
initialisation, as later called could mess things up.
I would change the order a little bit also, to avoid traversing the directories
more than once. Basically, Id change the current loop to the following
{code}
for (File ledgerDirectory : ledgerDirectories) {
for (File grandParent : ledgerDirectory.listFiles()) {
if (grandParent.isDirectory()) {
for (File parent : grandParent.listFiles()) {
if (parent.isDirectory()) {
for (File index : parent.listFiles()) {
if (!index.isFile()
|| !index.getName().endsWith(".idx")
|| !index.getName().endsWith(".rloc")) {
continue;
}
// We've found a ledger index file. The file
name is the
// HexString representation of the ledgerId.
String ledgerIdInHex =
index.getName().replace(".rloc", "").replace(".idx", "");
if (index.getName().endsWith(".rloc)) {
if (indexFileExists(ledgerIdInHex,
ledgerDirectories)) {
index.delete();
continue;
} else {
index.renameTo(new
File(index.getParentFile(), ledgerIdInHex + ".idx"));
}
}
activeLedgerManager.addActiveLedger(Long.parseLong(ledgerIdInHex, 16), true);
}
}
}
}
}
}
{code}
> Detect IOExceptions in LedgerCache and bookie should look at next ledger
> dir(if any)
> ------------------------------------------------------------------------------------
>
> Key: BOOKKEEPER-346
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-346
> Project: Bookkeeper
> Issue Type: Sub-task
> Components: bookkeeper-server
> Affects Versions: 4.1.0
> Reporter: Rakesh R
> Assignee: Vinay
> Fix For: 4.2.0
>
> Attachments: BOOKKEEPER-346.patch, BOOKKEEPER-346.patch,
> BOOKKEEPER-346.patch, BOOKKEEPER-346.patch, BOOKKEEPER-346.patch,
> BOOKKEEPER-346.patch, BOOKKEEPER-346.patch
>
>
> This jira to detect IOExceptions in "LedgerCache" to iterate over all the
> configured ledger(s).
--
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