sanepal commented on code in PR #15088: URL: https://github.com/apache/kafka/pull/15088#discussion_r1440860832
########## streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java: ########## @@ -1229,10 +1229,21 @@ private void tryToLockAllNonEmptyTaskDirectories() { final String namedTopology = taskDir.namedTopology(); try { final TaskId id = parseTaskDirectoryName(dir.getName(), namedTopology); - if (stateDirectory.lock(id)) { - lockedTaskDirectories.add(id); - if (!allTasks.containsKey(id)) { - log.debug("Temporarily locked unassigned task {} for the upcoming rebalance", id); + boolean lockedEmptyDirectory = false; + try { + if (stateDirectory.lock(id)) { + if (stateDirectory.directoryForTaskIsEmpty(id)) { + lockedEmptyDirectory = true; Review Comment: Thank you for the feedback! I updated to simplify the control flow and add a comment and log around the behavior. Please let me know how that looks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org