← Back to Pull requests

[ZEPPELIN-6529] Evict note cache entries when removing a folder #5296

Closed
unknown closed this pull request without merging on Jul 14, 2026 02:45 UTC
View on GitHub
unknown unknown commented on Jul 13, 2026 13:29 UTC
Author

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

Diff: 203 lines (+152 / -51) across 2 files Reviewer: ParkGyeongTae Review duration: 796m
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
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.3% (MEDIUM) · Higher = larger blast radius
36.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.3% · Safe to merge
14.3%