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

Erik Krogen commented on HDFS-13779:
------------------------------------

Thanks for looking [~vagarychen]!
For #1, the {{currentIndex}} only increases, then you take the modulo vs. the 
current list size to get the actual index. So in the case you've discussed with 
{{currentIndex = 2}} (not 3, since it is 0-indexed), before we have (caret 
indicating current index):
{code}
1 2 3 4 5
      ^
{code}
Then we try 3 and 4, they both throw standby so we remove them, so the 
remaining list is ({{currentIndex = 2}} still):
{code}
1 2 5
      ^
{code}
Next we try 5, is says RETRY, so we increment to get {{currentIndex = 3}}, then 
we try 1 ({{3 % 3 == 0}}) as expected.

I went with {{currentIndex}} increasing and taking modulo, rather than always 
maintaining an actual index, since the size of the list may change and 
otherwise we would have to potentially update {{currentIndex}} every time the 
list size changes (to avoid AIOOBE). Modulus gives us AIOOBE avoidance for free.

For #2, good point. For #3 / #4, yes, it needs cleanup, just a WIP for now.

> Implement performFailover logic for ObserverReadProxyProvider.
> --------------------------------------------------------------
>
>                 Key: HDFS-13779
>                 URL: https://issues.apache.org/jira/browse/HDFS-13779
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs-client
>            Reporter: Konstantin Shvachko
>            Assignee: Erik Krogen
>            Priority: Major
>         Attachments: HDFS-13779-HDFS-12943.WIP00.patch
>
>
> Currently {{ObserverReadProxyProvider}} inherits {{performFailover()}} method 
> from {{ConfiguredFailoverProxyProvider}}, which simply increments the index 
> and switches over to another NameNode. The logic for ORPP should be smart 
> enough to choose another observer, otherwise it can switch to a SBN, where 
> reads are disallowed, or to an ANN, which defeats the purpose of reads from 
> standby.
> This was discussed in HDFS-12976.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to