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:
parent
0091606e2d
commit
1d357365b7
@ -68,3 +68,5 @@ IMPROVEMENTS:
|
|||||||
HDFS-5448. Fix break caused by previous checkin for HDFS-5448. (Arpit
|
HDFS-5448. Fix break caused by previous checkin for HDFS-5448. (Arpit
|
||||||
Agarwal)
|
Agarwal)
|
||||||
|
|
||||||
|
HDFS-5455. NN should update storageMap on first heartbeat. (Arpit Agarwal)
|
||||||
|
|
||||||
|
@ -350,18 +350,16 @@ public void updateHeartbeat(StorageReport[] reports, long cacheCapacity,
|
|||||||
this.volumeFailures = volFailures;
|
this.volumeFailures = volFailures;
|
||||||
for (StorageReport report : reports) {
|
for (StorageReport report : reports) {
|
||||||
DatanodeStorageInfo storage = storageMap.get(report.getStorageID());
|
DatanodeStorageInfo storage = storageMap.get(report.getStorageID());
|
||||||
if (storage != null) {
|
if (storage == null) {
|
||||||
storage.receivedHeartbeat(report);
|
// This is seen during cluster initialization when the heartbeat
|
||||||
totalCapacity += report.getCapacity();
|
// is received before the initial block reports from each storage.
|
||||||
totalRemaining += report.getRemaining();
|
storage = updateStorage(new DatanodeStorage(report.getStorageID()));
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
storage.receivedHeartbeat(report);
|
||||||
|
totalCapacity += report.getCapacity();
|
||||||
|
totalRemaining += report.getRemaining();
|
||||||
|
totalBlockPoolUsed += report.getBlockPoolUsed();
|
||||||
|
totalDfsUsed += report.getDfsUsed();
|
||||||
}
|
}
|
||||||
rollBlocksScheduled(getLastUpdate());
|
rollBlocksScheduled(getLastUpdate());
|
||||||
|
|
||||||
@ -651,6 +649,8 @@ public DatanodeStorageInfo updateStorage(DatanodeStorage s) {
|
|||||||
synchronized (storageMap) {
|
synchronized (storageMap) {
|
||||||
DatanodeStorageInfo storage = storageMap.get(s.getStorageID());
|
DatanodeStorageInfo storage = storageMap.get(s.getStorageID());
|
||||||
if (storage == null) {
|
if (storage == null) {
|
||||||
|
LOG.info("Adding new storage ID " + s.getStorageID() +
|
||||||
|
" for DN " + getXferAddr());
|
||||||
storage = new DatanodeStorageInfo(this, s);
|
storage = new DatanodeStorageInfo(this, s);
|
||||||
storageMap.put(s.getStorageID(), storage);
|
storageMap.put(s.getStorageID(), storage);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user