Skip to content

[fix] Raise in put when the controller rejects the written data - #197

Merged
0oshowero0 merged 2 commits into
Ascend:mainfrom
0oshowero0:fix/put-rejected-notify
Oct 15, 2026
Merged

0oshowero0 merged 2 commits into
Ascend:mainfrom
0oshowero0:fix/put-rejected-notify

Conversation

@0oshowero0

@0oshowero0 0oshowero0 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A put could return normally even when the controller failed to record the written data, for example because a field's dtype conflicted with earlier writes in the partition. Storage managers write payloads before notifying the controller: a rejected new key remains unreadable, while an overwrite of an already-ready field can remain visible under stale controller metadata.

Change

  • Report controller failures through the existing REQUEST_ERROR reply. The controller request loop catches the exception, sends the error, and continues serving requests.
  • Have the storage manager recognize both ACK and REQUEST_ERROR replies. Explicit controller errors raise at the writer immediately; they are no longer ignored until timeout. The error is raised outside the transport exception handler so it reaches the caller.
  • Keep ACKs to a single success flag. False means the partition no longer exists, so a late writer only warns. A missing reply still returns False from notify_data_update, because the controller may yet apply the update.
  • Preserve kv_update's warning that a committed merge must not be retried blindly, and include the controller's error without depending on its wording.
  • Correct the put docstrings: failed writes do not roll back stored payloads, and overwrites of ready fields may remain visible.

The same client can catch a dtype rejection and put corrected data without restarting the controller or client. A failed put can already have overwritten the previous value; callers must supply the correct replacement data when retrying.

Validation

  • python -m compileall -q transfer_queue tutorial tests passes.
  • Ruff lint and format checks pass for the changed files.
  • Full pytest run with TQ_TEST_BACKEND=SimpleStorage: 860 passed, 12 skipped, 8 errors. The eight errors match the baseline: Yuanrong test fixtures cannot patch datasystem when its optional dependency is absent.
  • Sync and async end-to-end tests verify that a rejected put can be corrected with the same client, including an overwrite that remains readable until corrected.
  • Regression tests cover immediate propagation of REQUEST_ERROR, accepted/missing/cleared-partition ACK behavior, the cleared-partition warning, and the committed-merge error.

Mooncake and Yuanrong service integration was not run.

Found while reviewing #190.

notify_data_update returned False both when no ACK arrived and when the
controller rejected the update (e.g. a dtype conflict), and put_data and
restore ignored it. A rejected kv_put returned normally while none of its
fields became ready: the samples silently never reached kv_batch_get or
the dataloader, and the later error pointed at kv_update(finalize=False).

The controller ACK now says why it rejected an update and whether the
partition still exists, and notify_data_update raises on a rejection.
Unchanged: a missing ACK still returns False, since the controller may
still apply it, and a partition cleared while its data was in flight only
logs a warning, so a late writer does not fail.

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:01

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-15T10:07:55.655914Z 32bfb3d 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: 32bfb3dc41

ℹ️ 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".

Comment thread transfer_queue/controller.py Outdated
)
# A rejected write makes the writer raise. A partition cleared while its data was in flight
# only makes the writer warn: that data is no longer wanted.
partition_exists = self._get_partition(cast(str, partition_id)) is not None

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 Recheck partition existence after failed updates

When a direct Ray clear_partition.remote call (the path used by the e2e fixtures) removes a partition between this lookup and update_production_status, the latter returns False for the now-missing partition while partition_exists remains True. The ACK is then classified as a controller rejection and notify_data_update raises, instead of taking the warning-only path promised for an in-flight clear; return the missing-partition status from the update itself or recheck it after a false result.

AGENTS.md reference: AGENTS.md:L17-L18

Useful? React with 👍 / 👎.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
@0oshowero0 0oshowero0 changed the title [fix] Raise in put when the controller rejects the written data [fix] Raise in put when the controller rejects the written data Oct 15, 2026
@0oshowero0
0oshowero0 merged commit 5fe4e49 into Ascend:main Oct 15, 2026
8 checks passed
@0oshowero0
0oshowero0 deleted the fix/put-rejected-notify branch October 15, 2026 12:46
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