HDFS-5501. Fix pendingReceivedRequests tracking in BPServiceActor.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2832@1541371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
46cbce9af1
commit
d06a782c1e
|
@ -101,3 +101,6 @@ IMPROVEMENTS:
|
|||
|
||||
HDFS-5508. Fix compilation error after merge. (Contributed by szetszwo)
|
||||
|
||||
HDFS-5501. Fix pendingReceivedRequests tracking in BPServiceActor. (Arpit
|
||||
Agarwal)
|
||||
|
||||
|
|
|
@ -280,13 +280,14 @@ class BPServiceActor implements Runnable {
|
|||
pendingIncrementalBRperStorage.entrySet()) {
|
||||
final String storageUuid = entry.getKey();
|
||||
final PerStoragePendingIncrementalBR perStorageMap = entry.getValue();
|
||||
ReceivedDeletedBlockInfo[] receivedAndDeletedBlockArray = null;
|
||||
|
||||
if (perStorageMap.getBlockInfoCount() > 0) {
|
||||
// Send newly-received and deleted blockids to namenode
|
||||
receivedAndDeletedBlockArray = perStorageMap.dequeueBlockInfos();
|
||||
pendingReceivedRequests -= receivedAndDeletedBlockArray.length;
|
||||
blockArrays.put(storageUuid, receivedAndDeletedBlockArray);
|
||||
ReceivedDeletedBlockInfo[] rdbi = perStorageMap.dequeueBlockInfos();
|
||||
pendingReceivedRequests =
|
||||
(pendingReceivedRequests > rdbi.length ?
|
||||
(pendingReceivedRequests - rdbi.length) : 0);
|
||||
blockArrays.put(storageUuid, rdbi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,8 +313,7 @@ class BPServiceActor implements Runnable {
|
|||
// didn't put something newer in the meantime.
|
||||
PerStoragePendingIncrementalBR perStorageMap =
|
||||
pendingIncrementalBRperStorage.get(storageUuid);
|
||||
perStorageMap.putMissingBlockInfos(rdbi);
|
||||
pendingReceivedRequests += perStorageMap.getBlockInfoCount();
|
||||
pendingReceivedRequests += perStorageMap.putMissingBlockInfos(rdbi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -859,13 +859,17 @@ class BPServiceActor implements Runnable {
|
|||
* Add blocks from blockArray to pendingIncrementalBR, unless the
|
||||
* block already exists in pendingIncrementalBR.
|
||||
* @param blockArray list of blocks to add.
|
||||
* @return the number of missing blocks that we added.
|
||||
*/
|
||||
void putMissingBlockInfos(ReceivedDeletedBlockInfo[] blockArray) {
|
||||
int putMissingBlockInfos(ReceivedDeletedBlockInfo[] blockArray) {
|
||||
int blocksPut = 0;
|
||||
for (ReceivedDeletedBlockInfo rdbi : blockArray) {
|
||||
if (!pendingIncrementalBR.containsKey(rdbi.getBlock().getBlockId())) {
|
||||
pendingIncrementalBR.put(rdbi.getBlock().getBlockId(), rdbi);
|
||||
++blocksPut;
|
||||
}
|
||||
}
|
||||
return blocksPut;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue