HDFS-5455. NN should update storageMap on first heartbeat.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2832@1538787 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arpit Agarwal 2013-11-04 21:47:51 +00:00
parent 0091606e2d
commit 1d357365b7
2 changed files with 13 additions and 11 deletions

View File

@ -68,3 +68,5 @@ IMPROVEMENTS:
HDFS-5448. Fix break caused by previous checkin for HDFS-5448. (Arpit
Agarwal)
HDFS-5455. NN should update storageMap on first heartbeat. (Arpit Agarwal)

View File

@ -350,18 +350,16 @@ public void updateHeartbeat(StorageReport[] reports, long cacheCapacity,
this.volumeFailures = volFailures;
for (StorageReport report : reports) {
DatanodeStorageInfo storage = storageMap.get(report.getStorageID());
if (storage != null) {
if (storage == null) {
// This is seen during cluster initialization when the heartbeat
// is received before the initial block reports from each storage.
storage = updateStorage(new DatanodeStorage(report.getStorageID()));
}
storage.receivedHeartbeat(report);
totalCapacity += report.getCapacity();
totalRemaining += report.getRemaining();
totalBlockPoolUsed += report.getBlockPoolUsed();
totalDfsUsed += report.getDfsUsed();
} else {
// This warning is generally benign during cluster initialization
// when the heartbeat is received before the initial block reports
// from each storage.
LOG.warn("Unrecognized storage ID " + report.getStorageID());
}
}
rollBlocksScheduled(getLastUpdate());
@ -651,6 +649,8 @@ public DatanodeStorageInfo updateStorage(DatanodeStorage s) {
synchronized (storageMap) {
DatanodeStorageInfo storage = storageMap.get(s.getStorageID());
if (storage == null) {
LOG.info("Adding new storage ID " + s.getStorageID() +
" for DN " + getXferAddr());
storage = new DatanodeStorageInfo(this, s);
storageMap.put(s.getStorageID(), storage);
} else {