Skip to content

HDDS-12760. Intermittent Timeout in testImportedContainerIsClosed #8349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ private DatanodeDetails chooseNode(List<DatanodeDetails> excludedNodes,
" excludedNodes and affinityNode constrains.", null);
}

if (usedNodes != null && usedNodes.contains(node)) {
excludedNodesForCapacity.add(node.getNetworkFullPath());
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excludedNodesForCapacity can be null, needs to initialise if it is null.

}

if (isValidNode(node, metadataSizeRequired, dataSizeRequired)) {
metrics.incrDatanodeChooseSuccessCount();
if (isFallbacked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,19 @@ public void chooseNodeWithUsedAndFavouredNodesMultipleRack()
assertEquals(favouredNodes.get(0), datanodeDetails.get(0));

}

@Test
public void testSourceDatanodeIsNotChosenAsTarget() {
setup(2);
List<DatanodeDetails> usedNodes = new ArrayList<>();
usedNodes.add(datanodes.get(0));
dnInfos.get(1).setNodeStatus(NodeStatus.inServiceHealthyReadOnly());

Exception e =
assertThrows(SCMException.class,
() -> policy.chooseDatanodes(usedNodes, null, null, 1, 0, 0),
"No target datanode, this call should fail");

assertEquals("SCMException", e.getClass().getSimpleName());
}
}