From 2ff2a7f6120079b6a88afff987a551fa3d1f47e2 Mon Sep 17 00:00:00 2001 From: Surendra Singh Lilhore Date: Thu, 12 Sep 2019 19:43:18 +0530 Subject: [PATCH] HDFS-14798. Synchronize invalidateBlocks in DatanodeDescriptor. Contributed by hemanthboyina. --- .../hdfs/server/blockmanagement/DatanodeDescriptor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java old mode 100644 new mode 100755 index e0d8558611..b3e2fa6d46 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java @@ -339,7 +339,9 @@ boolean hasStaleStorages() { public void resetBlocks() { updateStorageStats(this.getStorageReports(), 0L, 0L, 0, 0, null); - this.invalidateBlocks.clear(); + synchronized (invalidateBlocks) { + this.invalidateBlocks.clear(); + } this.volumeFailures = 0; // pendingCached, cached, and pendingUncached are protected by the // FSN lock.