HDFS-7780. Update use of Iterator to Iterable in DataXceiverServer and SnapshotDiffInfo. Contributed by Ray Chiang.

This commit is contained in:
Akira Ajisaka 2015-02-17 14:47:53 -08:00
parent 409113d8f9
commit 6dc8812a95
3 changed files with 10 additions and 6 deletions

View File

@ -647,6 +647,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7795. Show warning if not all favored nodes were chosen by namenode HDFS-7795. Show warning if not all favored nodes were chosen by namenode
(kihwal) (kihwal)
HDFS-7780. Update use of Iterator to Iterable in DataXceiverServer and
SnapshotDiffInfo. (Ray Chiang via aajisaka)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode. HDFS-7454. Reduce memory footprint for AclEntries in NameNode.

View File

@ -252,9 +252,9 @@ public synchronized void sendOOBToPeers() {
// be set true before calling this method. // be set true before calling this method.
synchronized void restartNotifyPeers() { synchronized void restartNotifyPeers() {
assert (datanode.shouldRun == true && datanode.shutdownForUpgrade); assert (datanode.shouldRun == true && datanode.shutdownForUpgrade);
for (Peer p : peers.keySet()) { for (Thread t : peers.values()) {
// interrupt each and every DataXceiver thread. // interrupt each and every DataXceiver thread.
peers.get(p).interrupt(); t.interrupt();
} }
} }

View File

@ -187,12 +187,13 @@ boolean isFromEarlier() {
*/ */
public SnapshotDiffReport generateReport() { public SnapshotDiffReport generateReport() {
List<DiffReportEntry> diffReportList = new ArrayList<DiffReportEntry>(); List<DiffReportEntry> diffReportList = new ArrayList<DiffReportEntry>();
for (INode node : diffMap.keySet()) { for (Map.Entry<INode,byte[][]> drEntry : diffMap.entrySet()) {
diffReportList.add(new DiffReportEntry(DiffType.MODIFY, diffMap INode node = drEntry.getKey();
.get(node), null)); byte[][] path = drEntry.getValue();
diffReportList.add(new DiffReportEntry(DiffType.MODIFY, path, null));
if (node.isDirectory()) { if (node.isDirectory()) {
List<DiffReportEntry> subList = generateReport(dirDiffMap.get(node), List<DiffReportEntry> subList = generateReport(dirDiffMap.get(node),
diffMap.get(node), isFromEarlier(), renameMap); path, isFromEarlier(), renameMap);
diffReportList.addAll(subList); diffReportList.addAll(subList);
} }
} }