[ZEPPELIN-6529] Evict note cache entries when removing a folder #5296
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 203 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.318
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5296"
general
weight: 0.35
ParkGyeongTae
What is this PR for?
NoteManager.removeFolderremoved the deleted notes fromnotesInfoand the in-memory folder tree, but never evicted them from theNoteCache.removeNote(String, AuthenticationInfo)already callsnoteCache.removeNote(noteId), so the single-note path is clean; the folder path was not. As a result theNoteobjects 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
noteCachein the same loop that clearsnotesInfo, mirroring the single-note removal path. There is no functional/correctness change (processNotealready gates onnotesInfo.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, assertsgetCacheSize() == 2, callsremoveFolder("/folder1", ...), and assertsgetCacheSize() == 0. Fails before the change (cache size stays2), passes after.Full
NoteManagerTestpasses (6 tests), includingtestLruCacheandtestNoteOperations.Questions:
Does the license files need to update? No
Is there breaking changes for older versions? No
Does this needs documentation? No