Skip to content

feat(go): implement Go leader redirection scenario#2580

Open
chengxilo wants to merge 6 commits intoapache:masterfrom
chengxilo:go_leader_redirection_scenario
Open

feat(go): implement Go leader redirection scenario#2580
chengxilo wants to merge 6 commits intoapache:masterfrom
chengxilo:go_leader_redirection_scenario

Conversation

@chengxilo
Copy link
Contributor

go leader redirection scenario implement

What I did

  1. Implement Go leader redirection scenario and related logic.
  2. Rearranged package layout to avoid cyclic dependencies introduced by the redirection logic.
  3. Renamed package iggycli → client (clarifies that this is the Iggy client, instead of CLI)
  4. New types like TransportEndpoints implement MarshalBinary/UnmarshalBinary(implement encoding.BinaryMarshaler/ encoding.Unmarshaler interface) instead of create a function like SerializeTransportEndpoints/DeserializeEndpoints. We may replace the previous approach later.

Notes

  1. Package rename: code importing iggycli must update to client
  2. Replace the DeserializeXXX/SerializeXXX with implmenting MarshalBinary/UnmarshalBinary in the future.

Copy link
Contributor

@hubcio hubcio left a comment

Choose a reason for hiding this comment

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

Trying to find someone to review it.

return false, nil
}

func (c *IggyTcpClient) LoginWithPersonalAccessToken(token string) (*iggcon.IdentityInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

LoginUser has leader redirection logic, but LoginWithPersonalAccessToken does not

return err
}

m.Nodes = make([]ClusterNode, 0, nodesCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

malformed packet with nodesCount = 0xFFFFFFFF would attempt to allocate memory for 4 billion slots, limit it to max 10 nodes or so

c.mtx.Unlock()

if err = c.disconnect(); err != nil {
return false, err
Copy link
Contributor

Choose a reason for hiding this comment

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

if disconnect fails after IncrementRedirect() was called, the redirect counter remains incremented but no redirection actually occurred.

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