Ensure multi delete specs dont terminate half way through#620
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent multi-spec delete operations from aborting early when one delete spec fails (e.g., due to an ETS table already being deleted), and adds coverage for that scenario.
Changes:
- Make
ra_mt:delete({multi, Specs})resilient tobadargso remaining specs are still processed. - Add a new Common Test case to exercise “missing Tid in multi delete” behavior.
- Improve warning logging in
ra_log_segments:segment_read_plan/4to include segref count and a bounded pretty-print of remaining segrefs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
test/ra_mt_SUITE.erl |
Adds a regression test for multi-spec delete when one Tid is missing. |
src/ra_mt.erl |
Wraps multi-spec delete execution to continue after badarg. |
src/ra_log_segments.erl |
Updates warning log message/format for missing read plan segrefs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure ra_mt:delete/1 can process multi-delete specs without terminating early when one of the referenced ETS tables has already been deleted (missing Tid).
Changes:
- Add a regression test covering multi-spec delete behavior when an earlier Tid is missing.
- Make
ra_mt:delete({multi, Specs})resilient tobadargerrors during per-spec deletion. - Improve warning context in
ra_log_segments:segment_read_plan/4when indexes can’t be found.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/ra_mt_SUITE.erl |
Adds a test ensuring multi-spec delete continues after encountering a missing Tid. |
src/ra_mt.erl |
Wraps per-spec deletion in try/catch to skip badarg and continue folding remaining specs. |
src/ra_log_segments.erl |
Expands WARN log details for missing indexes/segment refs (but currently has a formatting issue). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent multi-spec memtable delete operations from terminating early when one of the delete specs hits an error (e.g., an ETS table in the spec has already been deleted).
Changes:
- Adds a new Common Test case covering multi-spec delete behavior when an earlier
{delete, Tid}refers to a missing ETS table. - Updates
ra_mt:delete/1for{multi, Specs}to toleratebadargduring per-spec deletion rather than aborting the whole fold. - Tweaks a warning log in
ra_log_segments:segment_read_plan/4to include additional context about remaining segrefs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/ra_mt_SUITE.erl |
Adds coverage to ensure multi-spec delete continues after an earlier missing-Tid failure. |
src/ra_mt.erl |
Wraps per-spec delete in a try/catch so one failing spec doesn’t stop subsequent specs. |
src/ra_log_segments.erl |
Expands warning log context for missing segment refs during read plan creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure multi-spec deletion in ra_mt continues executing remaining delete specs even if one spec fails (e.g., when an ETS table has already been deleted).
Changes:
- Add a CT test that simulates a “missing ETS tid” during multi-spec deletion and asserts later specs still run.
- Update
ra_mt:delete/1for{multi, Specs}to toleratebadargduring per-spec deletion. - Adjust a warning log format in
ra_log_segments:segment_read_plan/4.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/ra_mt_SUITE.erl |
Adds a regression test covering multi-spec delete behavior when a referenced ETS table is missing. |
src/ra_mt.erl |
Wraps per-spec deletes in try/catch so multi deletes continue after a badarg. |
src/ra_log_segments.erl |
Tweaks warning log formatting / contents for missing-index read plan scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent multi-spec deletion from terminating early when one spec fails (e.g., an ETS table has already been deleted), improving robustness of memtable cleanup.
Changes:
- Add a regression test covering multi-spec delete behavior when an earlier
{delete, Tid}target is missing. - Update
ra_mt:delete/1for{multi, Specs}to continue processing after abadargduring an individual spec delete. - Minor snapshot-send error handling/logging adjustments and a log formatting tweak in segment read planning.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/ra_mt_SUITE.erl |
Adds multi_spec_delete_with_missing_tid to validate multi-spec delete continues after an earlier missing-Tid failure. |
src/ra_mt.erl |
Wraps per-spec deletion in try/catch so one badarg doesn’t abort the entire multi delete. |
src/ra_server_proc.erl |
Adds a try/catch around send_pre_snapshot_entries/6 and log formatting changes in snapshot send path. |
src/ra_log_segments.erl |
Tweaks WARN formatting to include remaining segref count and pretty-print segrefs with a depth limit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b938cd2 to
74acd5a
Compare
This commit addresses several issues across memtable cleanup and snapshotting:
- `ra_mt`: Update `delete({multi, Specs})` to catch `badarg` exceptions. This ensures that if an ETS table in the spec was already deleted (e.g., by an accelerated cleanup or another operation), the deletion process gracefully skips it and continues with the remaining specs instead of crashing.
- `ra_server_proc`: Enhance error handling in `send_snapshots/9` by wrapping `send_pre_snapshot_entries` in a `try...catch` block to log errors and safely re-raise them using `safe_stacktrace/1`. Also improves log formatting and clarifies `UID` pattern matching.
- `ra_log_segments`: Fix a format specifier mismatch in a warning log (changed `~w` to `~b` and added `~0P` for segment references).
- `ra_mt_SUITE`: Add the `multi_spec_delete_with_missing_tid` test to verify the new resilient multi-spec deletion behavior.
74acd5a to
630166d
Compare
Fix memtable multi-spec deletion and improve snapshot error handling
This commit addresses several issues across memtable cleanup and snapshotting:
ra_mt: Updatedelete({multi, Specs})to catchbadargexceptions. This ensures that if an ETS table in the spec was already deleted (e.g., by an accelerated cleanup or another operation), the deletion process gracefully skips it and continues with the remaining specs instead of crashing.ra_server_proc: Enhance error handling insend_snapshots/9by wrappingsend_pre_snapshot_entriesin atry...catchblock to log errors and safely re-raise them usingsafe_stacktrace/1. Also improves log formatting and clarifiesUIDpattern matching.ra_log_segments: Fix a format specifier mismatch in a warning log (changed~wto~band added~0Pfor segment references).ra_mt_SUITE: Add themulti_spec_delete_with_missing_tidtest to verify the new resilient multi-spec deletion behavior.