[ https://issues.apache.org/jira/browse/HDFS-13330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16417880#comment-16417880 ]
Wei-Chiu Chuang commented on HDFS-13330: ---------------------------------------- Hi [~gabor.bota] thanks for the patch. I think this bug is more involved than it seems. An infinite loop looks even scarier than a loop that never retries. Suppose there's a bug somewhere else and replicaInfoMap.get(key) return null, this loop will never end, because it runs inside a lock, and no one will be able to update it. Could you also fix the findbugs error? In addition, a test case for this method is greatly appreciated. > ShortCircuitCache#fetchOrCreate never retries > --------------------------------------------- > > Key: HDFS-13330 > URL: https://issues.apache.org/jira/browse/HDFS-13330 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Wei-Chiu Chuang > Assignee: Gabor Bota > Priority: Minor > Attachments: HDFS-13330.001.patch, HDFS-13330.002.patch > > > The follow do .. while(false) loop seems useless to me. The code intended to > retry but it never worked. Let's fix it. > {code:java:title=ShortCircuitCache#fetchOrCreate} > ShortCircuitReplicaInfo info = null; > do { > if (closed) { > LOG.trace("{}: can't fethchOrCreate {} because the cache is closed.", > this, key); > return null; > } > Waitable<ShortCircuitReplicaInfo> waitable = replicaInfoMap.get(key); > if (waitable != null) { > try { > info = fetch(key, waitable); > } catch (RetriableException e) { > LOG.debug("{}: retrying {}", this, e.getMessage()); > } > } > } while (false);{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org