From 8d86a93915ee00318289535d9c78e48b75c8359d Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Fri, 14 Jul 2017 15:41:43 -0500 Subject: [PATCH] HDFS-12137. DN dataset lock should be fair. Contributed by Daryn Sharp. --- .../hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index 208d554560d..2544ff5d85f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -39,6 +39,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.TimeUnit; import javax.management.NotCompliantMBeanException; @@ -270,6 +271,7 @@ class FsDatasetImpl implements FsDatasetSpi { this.smallBufferSize = DFSUtilClient.getSmallBufferSize(conf); this.datasetLock = new AutoCloseableLock( new InstrumentedLock(getClass().getName(), LOG, + new ReentrantLock(true), conf.getTimeDuration( DFSConfigKeys.DFS_LOCK_SUPPRESS_WARNING_INTERVAL_KEY, DFSConfigKeys.DFS_LOCK_SUPPRESS_WARNING_INTERVAL_DEFAULT,