-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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-16705. RBF: Support healthMonitor timeout configurable and cache NN and client proxy in NamenodeHeartbeatService #4662
Conversation
can we add some junit tests? |
💔 -1 overall
This message was automatically generated. |
Thanks @slfan1989 for your review.
Do you want me to add UT for which case? |
updateNameSpaceInfoParameters ? updateSafeModeParameters ? In my personal opinion, if we change the code, we still need to add junit test, and the content of the test should cover the changed part. |
.../src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java
Show resolved
Hide resolved
I just encapsulated them into functions without changing the logic. This can make the code logic clearer and make the reader have a better mood. Of course, if it is necessary to add some UTs about it, I will do it. Anyway, thanks for your review. @slfan1989 |
@ZanderXu Thanks for your contribution, pr is very valuable! |
.../src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java
Outdated
Show resolved
Hide resolved
@@ -160,35 +167,28 @@ protected void serviceInit(Configuration configuration) throws Exception { | |||
this.rpcAddress = getRpcAddress(conf, nameserviceId, originalNnId); | |||
|
|||
// Get the Service RPC address for monitoring | |||
this.serviceAddress = | |||
DFSUtil.getNamenodeServiceAddr(conf, nameserviceId, originalNnId); | |||
this.serviceAddress = DFSUtil.getNamenodeServiceAddr(conf, nameserviceId, originalNnId); |
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 restrict the format changes to PRs for refactor.
It is very hard to review and see what is the actual change otherwise.
Let's undo all those.
int timeoutMs = conf.getInt( | ||
DFS_ROUTER_HEALTH_MONITOR_TIMEOUT_MS, | ||
DFS_ROUTER_HEALTH_MONITOR_TIMEOUT_MS_DEFAULT); | ||
this.healthMonitorTimeoutMs = Math.max(0, timeoutMs); |
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.
We may want to log if the value was < 0
.../src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java
Show resolved
Hide resolved
@@ -96,6 +96,10 @@ public class RBFConfigKeys extends CommonConfigurationKeysPublic { | |||
FEDERATION_ROUTER_PREFIX + "heartbeat.interval"; | |||
public static final long DFS_ROUTER_HEARTBEAT_INTERVAL_MS_DEFAULT = | |||
TimeUnit.SECONDS.toMillis(5); | |||
public static final String DFS_ROUTER_HEALTH_MONITOR_TIMEOUT_MS = |
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 use the getTimeDuration style.
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.
@goiri Thanks for your review. getTimeDuration
will return a long value, but proxy timeoutMs
need an Integer value. If we use getTimeDuration
, we need to cast long to int. If you think it's ok, I will modify it.
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 do the getTimeDuration and cast it at the end.
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.
Copy, sir, I will fix it later.
💔 -1 overall
This message was automatically generated. |
localTarget = null; | ||
} else { | ||
// Failed to fetch HA status, ignoring failure | ||
LOG.error("Cannot fetch HA status for {}: {}", getNamenodeDesc(), e.getMessage(), e); |
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.
And for logging exceptions, when do we need full stack? What doesn't need full stack? What do you think about this?
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.
Indeed, we can remove e.getMessage()
in this place, because there is already a full stack. @goiri do you have any special considerations?
I personally feel that if we don't know the calling relationship of the exception very well and we need the full stack to located exceptions, or there is a very complex calling relationship, we can output the full stack. If we already know the calling process very well and the calling relationship is clear, we can just out put the message of exceptions, it will be clearer.
@goiri @slfan1989 Sir, please help me review this patch, thanks. |
💔 -1 overall
This message was automatically generated. |
@goiri Sir, please help me reivew the patch again, thanks. |
💔 -1 overall
This message was automatically generated. |
@slfan1989 Sir, about this PR, please help me review it. If you have any questions, please let me know. Thanks |
@slfan1989 you still have comments. |
@slfan1989 Ping, master, can help me review patch? |
It looks good from my side but I'd like to get closure from @slfan1989 |
LGTM. @ZanderXu Thank you for your contribution, @goiri Thank you for helping to review the code. |
Thanks @slfan1989. |
Sure. |
…ng NN and client proxy in NamenodeHeartbeatService
💔 -1 overall
This message was automatically generated. |
@goiri ping, Master, can you help me finally review it and merge it? |
…ng NN and client proxy in NamenodeHeartbeatService (apache#4662)
Description of PR
When I read NamenodeHeartbeatService.class of RBF, I feel that there are somethings we can do for NamenodeHeartbeatService.class.