-
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
YARN-11469. Refactor FederationStateStoreFacade Cache Code. #5570
Conversation
💔 -1 overall
This message was automatically generated. |
StringBuilder buffer = new StringBuilder(); | ||
buffer.append(typeName).append(".").append(methodName); | ||
if (argName != null) { | ||
buffer.append("::"); |
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.
Make a constant.
@@ -0,0 +1,263 @@ | |||
package org.apache.hadoop.yarn.server.federation.cache; | |||
|
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.
Header
cacheTimeToLive = conf.getInt(YarnConfiguration.FEDERATION_CACHE_TIME_TO_LIVE_SECS, | ||
YarnConfiguration.DEFAULT_FEDERATION_CACHE_TIME_TO_LIVE_SECS); | ||
this.stateStore = pStateStore; | ||
if (cacheTimeToLive > 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.
Reverse the if and return.
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 for your suggestion, I will modify the code.
FactoryBuilder.SingletonFactory<CacheLoader<Object, Object>> cacheLoaderSingletonFactory = | ||
new FactoryBuilder.SingletonFactory<>(new CacheLoaderImpl<>()); | ||
CompleteConfiguration<Object, Object> configuration = | ||
new MutableConfiguration<>().setStoreByValue(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.
Split lines
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 will modify the code.
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; |
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.
Can we use the HashBuilder and the EqualsBuilder?
Boolean.toString(filterInactiveSubClusters)); | ||
CacheRequest<String, Map<SubClusterId, SubClusterInfo>> cacheRequest = | ||
new CacheRequest<>(cacheKey, | ||
key -> { |
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 don't do anything with the key?
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 will refactor this part of the code.
GET_APPLICATION_HOME_SUBCLUSTER_CACHEID, applicationId.toString()); | ||
CacheRequest<String, SubClusterId> cacheRequest = new CacheRequest<>( | ||
cacheKey, | ||
input -> { |
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.
Is the indentation correct?
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 will modify the code.
|
||
public abstract void clearCache(); | ||
|
||
protected String buildCacheKey(String typeName, String methodName, String argName) { |
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.
Put documentation with examples of input and outputs.
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 for your suggestion! I will improve the documentation.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@goiri Thank you very much for helping to review the code! I am currently refactoring a cache implementation to support additional cache implementations in the future. To aid me in this process, I have referred to The Ehcache 3.x JSR-107 Provider documentation, specifically version 3.10, as a resource. The goal is to improve the code and make it more extensible for future updates. Can you help review the code again? Thank you very much! |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Thank you very much for helping to review the code! |
I want to implement a new cache replacement algorithm in hdfs but I don't know which part of module to use and modify. Can any one please help me find the modules and functions which need to override to add my own caching replacement algorithm in hdfs |
JIRA: YARN-11469. Refactor FederationStateStoreFacade Cache Code.
The Cache of FederationStateStoreFacade uses JCache, but considering that JCache is not a general Cache implementation (the latest version was released in 2014), this part of the code is refactored to support multiple Cache in the future.