belugabehr commented on a change in pull request #2312:
URL: https://github.com/apache/hive/pull/2312#discussion_r639714420



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
##########
@@ -601,66 +591,59 @@ public boolean setEntryValid(CacheEntry cacheEntry, 
FetchWork fetchWork) {
   }
 
   public void clear() {
-    Lock writeLock = rwLock.writeLock();
+    cacheWriteLock.lock();
     try {
-      writeLock.lock();
       LOG.info("Clearing the results cache");
-      CacheEntry[] allEntries = null;
-      synchronized (lru) {
-        allEntries = lru.keySet().toArray(EMPTY_CACHEENTRY_ARRAY);
-      }
-      for (CacheEntry entry : allEntries) {

Review comment:
       The `cacheWrite` lock is held here so no need to synchronize on `lru`




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to