add tenant cleanup methods for in-memory structs on tenant deletion#1591
add tenant cleanup methods for in-memory structs on tenant deletion#1591nikhilsinhaparseable wants to merge 2 commits intoparseablehq:mainfrom
Conversation
1. deregister the schema for a tenant on deletion 2. remove in-memory dashboards for a tenant 3. remove in-memory filters for a tenant 4. remove in-memory alerts for a tenant
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdded tenant-cleanup APIs: an alert manager method to delete all alerts for a tenant, a query context method to remove a tenant schema, and tenant-delete methods for in-memory dashboards and filters; each acquires appropriate locks and removes tenant entries. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/alerts/mod.rs`:
- Around line 1488-1490: delete_all_for_tenant only removes the in-memory map
entry and doesn't stop any scheduled alert tasks; update delete_all_for_tenant
to first normalize tenant_id using the same normalization as
object_store_metastore::get_alerts() (map empty -> DEFAULT_TENANT), then acquire
the alerts write lock and cancel/stop any scheduled task handles associated with
that tenant (abort/stop task handles or remove them from whatever
scheduler/handle map you maintain), remove those handles from the internal
structures, and finally remove the tenant entry from self.alerts (currently
referenced as self.alerts.write().await.remove(tenant_id)); ensure you reference
DEFAULT_TENANT and the existing alerts/scheduler handle collections when
locating and cancelling tasks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9d8152fc-1563-47ae-b655-82e566339386
📒 Files selected for processing (5)
src/alerts/alert_traits.rssrc/alerts/mod.rssrc/query/mod.rssrc/users/dashboards.rssrc/users/filters.rs
Summary by CodeRabbit