Skip to content

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

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

feat(go): implement Go leader redirection scenario#2580
chengxilo wants to merge 9 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 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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a validation step in the code. I set the maximum number of nodes to 64 to handle potential extreme cases. (I blieve in most cases this is too high so if it is prefered I can reduce it to 10 and maybe we can make it configurable)

@chengxilo chengxilo force-pushed the go_leader_redirection_scenario branch from 123e584 to 03477ba Compare February 5, 2026 22:33
@chengxilo chengxilo marked this pull request as draft February 5, 2026 22:34
@chengxilo chengxilo marked this pull request as ready for review February 6, 2026 04:55
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