[
https://issues.apache.org/jira/browse/HDFS-15780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17267502#comment-17267502
]
Íñigo Goiri commented on HDFS-15780:
------------------------------------
I am not sure this is correct.
If the first iteration returns false and then the second one returns true, we
will update the time while the old code wouldn't.
> RBF: Delete unnecessary var in stateStoreService
> -------------------------------------------------
>
> Key: HDFS-15780
> URL: https://issues.apache.org/jira/browse/HDFS-15780
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: wangzhaohui
> Assignee: wangzhaohui
> Priority: Trivial
> Attachments: HDFS-15780.patch
>
>
> {code:java}
> public void refreshCaches(boolean force) {
> boolean success = true;
> if (isDriverReady()) {
> List<StateStoreCache> cachesToUpdate = new LinkedList<>();
> cachesToUpdate.addAll(cachesToUpdateInternal);
> cachesToUpdate.addAll(cachesToUpdateExternal);
> for (StateStoreCache cachedStore : cachesToUpdate) {
> String cacheName = cachedStore.getClass().getSimpleName();
> boolean result = false;
> try {
> result = cachedStore.loadCache(force);
> } catch (IOException e) {
> LOG.error("Error updating cache for {}", cacheName, e);
> result = false;
> }
> if (!result) {
> success = false;
> LOG.error("Cache update failed for cache {}", cacheName);
> }
> }
> } else {
> success = false;
> LOG.info("Skipping State Store cache update, driver is not ready.");
> }
> if (success) {
> // Uses local time, not driver time.
> this.cacheLastUpdateTime = Time.now();
> }
> }
> {code}
> The "success" may be unnecessary,we can use "result" instead of it, this can
> reduce the use of unnecessary variables.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]