-
Notifications
You must be signed in to change notification settings - Fork 907
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
Fix promise lost in ClientSide AuthHandler #3902
Fix promise lost in ClientSide AuthHandler #3902
Conversation
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.
Do we need to have a test?
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.
Nice catch
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.
Please add a test
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.
Nice Catch!
It doesn't seem very easy to add an AddEntry request before the auth handshake is complete, especially getting it into the waitingForAuth queue, and the auth request will also trigger the promise execution.
We need to add a unit test for this change, move to the next release |
As dicussed in #4293 I think we can close this PR now. |
Motivation
#3783 changed the AddEntry Request type from
BookieProtocol.AddRequest
toByteBuf
orByteBufList
, leading to the AddEntry request being added intowaitingForAuth
queue in the client-side AuthHandlerbookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Lines 787 to 791 in 0171a40
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
Lines 363 to 364 in 0171a40
For the requests in the
waitingForAuth
, they will be polled out byAuthHandshakeCompleteCallback#operationComplete
.bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
Lines 426 to 436 in 0171a40
However, the
waitingForAuth
queue only stores the AddEntry request, and it ignores the related ChannelPromise. When polling requests from thewaitingForAuth
queue inAuthHandshakeCompleteCallback#operationComplete
, those requests will be written and flushed into the Netty channel without passing any ChannelPromises, and Netty will usevoidPromise
by default.In a word, the AddEntry request side passed ChannelPromise will be replaced with
voidPromise
, and the original promise will never be complete and the following operations won't execute.bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Lines 1159 to 1169 in 0171a40
There are two impactions:
nettyOpLogger
metric won't updateaddEntryOutstanding
counter metric won't updateChanges
Store the ChannelPromise along with the request in the client-side AuthHandle and pass it to the Netty channel when polling out.