fix: (executor-client)Skip local assignment if no convergence with h…#7695
Conversation
…eartbeat Signed-off-by: edigregorio <edigregorio@uber.com>
Signed-off-by: edigregorio <edigregorio@uber.com>
Code Review ✅ Approved 1 resolved / 1 findingsClean change that surfaces assignment divergence as errors for proper handling in migration modes. The previously missing warn log has been restored, and tests properly verify the new error contract. ✅ 1 resolved✅ Quality: Removed warn log loses shard-id context for heartbeat divergence
Rules ✅ All requirements metRepository Rules
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
…eartbeat
What changed?
Modified compareAssignments() in clientimpl.go to return errors (ErrAssignmentDivergenceLocalShard and ErrAssignmentDivergenceHeartbeatShard) when local and heartbeat assignments diverge.
Updated four test functions in clientimpl_test.go to capture and verify these error return values, and fixed TestHeartbeatLoop_DistributedPassthrough_AppliesAssignment to pre-populate local shards for convergence testing. #6862
Why?
The compareAssignments() function needed to surface assignment divergence issues as errors rather than just logging/metrics, enabling proper error handling in migration modes (LOCAL_PASSTHROUGH_SHADOW and DISTRIBUTED_PASSTHROUGH). Tests were updated to verify that the correct errors are returned in divergence scenarios and nil on convergence, ensuring the error-handling contract is enforced.
How did you test it?
Ran go test ./service/sharddistributor/client/executorclient to verify all tests pass. Specifically verified:
Potential risks
SM is still in development phase, the deployed environment using sm don't show examples of shard_distributor_executor_assignment_divergence, so we don;t expect to skip any assignment, but just fixing something that colud be an issue in the future.
Release notes
Documentation Changes
Reviewer Validation
PR Description Quality (check these before reviewing code):
go testinvocation)