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

BMM Restart Improvements Part 1. Leader Coordinator Issuing Assignment Tokens #919

Merged
merged 7 commits into from
Dec 14, 2022

Conversation

jzakaryan
Copy link
Collaborator

@jzakaryan jzakaryan commented Dec 7, 2022

This pull request is part of a series of changes that are meant to improve BMM Restart and make it easier to debug restart failures and trace them to the faulty hosts. It introduces the concept of assignment tokens and adds support for issuing those tokens by the leader coordinator. This feature can be toggled by the newly introduced brooklin.server.coordinator.enableAssignmentTokens configuration.

The subsequent PRs will deal with the following aspects:
Part 2 – Changes to the followers' onAssignmentChange to make them claim the tokens issued by the leader.
Part 3 – Changes to the leader to make it poll the ZooKeeper and wait for the assignment change (stop) to be propagated and executed by the cluster. This will also include code for handling assignment failures and signals to the client that problem(s) occurred in the form of log messages and a new metric.
Part 4 – This one will deal with edge cases and cleanup. More specifically, what happens when a leader fails over during an assignment (assignment token nodes are persistent and their lifecycle is tied to that of the parent datastream).

Copy link
Collaborator

@ehoner ehoner left a comment

Choose a reason for hiding this comment

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

I can approve again if you want to change the json serialization.

Comment on lines +71 to +90
/**
* Sets the name of the leader host that issued the token
*/
public void setIssuedBy(String issuedBy) {
_issuedBy = issuedBy;
}

/**
* Sets the name of the host for which the token was issued
*/
public void setIssuedFor(String issuedFor) {
_issuedFor = issuedFor;
}

/**
* Sets the timestamp (in UNIX epoch format) for when the token was issued
*/
public void setTimestamp(long timestamp) {
_timestamp = timestamp;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these setters necessary?

If not.
Can they be removed? (Disregard if they are planned for future use in the future parts.)

If they can be removed.
This object would be immutable, would it be better to remove get from the field accessors? (If the get prefix is a sensitive topic disregard.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

fwiw. annotations similar to below would be required.

public class Demo {
  private final String name;
  private final Integer age;

  @JsonCreator
  Demo(@JsonProperty("name") String name, @JsonProperty("age") Integer age) {
    this.name = name;
    this.age = age;
  }

  @JsonGetter("name")
  public String name() {
    return name;
  }

  @JsonGetter("age")
  public Integer age() {
    return age;
  }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for sharing the API usage example. With the next set of changes I'll change my JSON class to make use of these and keep the class otherwise immutable.

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.

None yet

5 participants