-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
HDFS-17116. RBF: Update invoke millisecond time as monotonicNow() in RouterSafemodeService #5876
Conversation
…erval is negative during router safe mode exit check
@@ -128,7 +129,6 @@ public void testRouterExitSafemode() | |||
|
|||
assertTrue(router.getSafemodeService().isInSafeMode()); | |||
verifyRouter(RouterServiceState.SAFEMODE); | |||
|
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.
avoid this change
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.
Thanks @slfan1989 help me reivew it, i wll update it later.
TimeUnit.SECONDS.toMillis(2), TimeUnit.MILLISECONDS) + | ||
conf.getTimeDuration(DFS_ROUTER_CACHE_TIME_TO_LIVE_MS, | ||
TimeUnit.SECONDS.toMillis(1), TimeUnit.MILLISECONDS) * 2; | ||
Thread.sleep(interval); |
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.
Use GenericTestUtils.waitFor
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 wll update it later.
verifyRouter(RouterServiceState.SAFEMODE); | ||
|
||
// Wait for initial time in milliseconds | ||
long interval = |
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 part of the code is not readable, can it be extended?
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 wll update it later.
🎊 +1 overall
This message was automatically generated. |
@@ -161,11 +161,17 @@ protected void serviceInit(Configuration conf) throws Exception { | |||
|
|||
@Override | |||
public void periodicInvoke() { | |||
long now = Time.now(); | |||
long now = now(); | |||
long delta = now - startupTime; |
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.
How about to invoke monotonicNow()
to calculate the delta?
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.
Thanks @Hexiaoqiao help me review it
yeah, your suggestion is right, because monotonicNow() is not affected by settimeofday or similar system clock changes, if here invoke monotonicNow() to calculate the delta will avoid the exception case.
if startupTime use monotonicNow, maybe cacheLastUpdateTime and enterSafeModeTime we should also use monotonicNow() need to be consistent
what you think?
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.
Absolutely yes.
assertTrue(router.getSafemodeService().isInSafeMode()); | ||
verifyRouter(RouterServiceState.SAFEMODE); | ||
|
||
// Wait for initial time in milliseconds |
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.
One tiny issue, please unify the comments pattern. Add dot in the end of a sentence.
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.
Thanks @hfutatzhanghb help me reivew it, i wll update it later.
…RouterSafemodeService
Hi Sir @Hexiaoqiao @slfan1989 @hfutatzhanghb Update PR and because update implementation need modify the name of the issue. please help me review this pr again when you have free time. Thanks a lot~ |
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.
LGTM. +1 from my side. Let's wait what Yetus will say.
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.
LGTM.+1
💔 -1 overall
This message was automatically generated. |
The failed unit test seems unrelated to the change, I will follow up on this UT failure issue and create a new issue to solve it |
Committed to trunk. Thanks @haiyang1987 for your contribution and @hfutatzhanghb @slfan1989 for your reviews! |
Thanks @Hexiaoqiao @slfan1989 @hfutatzhanghb help me review and merge it. |
…RouterSafemodeService (apache#5876). Contributed by Haiyang Hu. Reviewed-by: hfutatzhanghb <1036798979@qq.com> Reviewed-by: Shilun Fan <slfan1989@apache.org> Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
Description of PR
https://issues.apache.org/jira/browse/HDFS-17116
The following exceptions occurred in our online environment:
The relevant logs are:
Maybe we can be compatible with this case at the code level, can invoke monotonicNow() to calculate the delta.