fix: delete hottier, query cache metric#1563
fix: delete hottier, query cache metric#1563nikhilsinhaparseable merged 1 commit intoparseablehq:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughIntroduces tenant-aware path resolution for hot-tier storage operations and updates query cache hit metrics to include tenant context; object store URL selection in stream schema provider is simplified to always use the glob storage URL. Changes
Sequence Diagram(s)(omitted — changes are localized path/metric updates and do not introduce a new multi-component control flow requiring visualization) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hottier.rs (1)
106-114:⚠️ Potential issue | 🟠 MajorLogic error: condition excludes valid streams from hot tier size calculation.
The condition
stream != current_stream && tenant_id != *current_tenant_iduses AND, which incorrectly excludes streams that match either the current stream name or the current tenant. The intent is to exclude only the specific (stream, tenant) pair.For example, with
current_stream="A"andcurrent_tenant="T1":
stream="A", tenant="T2"→ excluded (wrong - different tenant, should include)stream="B", tenant="T1"→ excluded (wrong - different stream, should include)🐛 Fix: Use OR or negated equality
if self.check_stream_hot_tier_exists(&stream, &tenant_id) - && stream != current_stream - && tenant_id != *current_tenant_id + && !(stream == current_stream && tenant_id == *current_tenant_id) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hottier.rs` around lines 106 - 114, The loop condition incorrectly uses && to exclude streams, causing any stream that matches either current_stream or current_tenant_id to be skipped; change the predicate in the for loop (where PARSEABLE.streams.list, check_stream_hot_tier_exists, and get_hot_tier are used) so that only the exact pair (stream == current_stream && tenant_id == *current_tenant_id) is excluded — e.g., replace the current_stream/tenant check with its negation (not (stream == current_stream && tenant_id == *current_tenant_id)) or use || (stream != current_stream || tenant_id != *current_tenant_id) so you still call get_hot_tier for other streams/tenants.
🧹 Nitpick comments (1)
src/hottier.rs (1)
216-223: Consider cleaning up empty tenant directories after stream deletion.After deleting
hot_tier_path/tenant_id/stream, thehot_tier_path/tenant_id/directory may remain empty. While this doesn't cause functional issues, you could reuse the existingdelete_empty_directory_hot_tier()helper (used incleanup_hot_tier_old_data) to clean up the parent tenant directory if it becomes empty.♻️ Optional cleanup
let path = if let Some(tenant_id) = tenant_id.as_ref() { self.hot_tier_path.join(tenant_id).join(stream) } else { self.hot_tier_path.join(stream) }; fs::remove_dir_all(&path).await?; + // Clean up empty parent directories + if let Some(parent) = path.parent() { + let _ = delete_empty_directory_hot_tier(parent.to_path_buf()).await; + } Ok(())🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hottier.rs` around lines 216 - 223, When deleting the stream directory, ensure you also remove the parent tenant directory if it becomes empty: after calling fs::remove_dir_all(path).await? for the stream, if tenant_id.as_ref() is Some(...), call the existing helper delete_empty_directory_hot_tier() (the same helper used by cleanup_hot_tier_old_data) with the tenant path (self.hot_tier_path.join(tenant_id)) to clean up the empty tenant directory; keep the existing error handling and only invoke the helper for the tenant branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/hottier.rs`:
- Around line 106-114: The loop condition incorrectly uses && to exclude
streams, causing any stream that matches either current_stream or
current_tenant_id to be skipped; change the predicate in the for loop (where
PARSEABLE.streams.list, check_stream_hot_tier_exists, and get_hot_tier are used)
so that only the exact pair (stream == current_stream && tenant_id ==
*current_tenant_id) is excluded — e.g., replace the current_stream/tenant check
with its negation (not (stream == current_stream && tenant_id ==
*current_tenant_id)) or use || (stream != current_stream || tenant_id !=
*current_tenant_id) so you still call get_hot_tier for other streams/tenants.
---
Nitpick comments:
In `@src/hottier.rs`:
- Around line 216-223: When deleting the stream directory, ensure you also
remove the parent tenant directory if it becomes empty: after calling
fs::remove_dir_all(path).await? for the stream, if tenant_id.as_ref() is
Some(...), call the existing helper delete_empty_directory_hot_tier() (the same
helper used by cleanup_hot_tier_old_data) with the tenant path
(self.hot_tier_path.join(tenant_id)) to clean up the empty tenant directory;
keep the existing error handling and only invoke the helper for the tenant
branch.
Fixes #XXXX.
Description
This PR has:
Summary by CodeRabbit