Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed RemoteWeavelet UpdateRoutingInfo bugs. #529

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

mwhittaker
Copy link
Member

This PR fixes four bugs in RemoteWeavelet's UpdateRoutingInfo.

  1. Before this PR, UpdateRoutingInfo would panic if you passed it a nil RoutingInfo. This PR fixes UpdateRoutingInfo to instead return an error.
  2. Recall that a component is either always local or always remote. We don't currently allow a component to switch between the two. This PR adds code to UpdateRoutingInfo to check this.
  3. Before this PR, we were using the assignment from one component as the assignment for all components' load collectors.
  4. UpdateRoutingInfo updates a resolver, balancer, and load collector. Before this PR, it was possible to update the load collector but not the resolver or balancer. This PR reorders things so either all are updated or none of them are. The update is still not transactional, as concurrent calls to UpdateRoutingInfo can interleave. We should consider fixing that in a future PR.

@mwhittaker mwhittaker requested a review from spetrovic77 August 15, 2023 21:55
@mwhittaker mwhittaker self-assigned this Aug 15, 2023
Copy link
Contributor

@spetrovic77 spetrovic77 left a comment

Choose a reason for hiding this comment

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

🏆

routing := fmt.Sprint(req.RoutingInfo.Replicas)
if req.RoutingInfo.Local {
routing = "local"
name := "?"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch.

This is too magical, would the following make sense:

func (w *RemoteWeavelet) UpdateRoutingInfo(...) (...) {
  if req.RoutingInfo == nil {
    w.syslogger.Debug("nil RoutingInfo")
    return nil, fmt.Errorf("nil RoutingInfo")
  }
  info := req.RoutingInfo
  defer func() {
    // assume info != nil
    ...
  }()
  ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Much better, thanks!

@mwhittaker mwhittaker force-pushed the remoteweavelet_tests branch from 8c399c9 to cc31f73 Compare August 21, 2023 16:59
Base automatically changed from remoteweavelet_tests to main August 21, 2023 17:05
This PR fixes four bugs in RemoteWeavelet's UpdateRoutingInfo.

1. Before this PR, UpdateRoutingInfo would panic if you passed it a nil
   RoutingInfo. This PR fixes UpdateRoutingInfo to instead return an
   error.
2. Recall that a component is either always local or always remote. We
   don't currently allow a component to switch between the two. This PR
   adds code to UpdateRoutingInfo to check this.
3. Before this PR, we were using the assignment from one component as
   the assignment for all components' load collectors.
4. UpdateRoutingInfo updates a resolver, balancer, and load collector.
   Before this PR, it was possible to update the load collector but not
   the resolver or balancer. This PR reorders things so either all are
   updated or none of them are. The update is still not transactional,
   as concurrent calls to UpdateRoutingInfo can interleave. We should
   consider fixing that in a future PR.
@mwhittaker mwhittaker force-pushed the update_routing_info_fixes branch from 3376e82 to 9c59642 Compare August 21, 2023 17:12
@mwhittaker mwhittaker merged commit 1a00443 into main Aug 21, 2023
@mwhittaker mwhittaker deleted the update_routing_info_fixes branch August 21, 2023 17:18
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