Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D7B30200D34 for ; Thu, 19 Oct 2017 15:27:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D61F51609E2; Thu, 19 Oct 2017 13:27:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 297F71609ED for ; Thu, 19 Oct 2017 15:27:13 +0200 (CEST) Received: (qmail 58336 invoked by uid 500); 19 Oct 2017 13:27:12 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 58323 invoked by uid 99); 19 Oct 2017 13:27:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Oct 2017 13:27:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 630F7D039B for ; Thu, 19 Oct 2017 13:27:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id iof4m-n0xM7W for ; Thu, 19 Oct 2017 13:27:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 45C3360CFD for ; Thu, 19 Oct 2017 13:27:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0C589E0D5C for ; Thu, 19 Oct 2017 13:27:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0388921EE6 for ; Thu, 19 Oct 2017 13:27:02 +0000 (UTC) Date: Thu, 19 Oct 2017 13:27:02 +0000 (UTC) From: "Wei-Chiu Chuang (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-12619) Do not catch and throw unchecked exceptions if IBRs fail to process MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 19 Oct 2017 13:27:14 -0000 [ https://issues.apache.org/jira/browse/HDFS-12619?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Wei-Chiu Chuang updated HDFS-12619: ----------------------------------- Resolution: Fixed Hadoop Flags: Reviewed Fix Version/s: 3.0.0 2.8.3 2.9.0 Status: Resolved (was: Patch Available) Thanks [~hanishakoneru] and [~xiaochen] for the review. Patch 001 was committed in trunk (3.0.0), branch-2 (2.9.0) and branch-2.8 (2.8.3) > Do not catch and throw unchecked exceptions if IBRs fail to process > ------------------------------------------------------------------- > > Key: HDFS-12619 > URL: https://issues.apache.org/jira/browse/HDFS-12619 > Project: Hadoop HDFS > Issue Type: Improvement > Components: namenode > Affects Versions: 2.8.0, 2.7.3, 3.0.0-alpha1 > Reporter: Wei-Chiu Chuang > Assignee: Wei-Chiu Chuang > Priority: Minor > Fix For: 2.9.0, 2.8.3, 3.0.0 > > Attachments: HDFS-12619.001.patch > > > HDFS-9198 added the following code > {code:title=BlockManager#processIncrementalBlockReport} > public void processIncrementalBlockReport(final DatanodeID nodeID, > final StorageReceivedDeletedBlocks srdb) throws IOException { > ... > try { > processIncrementalBlockReport(node, srdb); > } catch (Exception ex) { > node.setForceRegistration(true); > throw ex; > } > } > {code} > In Apache Hadoop 2.7.x ~ 3.0, the code snippet is accepted by Java compiler. However, when I attempted to backport it to a CDH5.3 release (based on Apache Hadoop 2.5.0), the compiler complains the exception is unhandled, because the method defines it throws IOException instead of Exception. > While the code compiles for Apache Hadoop 2.7.x ~ 3.0, I feel it is not a good practice to catch an unchecked exception and then rethrow it. How about rewriting it with a finally block and a conditional variable? -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org