Author: kturner
Date: Fri May 11 15:29:28 2012
New Revision: 1337210

URL: http://svn.apache.org/viewvc?rev=1337210&view=rev
Log:
ACCUMULO-591 Clear tablet location cache before computing map reduce input 
splits

Modified:
    
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
    
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java

Modified: 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1337210&r1=1337209&r2=1337210&view=diff
==============================================================================
--- 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
 (original)
+++ 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
 Fri May 11 15:29:28 2012
@@ -848,6 +848,8 @@ public class TableOperationsImpl extends
     Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new 
HashMap<String,Map<KeyExtent,List<Range>>>();
     String tableId = Tables.getTableId(instance, tableName);
     TabletLocator tl = TabletLocator.getInstance(instance, credentials, new 
Text(tableId));
+    // its possible that the cache could contain complete, but old information 
about a tables tablets... so clear it
+    tl.invalidateCache();
     while (!tl.binRanges(Collections.singletonList(range), 
binnedRanges).isEmpty()) {
       if (!Tables.exists(instance, tableId))
         throw new TableDeletedException(tableId);
@@ -858,6 +860,7 @@ public class TableOperationsImpl extends
       // sleep randomly between 100 and 200ms
       UtilWaitThread.sleep(100 + (int) (Math.random() * 100));
       binnedRanges.clear();
+      tl.invalidateCache();
     }
     
     // group key extents to get <= maxSplits

Modified: 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java?rev=1337210&r1=1337209&r2=1337210&view=diff
==============================================================================
--- 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
 (original)
+++ 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
 Fri May 11 15:29:28 2012
@@ -963,6 +963,8 @@ public abstract class InputFormatBase<K,
         Instance instance = getInstance(conf);
         String tableId = null;
         tl = getTabletLocator(conf);
+        // its possible that the cache could contain complete, but old 
information about a tables tablets... so clear it
+        tl.invalidateCache();
         while (!tl.binRanges(ranges, binnedRanges).isEmpty()) {
           if (!(instance instanceof MockInstance)) {
             if (tableId == null)
@@ -975,6 +977,7 @@ public abstract class InputFormatBase<K,
           binnedRanges.clear();
           log.warn("Unable to locate bins for specified ranges. Retrying.");
           UtilWaitThread.sleep(100 + (int) (Math.random() * 100)); // sleep 
randomly between 100 and 200 ms
+          tl.invalidateCache();
         }
       }
     } catch (Exception e) {


Reply via email to