[ 
https://issues.apache.org/jira/browse/HIVE-25157?focusedWorklogId=602318&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602318
 ]

ASF GitHub Bot logged work on HIVE-25157:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/May/21 13:10
            Start Date: 26/May/21 13:10
    Worklog Time Spent: 10m 
      Work Description: belugabehr commented on a change in pull request #2312:
URL: https://github.com/apache/hive/pull/2312#discussion_r639709847



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
##########
@@ -783,13 +755,11 @@ private boolean hasSpaceForCacheEntry(CacheEntry entry, 
long size) {
 
   private CacheEntry findEntryToRemove() {
     // Entries should be in LRU order in the keyset iterator.
-    Set<CacheEntry> entries = lru.keySet();
     synchronized (lru) {
-      for (CacheEntry removalCandidate : entries) {
-        if (removalCandidate.getStatus() != CacheEntryStatus.VALID) {
-          continue;
+      for (CacheEntry removalCandidate : lru) {
+        if (removalCandidate.getStatus() == CacheEntryStatus.VALID) {
+          return removalCandidate;
         }
-        return removalCandidate;

Review comment:
       Grab the `keySet` _inside_ of the synchronized block to avoid 
ConcurrentModification. Remove use of 'continue' keyword.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 602318)
    Time Spent: 1h 10m  (was: 1h)

> Clean up QueryResultsCache Code
> -------------------------------
>
>                 Key: HIVE-25157
>                 URL: https://issues.apache.org/jira/browse/HIVE-25157
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> * Remove superfluous code
>  * Simplify lock usage (remove instances of {{synchronization}})
>  * Simplify code with Guava {{Multimap}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to