MINOR: Add synchronization to the protocol name check#8349
MINOR: Add synchronization to the protocol name check#8349guozhangwang merged 2 commits intoapache:trunkfrom
Conversation
|
@dajac Regarding the comment: #8324 (comment) |
|
test this please |
| final boolean protocolNameInconsistent = protocolName != null && | ||
| generation() != Generation.NO_GENERATION && !protocolName.equals(generation().protocolName); | ||
|
|
||
| if (protocolNameInconsistent) { |
There was a problem hiding this comment.
@dajac just to clarify, are you concerning that the generation() may change between the check and the error-log? If yes maybe we do not need to synchronize the whole function, instead we just get a reference of the returned generation() call and use that in the error-log, since the generation object is immutable.
There was a problem hiding this comment.
@guozhangwang Yes, keeping the reference is fine. I was concerned by the check itself because we were calling generation() twice in the previous implementation thus we could get two different instances.
generation() != Generation.NO_GENERATION && !protocolName.equals(generation().protocolName)
I haven't thought about the error-log but it is also a good point.
|
test this please |
1 similar comment
|
test this please |
@abbccdda I was thinking about putting an explicit check of the generation is the response handler itself instead of having it hidden in the This would make the fact the the generation can be reseted in the middle of the rebalance more explicit. Would this make sense? |
Addressing the comment from #8324 (comment)
Committer Checklist (excluded from commit message)