rocketmq-rust icon indicating copy to clipboard operation
rocketmq-rust copied to clipboard

[Refactor♻️] Rename MetadataIoReceipt::wait_until_outcome to wait_for_persistence_status_until

Open mxsm opened this issue 1 week ago • 1 comments

Target Code

Rename the public method on rocketmq_runtime::MetadataIoReceipt. A downstream caller should be able to migrate with this one-line edit.

-let status = receipt.wait_until_outcome(deadline).await?;
+let status = receipt.wait_for_persistence_status_until(deadline).await?;

Problems

The existing Rustdoc says the method waits for the snapshot to become durable. It actually waits for the actor to deliver a terminal MetadataWritePersistenceStatus by an absolute deadline. Ok(status) can report a durable generation, a failure before replacement, or unconfirmed durability. A newer coalesced generation can satisfy an earlier receipt. Expiry ends the caller's wait while the admitted write can still finish. Current implementation

Proposed Changes

Implementation and callers

  • [ ] In rocketmq-runtime/src/metadata_io.rs, rename the method. Keep the consuming self, the deadline: MetadataDeadline parameter, and the RuntimeResult<MetadataWritePersistenceStatus> return type. Update its Rustdoc summary and # Errors section. An elapsed deadline yields the WaitForDurableMetadata timeout error. A stopped worker or closed coordinator channel yields a MetadataWorkerStopped error. Update the intra-doc link on the private ReceiptConclusion enum as well. Private Rustdoc link
  • [ ] In the same file, update the delegate call inside MetadataIoReceipt::wait_until. This wrapper still returns the durable generation or propagates an error. Generation wrapper
  • [ ] Update the accepted-receipt branches of MetadataIoActor::submit_commit and MetadataIoActor::submit_next_commit. Both wrap the returned status in MetadataWriteCompletionStatus::Completed. submit_commit and submit_next_commit

Two direct test calls in rocketmq-runtime/tests/metadata_io_actor.rs

  • [ ] In retirement_keeps_unknown_outcome_fenced_and_old_actor_cannot_rebind_a_retired_history, change the call on receipt. Preserve the assertions on the unconfirmed status and the reconciliation fence. Retirement assertion
  • [ ] In unconfirmed_commit_fences_a_target_that_still_has_queued_work, change the call on first. The later second.wait_until(deadline) checks the confirmed generation and should keep calling that wrapper. Queued-write assertions

Release documentation

Related issues #13090 and #13091 cover the inner status variant and the observation field respectively. This task can land independently.

Verify from the repository root

cargo fmt -p rocketmq-runtime -- --check
cargo test --locked -p rocketmq-runtime --test metadata_io_actor
cargo rustdoc --locked -p rocketmq-runtime --lib -- --document-private-items -D rustdoc::broken_intra_doc_links

The integration tests exercise both direct calls, both submission wrappers, coalesced generations, and a deadline expiring while the accepted write continues. The Rustdoc command checks the renamed link on private items. A final search with rg -n -w -g '*.rs' 'wait_until_outcome' . should find no Rust references to the old method. The migration guide and changelog should mention both spellings.

mxsm avatar Nov 27 '26 03:11 mxsm

I'll take this one. I'll rename the receipt method, update its callers and migration notes, and verify the actor tests and private Rustdoc links.

lipeh1 avatar Nov 27 '26 03:11 lipeh1