-
Notifications
You must be signed in to change notification settings - Fork 85
Add option to enforce identical app name in pings #206
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
Conversation
mennopruijssers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated before: I strongly suggest implementing some integration tests in ringpop-common as well.
| SelfEvict SelfEvictOptions | ||
|
|
||
| // If set to true, ping requests without identical app name return error | ||
| RequiresAppInPing bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this field doesn't really reflect the behaviour. RequiresIdenticalAppName might make more sense. The fact that this is enforced during pings is an implementation detail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it is actually handled as a RequiresAppInPing ping_handler.go:41...
Either change behaviour and name or the comment above
swim/node.go
Outdated
| PingRatio: .4, | ||
| }, | ||
|
|
||
| RequiresAppInPing: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed: the zero value of a bool is already false.
swim/ping_handler.go
Outdated
|
|
||
| if req.App == "" { | ||
| if node.requiresAppInPing { | ||
| node.logger.Warnf("Rejected ping from unknown ringpop app %s", req.App) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req.App will always be empty here.
swim/ping_handler.go
Outdated
| } | ||
| } else { | ||
| if req.App != node.app { | ||
| node.logger.Warnf("Rejected ping from wrong ringpop app %s", req.App) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally we would use something like node.logger.WithField("app", req.App).Warn("Rejected ping from wrong ringpop app"). That way searching in ES is easier because all the messages are the same.
swim/ping_handler.go
Outdated
| Changes: changes, | ||
| Source: node.Address(), | ||
| SourceIncarnation: node.Incarnation(), | ||
| App: node.app, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the reason why the integration tests are failing due to a json-schema validation error. You only added app to ping-request while also sending in the ping-response here.
mennopruijssers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two comments left, but looks good to me (if build passes now ;))
swim/ping_handler.go
Outdated
| if req.App == "" { | ||
| if node.requiresAppInPing { | ||
| node.logger.Warnf("Rejected ping from unknown ringpop app %s", req.App) | ||
| node.logger.WithFields("req", req).Warnf("Rejected ping from unknown ringpop app") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add the full req. It could be huge (due to Changes). Source might be enough.
swim/ping_handler.go
Outdated
| } else { | ||
| if req.App != node.app { | ||
| node.logger.Warnf("Rejected ping from wrong ringpop app %s", req.App) | ||
| node.logger.WithFields("req", req).Warn("Rejected ping from wrong ringpop app") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same but also consider adding req.App
Always reject pings from wrong app name
d82e843 to
a2e53a1
Compare
Always reject pings from wrong app name