Skip to content

Commit

Permalink
Add two TODOs about locks taken in the wrong order
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmv committed Jul 12, 2023
1 parent 14f7bee commit fcabb9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private void failActive(FailingNode failing) {
// so we must release ours before failing the children.
List<FailingNode> activeChildrenToFail = new ArrayList<>();
boolean redeploy = false;
try (NodeMutex lock = nodeRepository().nodes().lockAndGetRequired(failing.node())) {
try (NodeMutex lock = nodeRepository().nodes().lockAndGetRequired(failing.node())) { // TODO: recursive lock for right order, only for hosts though
// Now that we have gotten the node object under the proper lock, sanity-check it still makes sense to fail
if (!Objects.equals(failing.node().allocation().map(Allocation::owner), lock.node().allocation().map(Allocation::owner)))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private boolean removeRetiredNodes(ApplicationId application) {
}
boolean redeploy = false;
List<String> nodesToDeactivate = new ArrayList<>();
try (var lock = nodeRepository().applications().lock(application)) {
try (var lock = nodeRepository().applications().lock(application)) { // TODO: take recusrive lock for right order
NodeList activeNodes = nodeRepository().nodes().list(Node.State.active);
Map<Removal, NodeList> nodesByRemovalReason = activeNodes.owner(application)
.retired()
Expand Down

0 comments on commit fcabb9a

Please sign in to comment.