Skip to content

Commit 34c1c50

Browse files
author
huanghaibin
committed
fix TestDecommission#testDecommissionWithOpenfileReporting
1 parent fb5fa0a commit 34c1c50

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,11 @@ public BatchedListEntries<OpenFileEntry> getFilesBlockingDecom(long prevId,
19961996
LightWeightHashSet<Long> openFileIds = new LightWeightHashSet<>();
19971997
for (DatanodeDescriptor dataNode :
19981998
blockManager.getDatanodeManager().getDatanodes()) {
1999-
for (long ucFileId : dataNode.getLeavingServiceStatus().getOpenFiles()) {
1999+
// Sort open files
2000+
LightWeightHashSet<Long> dnOpenFiles = dataNode.getLeavingServiceStatus().getOpenFiles();
2001+
Long[] dnOpenFileIds = new Long[dnOpenFiles.size()];
2002+
Arrays.sort(dnOpenFiles.toArray(dnOpenFileIds));
2003+
for (Long ucFileId : dnOpenFileIds) {
20002004
INode ucFile = getFSDirectory().getInode(ucFileId);
20012005
if (ucFile == null || ucFileId <= prevId ||
20022006
openFileIds.contains(ucFileId)) {

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/FoldedTreeSet.java

Whitespace-only changes.

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/FoldedTreeSetTest.java

Whitespace-only changes.

0 commit comments

Comments
 (0)