Skip to content

[chore] Log each failed storage unit once in clear_data, with what it kept - #198

Merged
0oshowero0 merged 1 commit into
Ascend:mainfrom
0oshowero0:chore/clear-data-failure-log
Oct 15, 2026
Merged

0oshowero0 merged 1 commit into
Ascend:mainfrom
0oshowero0:chore/clear-data-failure-log

Conversation

@0oshowero0

Copy link
Copy Markdown
Collaborator

Problem

When a storage unit fails to clear, AsyncSimpleStorageManager.clear_data logs it and returns, so kv_clear, clear_samples and clear_partition still release the controller metadata. That is intended: the caller no longer wants the data, and failing its cleanup would stop the job. Since #190 the payloads a unit keeps can no longer be read or merged into a later kv_update. They only take memory until their indexes are reused and cleared.

The log for such a failure is hard to use. Each failed unit produces two lines, and the second names only the index of the gather task:

[TQ_STORAGE_...]: Error clearing storage unit TQ_STORAGE_UNIT_1: unit timeout
[TQ_STORAGE_...]: Error in clear operation task 1: unit timeout

Neither line says how much data the unit still holds.

Change

clear_data logs one line per failed unit, with the unit, the number of samples and the fields it still holds, and the error:

[TQ_STORAGE_...]: Failed to clear 2 samples (fields=all) on storage unit TQ_STORAGE_UNIT_1; they stay in its memory: RuntimeError: unit timeout

_clear_single_storage_unit no longer logs before re-raising, so each failure is logged once. A short comment in clear_data records why a failure is logged rather than raised.

Behavior is unchanged: a failed unit is still not raised, and every unit is still attempted.

Tests

  • tests/test_async_simple_storage_manager.py::test_clear_data_routes_from_hash now also fails one of two units. It checks that clear_data does not raise, that the other unit is still cleared, and that exactly one log line names the failed unit, its sample count and the error. That part fails without the change.
  • python -m compileall -q transfer_queue tutorial tests, ruff check and ruff format --check pass.
  • python -m pytest -q: 851 passed, 12 skipped. The 8 errors are in tests/test_yuanrong_storage_client_e2e.py and are environment-only; they occur on main too.

A failed clear logged two lines per unit: one from _clear_single_storage_unit
and one naming only the gather task index. Log one line per failed unit
instead, with the unit id, the number of samples and fields it still holds,
and the error. Behavior is unchanged: the failure is still logged rather than
raised, so a cleanup failure does not stop the caller's job.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T11:02:33.666575Z d1ccf41 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1ccf4141b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

logger.error(f"[{self.storage_manager_id}]: Error in clear operation task {i}: {result}")
logger.error(
f"[{self.storage_manager_id}]: Failed to clear {len(group.global_indexes)} samples "
f"(fields={fields or 'all'}) on storage unit {su_id}; they stay in its memory: "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report timed-out clears as unconfirmed

When a send/receive timeout happens after CLEAR_DATA is on the wire, the storage unit can already have completed the deletion; ZMQSocketPool.lease even discards the socket because a reply may still arrive (transfer_queue/utils/zmq_utils.py:496-497). This new message nevertheless states that the samples stay in memory, so the failure log can falsely report retained data—the key state this change is meant to expose. Describe the clear as unconfirmed/data as possibly remaining instead.

AGENTS.md reference: AGENTS.md:L5-L9

Useful? React with 👍 / 👎.

@0oshowero0
0oshowero0 merged commit 1d1e9d6 into Ascend:main Oct 15, 2026
8 checks passed
@0oshowero0
0oshowero0 deleted the chore/clear-data-failure-log branch October 15, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants