[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401203#comment-13401203
 ] 

Rakesh R commented on BOOKKEEPER-246:
-------------------------------------

Hi Ivan, patch looks great. I have few suggestions and thoughts. Also, I think 
need to rebase the Auditor BOOKKEEPER-272 patch accordingly.


- Can we have factory for the LedgerUnderreplicationManager?

- We are creating underreplica znode like "%s/urL%08d"
urL00000009
But LedgerManager is creating znode like "%010d"
L_0000000009
I feel would be good to follow same pattern for maintainability. 
(Presently there is no functional problem as replication logic is separate.)

- In the getLedgerToRereplicate(), changedLatch.countDown() should be only on 
EventType.NodeChildrenChanged like as follows, just to minimize the chance of 
unwanted exceptions.
{code}
public void process(WatchedEvent e) {
   if (event.getType() == EventType.NodeChildrenChanged)
       changedLatch.countDown();
}
{code}

- It would be good to have few info or debug logs for debuggability. I have 
seen many places we are silently continuing without logs
markLedgerUnderreplicated
markLedgerComplete
getLedgerToRereplicate
releaseLedger

- Also, one good pattern of handling the InterruptedException.
When you catch and swallow InterruptedException, you should call 
Thread.currentThread().interrupt() afterward, so that the interrupt status 
isn't lost
{code}
} catch (InterruptedException ie) {
    Thread.currentThread().interrupt()
    // logging or throw exception back
}
{code}


- getLedgerToRereplicate:
{code}
List<String> children = zkc.getChildren(urLedgerPath, w);
zkc.getChildren(urLockPath, w);

Collections.shuffle(children);
while (children.size() > 0) {
{code}
   Instead can we filter the children which doesn't have any lock, like:
{code}
List<String> children = zkc.getChildren(urLedgerPath, w);
List<String> lockedChildren = zkc.getChildren(urLockPath, w);
Collection<String> nolockChildren = CollectionUtils.subtract(children, 
lockedChildren);

while (nolockChildren.size() > 0) {
    Collections.shuffle(nolockChildren);
{code}


-Rakesh
                
> Recording of underreplication of ledger entries
> -----------------------------------------------
>
>                 Key: BOOKKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-246
>             Project: Bookkeeper
>          Issue Type: Sub-task
>          Components: bookkeeper-client, bookkeeper-server
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.2.0
>
>         Attachments: BOOKKEEPER-246.diff, BOOKKEEPER-246.diff
>
>
> This JIRA is to decide how to record that entries in a ledger are 
> underreplicated. 
> I think there is a common understanding (correct me if im wrong), that 
> rereplication can be broken into two logically distinct phases. A) Detection 
> of entry underreplication & B) Rereplication. 
> This subtask is to handle the interaction between these two stages. Stage B 
> needs to know what to rereplicate; how should Stage A inform it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to