HDFS-10773. BlockSender should not synchronize on the dataset object. (Contributed by Chen Liang)
This commit is contained in:
parent
2aa5e2c403
commit
ca13e7971d
|
@ -46,6 +46,7 @@ import org.apache.hadoop.io.LongWritable;
|
||||||
import org.apache.hadoop.io.ReadaheadPool.ReadaheadRequest;
|
import org.apache.hadoop.io.ReadaheadPool.ReadaheadRequest;
|
||||||
import org.apache.hadoop.io.nativeio.NativeIO;
|
import org.apache.hadoop.io.nativeio.NativeIO;
|
||||||
import org.apache.hadoop.net.SocketOutputStream;
|
import org.apache.hadoop.net.SocketOutputStream;
|
||||||
|
import org.apache.hadoop.util.AutoCloseableLock;
|
||||||
import org.apache.hadoop.util.DataChecksum;
|
import org.apache.hadoop.util.DataChecksum;
|
||||||
import org.apache.htrace.core.TraceScope;
|
import org.apache.htrace.core.TraceScope;
|
||||||
|
|
||||||
|
@ -239,7 +240,7 @@ class BlockSender implements java.io.Closeable {
|
||||||
|
|
||||||
final Replica replica;
|
final Replica replica;
|
||||||
final long replicaVisibleLength;
|
final long replicaVisibleLength;
|
||||||
synchronized(datanode.data) {
|
try(AutoCloseableLock lock = datanode.data.acquireDatasetLock()) {
|
||||||
replica = getReplica(block, datanode);
|
replica = getReplica(block, datanode);
|
||||||
replicaVisibleLength = replica.getVisibleLength();
|
replicaVisibleLength = replica.getVisibleLength();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue