ctubbsii commented on code in PR #5423:
URL: https://github.com/apache/accumulo/pull/5423#discussion_r2015029722


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientTabletCacheImpl.java:
##########
@@ -479,57 +445,44 @@ public List<Range> findTablets(ClientContext context, 
List<Range> ranges,
 
   @Override
   public void invalidateCache(KeyExtent failedExtent) {
-    wLock.lock();
-    try {
-      badExtents.add(failedExtent);
-    } finally {
-      wLock.unlock();
-    }
+    removeOverlapping(metaCache, failedExtent);
     if (log.isTraceEnabled()) {
       log.trace("Invalidated extent={}", failedExtent);
     }
   }
 
   @Override
   public void invalidateCache(Collection<KeyExtent> keySet) {
-    wLock.lock();
-    try {
-      badExtents.addAll(keySet);
-    } finally {
-      wLock.unlock();
-    }
+    keySet.forEach(extent -> removeOverlapping(metaCache, extent));
     if (log.isTraceEnabled()) {
       log.trace("Invalidated {} cache entries for table {}", keySet.size(), 
tableId);
     }
   }
 
   @Override
   public void invalidateCache(ClientContext context, String server) {
-
-    wLock.lock();
-    try {
-      badServers.add(server);
-    } finally {
-      wLock.unlock();
+    var iter = metaCache.values().iterator();
+    int removed = 0;
+    while (iter.hasNext()) {
+      var cachedTablet = iter.next();
+      if (cachedTablet.getTserverLocation().isPresent()
+          && cachedTablet.getTserverLocation().orElseThrow().equals(server)) {
+        iter.remove();
+        removed++;
+      }
     }

Review Comment:
   I reviewed #5431. I'll take another look at this PR after that is merged 
first.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to