Conversation
Fix verified RED->GREEN. YARN-11963 rolling log aggregation leaks local files - single deletionTask overwritten per loop only last container deleted
|
💔 -1 overall
This message was automatically generated. |
| String diagnosticMessage = ""; | ||
| boolean logAggregationSucceedInThisCycle = true; | ||
| DeletionTask deletionTask = null; | ||
| List<DeletionTask> deletionTasks = new ArrayList<>(); |
There was a problem hiding this comment.
Could we add a regression test for the actual multi-container case?
The existing TestAppLogAggregatorImpl coverage exercises only one container, so both the original single-variable implementation and this patch pass the current suite.
The test class already provides AppLogAggregatorInTest and a mocked DeletionService that inspects FileDeletionTask#getBaseDirs().
Could we extend it to start two containers with distinct log files and assert that the deletion tasks contain files from both containers?
This is the exact cardinality that triggers YARN-11963 and would prevent the overwrite bug from being reintroduced.
Add a regression test for YARN-11963. TestAppLogAggregatorImpl only ever exercised a single container, so both the previous single-variable implementation and the fix pass the existing suite. The new test starts two containers with distinct log files in one aggregation cycle and asserts that the uploaded files of both are scheduled for deletion. Verified RED->GREEN: against the single-variable implementation it fails with only the last container's files scheduled.
|
Thanks @slfan1989 - good catch, that was exactly the gap. Added in 040fa44.
Two notes on how it is written:
Verified RED -> GREEN locally. Against the single-variable implementation: Only the last container's files, which is the YARN-11963 cardinality. With the patch the full class passes, 5/5. Checkstyle on the module reports no new violations from the added code. |
|
💔 -1 overall
This message was automatically generated. |
|
CI came back on the test commit. The two remaining -1s are not from this patch, they are identical to the run before the
So the only delta between the two runs is test4tests going -1 -> +1. Happy to take further |
Description of PR
Fixes YARN-11963. Rolling log aggregation leaked local container log files
because
AppLogAggregatorImplreused a singleDeletionTaskvariable insidethe per-container loop, overwriting it on each iteration. Only the last
container's log directory was ever scheduled for deletion, so files for every
earlier container in the same aggregation cycle were left on disk.
The fix collects one
FileDeletionTaskper container into aList<DeletionTask>and, when aggregation succeeds, submits every task in thelist from the
finallyblock instead of a single overwritten reference.How was this patch tested?
Added
testAggregatorDeletesUploadedLogsOfEveryContainerInACycletoTestAppLogAggregatorImpl. It starts two containers with distinct log files ina single aggregation cycle and asserts that the uploaded files of both are
scheduled for deletion. The test uses a recording
DeletionServicethataccumulates
FileDeletionTask#getBaseDirs()across every invocation. It assertscontainment rather than set equality, because the aggregator also schedules the
application log directory itself for cleanup once the application finishes.
Against the single-variable implementation the test fails:
With the patch the full class passes, 5/5. Checkstyle on the module reports no
new violations. CI:
test4testsis +1 andunitpassed thehadoop-yarn-server-nodemanagermodule.For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles? (not applicable)