From common-commits-return-86631-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Fri Aug 10 05:49:12 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id CE38D180789 for ; Fri, 10 Aug 2018 05:49:11 +0200 (CEST) Received: (qmail 13305 invoked by uid 500); 10 Aug 2018 03:49:04 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 2601 invoked by uid 99); 10 Aug 2018 03:48:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2018 03:48:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4BF7CE1190; Fri, 10 Aug 2018 03:48:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: umamahesh@apache.org To: common-commits@hadoop.apache.org Date: Fri, 10 Aug 2018 03:49:12 -0000 Message-Id: <7328ce76d85341d2863fc8123663d510@git.apache.org> In-Reply-To: <200a61c4a5e4462d847fcd2ba2da54aa@git.apache.org> References: <200a61c4a5e4462d847fcd2ba2da54aa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/50] [abbrv] hadoop git commit: HDFS-12556: [SPS] : Block movement analysis should be done in read lock. HDFS-12556: [SPS] : Block movement analysis should be done in read lock. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4cd96240 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4cd96240 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4cd96240 Branch: refs/heads/HDFS-10285 Commit: 4cd96240b833ab82847604667e64f0d46c4eef30 Parents: a67fbac Author: Surendra Singh Lilhore Authored: Sat Oct 14 15:11:26 2017 +0530 Committer: Uma Maheswara Rao Gangumalla Committed: Thu Aug 9 20:47:21 2018 -0700 ---------------------------------------------------------------------- .../server/namenode/StoragePolicySatisfier.java | 27 +++++++++++++------- .../TestPersistentStoragePolicySatisfier.java | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4cd96240/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java index a28a806..cbfba44 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java @@ -242,12 +242,25 @@ public class StoragePolicySatisfier implements Runnable { ItemInfo itemInfo = storageMovementNeeded.get(); if (itemInfo != null) { long trackId = itemInfo.getTrackId(); - BlockCollection blockCollection = - namesystem.getBlockCollection(trackId); - // Check blockCollectionId existence. + BlockCollection blockCollection; + BlocksMovingAnalysis status = null; + try { + namesystem.readLock(); + blockCollection = namesystem.getBlockCollection(trackId); + // Check blockCollectionId existence. + if (blockCollection == null) { + // File doesn't exists (maybe got deleted), remove trackId from + // the queue + storageMovementNeeded.removeItemTrackInfo(itemInfo); + } else { + status = + analyseBlocksStorageMovementsAndAssignToDN( + blockCollection); + } + } finally { + namesystem.readUnlock(); + } if (blockCollection != null) { - BlocksMovingAnalysis status = - analyseBlocksStorageMovementsAndAssignToDN(blockCollection); switch (status.status) { // Just add to monitor, so it will be retried after timeout case ANALYSIS_SKIPPED_FOR_RETRY: @@ -283,10 +296,6 @@ public class StoragePolicySatisfier implements Runnable { storageMovementNeeded.removeItemTrackInfo(itemInfo); break; } - } else { - // File doesn't exists (maybe got deleted), remove trackId from - // the queue - storageMovementNeeded.removeItemTrackInfo(itemInfo); } } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/4cd96240/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestPersistentStoragePolicySatisfier.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestPersistentStoragePolicySatisfier.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestPersistentStoragePolicySatisfier.java index 5bce296..7165d06 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestPersistentStoragePolicySatisfier.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestPersistentStoragePolicySatisfier.java @@ -72,7 +72,7 @@ public class TestPersistentStoragePolicySatisfier { {StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD} }; - private final int timeout = 300000; + private final int timeout = 90000; /** * Setup environment for every test case. --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org