-
Notifications
You must be signed in to change notification settings - Fork 37
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 unexpected max latency in output of stat
#349
Conversation
# Conflicts: # src/Service/Metrics.h
src/Service/ConnectionHandler.cpp
Outdated
Int64 elapsed = Poco::Timestamp().epochMicroseconds() / 1000 - response->request_created_time_ms; | ||
auto current_time = getCurrentTimeMilliseconds(); | ||
Int64 elapsed = current_time - response->request_created_time_ms; | ||
if (elapsed < 0) |
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 elapsed can be -1? Caused by different clock? If it is, we must use stedy_lock in all places.
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.
Maybe different clock, so I use getCurrentTimeMilliseconds
which is steady_clock
for request in all places.
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.
Maybe caused by clock diff in different servers. When leader append_entries the create_time
is attached to the log and when the follower takes the log the timestamp in leader is used. If there is a clock diff in the servers -1
may raise.
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.
Let's add a comment to help readers understand the code.
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.
Maybe caused by clock diff in different servers. When leader append_entries the
create_time
is attached to the log and when the follower takes the log the timestamp in leader is used. If there is a clock diff in the servers-1
may raise.
When followers takes the log from leader, them won't updateLatency for the log. We used to use system_clock
to measure request time cost. Clock rollback can cause this issue with system_clock
.
stat
src/Service/ConnectionHandler.cpp
Outdated
response->xid, | ||
Coordination::toString(response->getOpNum()), | ||
elapsed); | ||
LOG_WARNING( |
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.
Just delete the logging, for it is confused for the system mantainers.
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.
okay
Which issues of this PR fixes:
This PR try to fix #348
Change log: