Skip to content

Commit 3a4622b

Browse files
committed
HDFS-4315. DNs with multiple BPs can have BPOfferServices fail to start due to unsynchronized map access. Contributed by Aaron T. Myers.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1422778 13f79535-47bb-0310-9956-ffa450edef68
1 parent c4e34f2 commit 3a4622b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ Release 2.0.3-alpha - Unreleased
619619
HDFS-4307. SocketCache should use monotonic time. (Colin Patrick McCabe
620620
via atm)
621621

622+
HDFS-4315. DNs with multiple BPs can have BPOfferServices fail to start
623+
due to unsynchronized map access. (atm)
624+
622625
BREAKDOWN OF HDFS-3077 SUBTASKS
623626

624627
HDFS-3077. Quorum-based protocol for reading and writing edit logs.

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.nio.channels.FileLock;
2727
import java.util.ArrayList;
2828
import java.util.Collection;
29+
import java.util.Collections;
2930
import java.util.HashMap;
3031
import java.util.Iterator;
3132
import java.util.Map;
@@ -78,7 +79,7 @@ public class DataStorage extends Storage {
7879

7980
// BlockPoolStorage is map of <Block pool Id, BlockPoolStorage>
8081
private Map<String, BlockPoolSliceStorage> bpStorageMap
81-
= new HashMap<String, BlockPoolSliceStorage>();
82+
= Collections.synchronizedMap(new HashMap<String, BlockPoolSliceStorage>());
8283

8384

8485
DataStorage() {

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsWithMultipleNameNodes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static private void setLogLevel() {
5656
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.OFF);
5757
((Log4JLogger)LeaseManager.LOG).getLogger().setLevel(Level.OFF);
5858
((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.OFF);
59-
((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.OFF);
6059
}
6160

6261
private static final Configuration conf = new HdfsConfiguration();

0 commit comments

Comments
 (0)