feat: Update deletion trigger to run on statement - BED-8796#100
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
WalkthroughPostgreSQL delete cascading now uses a statement-level trigger with a transition table for deleted node ids. A new manual integration test verifies batch node deletion and remaining node/edge counts. Go module versions are also updated. ChangesStatement-level cascade delete trigger
Go dependency updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@integration/pgsql_delete_cascade_test.go`:
- Around line 105-107: The cascade-delete assertion is currently querying via
countByCypher on CascadeDeleteNode/CascadeDeleteEdge, which only sees
relationships whose endpoints still exist. Update the pgsql_delete_cascade_test
check to count the edge table directly with a SQL count(*) against the edge
storage so orphaned CascadeDeleteEdge rows are detected; keep the existing
expectation and adjust the helper usage in this test block accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 71bb1960-c899-4331-b423-44347be4b163
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
drivers/pg/query/sql/schema_up.sqlgo.modintegration/pgsql_delete_cascade_test.go
zinic
left a comment
There was a problem hiding this comment.
This looks completely reasonable to me. No nits from my side.
Description
BloodHound primarily works with PG in batch data, it is rare for the application to delete a single node or edge. By moving the table trigger to delete edges associated with nodes to
FOR EACH STATEMENT, batch node deletes will call a single edge deletion, rather than running for every deleted node, improving DB performance across all deletions.Resolves: BED-8796
Type of Change
Testing
make test_allwithCONNECTION_STRINGset)Screenshots (if appropriate):
Driver Impact
drivers/pg)drivers/neo4j)Checklist
go.mod/go.sumare up to date if dependencies changedSummary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests
Chores