-
Notifications
You must be signed in to change notification settings - Fork 17
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
logproto: fixed state handling of the new internal handshake_in_progress flag #388
logproto: fixed state handling of the new internal handshake_in_progress flag #388
Conversation
…ess flag There were multiple issues here - proto change did not force re-handshake if needed - initial state handling led to a drop of the first flush event both on client and server side that e.g. led to incorrect persist state processing at restart Signed-off-by: Hofi <[email protected]>
f83b6b1
to
61b2abb
Compare
{ | ||
return s->handshake(s, handshake_finished); | ||
} | ||
if (log_proto_client_needs_handshake(s)) |
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.
all our method wrappers check the methods directly and not via another helper function. are there any other uses for log_proto_client_needs_handshake()?
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.
- it is an inline func, no penalities at all
- it can be a more complex condition for a given proto client, and this can be an overriden impl later if needed
- yes, it is reused and called from other places
log_proto_server_set_wakeup_cb(self->proto, (LogProtoServerWakeupFunc) log_reader_wakeup, self); | ||
{ | ||
log_proto_server_set_wakeup_cb(self->proto, (LogProtoServerWakeupFunc) log_reader_wakeup, self); | ||
self->handshake_in_progress = log_proto_server_needs_handshake(self->proto); |
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.
why do we need to reset handshake_in_progress? the idea was to always start in "handshake" mode and the handshake method returns when handshake finishes. we should not need to check that again, at least in my opinion.
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.
I've just checked, handshake_finished is only set to TRUE if either the LogProto claims it has finished the handshake, or when we switch the a LogProto that does not have a handshake method.
return log_reader_process_handshake(self); | ||
gboolean succ = log_reader_process_handshake(self); | ||
if (FALSE == succ || self->handshake_in_progress) | ||
return 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.
I don't think this is needed.
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 what is really needed here.
This check must not return true ever.
If the handshake is needed and it fails or not completed yet, it should return false.
If the handshake is not needed or it is finised fine already, the flow should go forward and finish the flush operation, otherwise this flush will be lost (as the caller might think its flush request is processed and will not attempt it once again).
The latter can be experienced currently, just try my example bellow.
I don't think this is needed. the whole idea is to start in handshake mode and bail out if the LogProto says it's over, or if we are changing the LogProto instance that does not have a handshake method.
Can you elaborate on this? |
I do not add my comments one by one to all of the above, just answering here if you do not mind.
as the result of the second point above, and as the result of the unhandled case in the steps to reproduce
Instead of processing the remaining part of the original 1000 logs from the input file, it will simply drop/ignore them because of the changed |
Only the handshake function can replace the proto, so it cannot happen any time. At this point we are still in handshake mode, which is terminated by the new LogProto by setting handshake_finished to TRUE.
so this is a LogWriter side issue, not a LogReader one. Do you think it applies to LogReader as well?
will try this. |
Fixed by #407 |
There were multiple issues here
Signed-off-by: Hofi [email protected]