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 2A4BF200BF9 for ; Sun, 8 Jan 2017 14:12:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 28CA2160B45; Sun, 8 Jan 2017 13:12:00 +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 71110160B2C for ; Sun, 8 Jan 2017 14:11:59 +0100 (CET) Received: (qmail 54815 invoked by uid 500); 8 Jan 2017 13:11:58 -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 54794 invoked by uid 99); 8 Jan 2017 13:11:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jan 2017 13:11:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 608C02C1F54 for ; Sun, 8 Jan 2017 13:11:58 +0000 (UTC) Date: Sun, 8 Jan 2017 13:11:58 +0000 (UTC) From: "Jiajia Li (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-11221) Have StorageDirectory return Optional instead of File/null MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 08 Jan 2017 13:12:00 -0000 [ https://issues.apache.org/jira/browse/HDFS-11221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jiajia Li updated HDFS-11221: ----------------------------- Attachment: HDFS-11221-v1.patch 1. In StorageDirectory class, changed the return type of the functions(getRoot(), getCurrentDir(), getVersionFile(), getPreviousVersionFile(), getPreviousDir(), getPreviousTmp(), getRemovedTmp(), getFinalizedTmp(), getLastCheckpointTmp(), getPreviousCheckpoint()) to Optional 2. When calling above functions, add the step to get the File from Optional > Have StorageDirectory return Optional instead of File/null > ---------------------------------------------------------------- > > Key: HDFS-11221 > URL: https://issues.apache.org/jira/browse/HDFS-11221 > Project: Hadoop HDFS > Issue Type: Task > Reporter: Ewan Higgs > Assignee: Jiajia Li > Priority: Minor > Attachments: HDFS-11221-v1.patch > > > In HDFS-10675, {{StorageDirectory.root}} can be {{null}} because {{PROVIDED}} storage locations will not have any directories associated with them. Hence, we need to add checks to StorageDirectory to make sure we handle this. This would also lead to changes in code that call {{StorageDirectory.getRoot}}, {{StorageDirectory.getCurrentDir}}, {{StorageDirectory.getVersionFile}} etc. as the return value can be {{nul}}l (if {{StorageDirectory.root}} is null). > The proposal to handle this is to change the return type of the above functions to {{Optional}}. According to my preliminary check, this will result in changes in ~70 places, which is why it's not appropriate to put it in the patch for HDFS-10675. But it is certainly a valuable fix. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org