HDFS-12137. DN dataset lock should be fair. Contributed by Daryn Sharp.

This commit is contained in:
Kihwal Lee 2017-07-14 15:45:26 -05:00
parent 2ba41729ab
commit a47820d72a

View File

@ -124,6 +124,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
/**************************************************
* FSDataset manages a set of data blocks. Each block
@ -304,6 +305,7 @@ public LengthInputStream getMetaDataInputStream(ExtendedBlock b)
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,