HwangRock opened a new pull request, #5296:
URL: https://github.com/apache/zeppelin/pull/5296

   ### What is this PR for?
   
   `NoteManager.removeFolder` removed the deleted notes from `notesInfo` and 
the in-memory folder tree, but never evicted them from the `NoteCache`. 
`removeNote(String, AuthenticationInfo)` already calls 
`noteCache.removeNote(noteId)`, so the single-note path is clean; the folder 
path was not. As a result the `Note` objects for deleted notes stayed on the 
heap until the LRU threshold naturally evicted them, and they kept occupying 
cache slots that live notes could otherwise use. This is most wasteful for 
large folder deletions such as emptying the trash.
   
   This PR evicts each removed note from `noteCache` in the same loop that 
clears `notesInfo`, mirroring the single-note removal path. There is no 
functional/correctness change (`processNote` already gates on 
`notesInfo.containsKey`), only immediate reclamation of the cache slots and 
heap held by deleted notes.
   
   This was found by @ParkGyeongTae while reviewing #5288 / #5292 
(ZEPPELIN-6345).
   
   ### What type of PR is it?
   Improvement
   
   ### What is the Jira issue?
   * https://issues.apache.org/jira/browse/ZEPPELIN-6529
   
   ### How should this be tested?
   * Added `NoteManagerTest#testRemoveFolderEvictsNoteCache`: adds two notes 
under `/folder1`, asserts `getCacheSize() == 2`, calls 
`removeFolder("/folder1", ...)`, and asserts `getCacheSize() == 0`. Fails 
before the change (cache size stays `2`), passes after.
   * Full `NoteManagerTest` passes (6 tests), including `testLruCache` and 
`testNoteOperations`.
   
   ### Questions:
   * Does the license files need to update? No
   * Is there breaking changes for older versions? No
   * Does this needs documentation? No


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to