accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [1/4] ACCUMULO-391 Use more accurate "InputTableConfig" term
Date Thu, 24 Oct 2013 23:04:38 GMT
Updated Branches:
  refs/heads/master a5cf86094 -> 61353d1e3


http://git-wip-us.apache.org/repos/asf/accumulo/blob/61353d1e/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
index f2852f9..15fb7c7 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
@@ -53,7 +53,6 @@ import org.apache.accumulo.server.tabletserver.compaction.DefaultCompactionStrat
 import org.apache.accumulo.server.tabletserver.compaction.MajorCompactionReason;
 import org.apache.accumulo.server.tabletserver.compaction.MajorCompactionRequest;
 import org.apache.accumulo.server.util.time.SimpleTimer;
-import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.accumulo.trace.instrument.TraceExecutorService;
 import org.apache.log4j.Logger;
 
@@ -64,7 +63,7 @@ import org.apache.log4j.Logger;
  * 
  */
 public class TabletServerResourceManager {
-  
+
   private ExecutorService minorCompactionThreadPool;
   private ExecutorService majorCompactionThreadPool;
   private ExecutorService rootMajorCompactionThreadPool;
@@ -78,23 +77,23 @@ public class TabletServerResourceManager {
   private ExecutorService readAheadThreadPool;
   private ExecutorService defaultReadAheadThreadPool;
   private Map<String,ExecutorService> threadPools = new TreeMap<String,ExecutorService>();
-  
+
   private HashSet<TabletResourceManager> tabletResources;
-  
+
   private final VolumeManager fs;
-  
+
   private FileManager fileManager;
-  
+
   private MemoryManager memoryManager;
-  
+
   private MemoryManagementFramework memMgmt;
-  
+
   private final LruBlockCache _dCache;
   private final LruBlockCache _iCache;
   private final ServerConfiguration conf;
-  
+
   private static final Logger log = Logger.getLogger(TabletServerResourceManager.class);
-  
+
   private ExecutorService addEs(String name, ExecutorService tp) {
     if (threadPools.containsKey(name)) {
       throw new IllegalArgumentException("Cannot create two executor services with same name
" + name);
@@ -103,7 +102,7 @@ public class TabletServerResourceManager {
     threadPools.put(name, tp);
     return tp;
   }
-  
+
   private ExecutorService addEs(final Property maxThreads, String name, final ThreadPoolExecutor
tp) {
     ExecutorService result = addEs(name, tp);
     SimpleTimer.getInstance().schedule(new Runnable() {
@@ -120,7 +119,7 @@ public class TabletServerResourceManager {
           log.error(t, t);
         }
       }
-      
+
     }, 1000, 10 * 1000);
     return result;
   }
@@ -128,7 +127,7 @@ public class TabletServerResourceManager {
   private ExecutorService createEs(int max, String name) {
     return addEs(name, Executors.newFixedThreadPool(max, new NamingThreadFactory(name)));
   }
-  
+
   private ExecutorService createEs(Property max, String name) {
     return createEs(max, name, new LinkedBlockingQueue<Runnable>());
   }
@@ -142,22 +141,22 @@ public class TabletServerResourceManager {
   private ExecutorService createEs(int min, int max, int timeout, String name) {
     return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new NamingThreadFactory(name)));
   }
-  
+
   public TabletServerResourceManager(Instance instance, VolumeManager fs) {
     this.conf = new ServerConfiguration(instance);
     this.fs = fs;
     final AccumuloConfiguration acuConf = conf.getConfiguration();
-    
+
     long maxMemory = acuConf.getMemoryInBytes(Property.TSERV_MAXMEM);
     boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) &&
NativeMap.loadedNativeLibraries();
-    
+
     long blockSize = acuConf.getMemoryInBytes(Property.TSERV_DEFAULT_BLOCKSIZE);
     long dCacheSize = acuConf.getMemoryInBytes(Property.TSERV_DATACACHE_SIZE);
     long iCacheSize = acuConf.getMemoryInBytes(Property.TSERV_INDEXCACHE_SIZE);
-    
+
     _iCache = new LruBlockCache(iCacheSize, blockSize);
     _dCache = new LruBlockCache(dCacheSize, blockSize);
-    
+
     Runtime runtime = Runtime.getRuntime();
     if (!usingNativeMap && maxMemory + dCacheSize + iCacheSize > runtime.maxMemory())
{
       throw new IllegalArgumentException(String.format(
@@ -171,177 +170,183 @@ public class TabletServerResourceManager {
     if (!usingNativeMap && maxMemory > runtime.maxMemory() - (runtime.totalMemory()
- runtime.freeMemory())) {
       log.warn("In-memory map may not fit into local memory space.");
     }
-    
+
     minorCompactionThreadPool = createEs(Property.TSERV_MINC_MAXCONCURRENT, "minor compactor");
-    
+
     // make this thread pool have a priority queue... and execute tablets with the most
     // files first!
     majorCompactionThreadPool = createEs(Property.TSERV_MAJC_MAXCONCURRENT, "major compactor",
new CompactionQueue());
     rootMajorCompactionThreadPool = createEs(0, 1, 300, "md root major compactor");
     defaultMajorCompactionThreadPool = createEs(0, 1, 300, "md major compactor");
-    
+
     splitThreadPool = createEs(1, "splitter");
     defaultSplitThreadPool = createEs(0, 1, 60, "md splitter");
-    
+
     defaultMigrationPool = createEs(0, 1, 60, "metadata tablet migration");
     migrationPool = createEs(Property.TSERV_MIGRATE_MAXCONCURRENT, "tablet migration");
-    
+
     // not sure if concurrent assignments can run safely... even if they could there is probably
no benefit at startup because
     // individual tablet servers are already running assignments concurrently... having each
individual tablet server run
     // concurrent assignments would put more load on the metadata table at startup
     assignmentPool = createEs(1, "tablet assignment");
-    
+
     assignMetaDataPool = createEs(0, 1, 60, "metadata tablet assignment");
-    
+
     readAheadThreadPool = createEs(Property.TSERV_READ_AHEAD_MAXCONCURRENT, "tablet read
ahead");
     defaultReadAheadThreadPool = createEs(Property.TSERV_METADATA_READ_AHEAD_MAXCONCURRENT,
"metadata tablets read ahead");
-    
+
     tabletResources = new HashSet<TabletResourceManager>();
-    
+
     int maxOpenFiles = acuConf.getCount(Property.TSERV_SCAN_MAX_OPENFILES);
-    
+
     fileManager = new FileManager(conf, fs, maxOpenFiles, _dCache, _iCache);
-    
+
     memoryManager = Property.createInstanceFromPropertyName(acuConf, Property.TSERV_MEM_MGMT,
MemoryManager.class, new LargestFirstMemoryManager());
     memoryManager.init(conf);
     memMgmt = new MemoryManagementFramework();
   }
-  
+
   private static class TabletStateImpl implements TabletState, Cloneable {
-    
+
     private long lct;
     private Tablet tablet;
     private long mts;
     private long mcmts;
-    
+
     public TabletStateImpl(Tablet t, long mts, long lct, long mcmts) {
       this.tablet = t;
       this.mts = mts;
       this.lct = lct;
       this.mcmts = mcmts;
     }
-    
+
+    @Override
     public KeyExtent getExtent() {
       return tablet.getExtent();
     }
-    
+
     Tablet getTablet() {
       return tablet;
     }
-    
+
+    @Override
     public long getLastCommitTime() {
       return lct;
     }
-    
+
+    @Override
     public long getMemTableSize() {
       return mts;
     }
-    
+
+    @Override
     public long getMinorCompactingMemTableSize() {
       return mcmts;
     }
   }
-  
+
   private class MemoryManagementFramework {
     private final Map<KeyExtent,TabletStateImpl> tabletReports;
     private LinkedBlockingQueue<TabletStateImpl> memUsageReports;
     private long lastMemCheckTime = System.currentTimeMillis();
     private long maxMem;
-    
+
     MemoryManagementFramework() {
       tabletReports = Collections.synchronizedMap(new HashMap<KeyExtent,TabletStateImpl>());
       memUsageReports = new LinkedBlockingQueue<TabletStateImpl>();
       maxMem = conf.getConfiguration().getMemoryInBytes(Property.TSERV_MAXMEM);
-      
+
       Runnable r1 = new Runnable() {
+        @Override
         public void run() {
           processTabletMemStats();
         }
       };
-      
+
       Thread t1 = new Daemon(new LoggingRunnable(log, r1));
       t1.setPriority(Thread.NORM_PRIORITY + 1);
       t1.setName("Accumulo Memory Guard");
       t1.start();
-      
+
       Runnable r2 = new Runnable() {
+        @Override
         public void run() {
           manageMemory();
         }
       };
-      
+
       Thread t2 = new Daemon(new LoggingRunnable(log, r2));
       t2.setName("Accumulo Minor Compaction Initiator");
       t2.start();
-      
+
     }
-    
+
     private long lastMemTotal = 0;
-    
+
     private void processTabletMemStats() {
       while (true) {
         try {
-          
+
           TabletStateImpl report = memUsageReports.take();
-          
+
           while (report != null) {
             tabletReports.put(report.getExtent(), report);
             report = memUsageReports.poll();
           }
-          
+
           long delta = System.currentTimeMillis() - lastMemCheckTime;
           if (holdCommits || delta > 50 || lastMemTotal > 0.90 * maxMem) {
             lastMemCheckTime = System.currentTimeMillis();
-            
+
             long totalMemUsed = 0;
-            
+
             synchronized (tabletReports) {
               for (TabletStateImpl tsi : tabletReports.values()) {
                 totalMemUsed += tsi.getMemTableSize();
                 totalMemUsed += tsi.getMinorCompactingMemTableSize();
               }
             }
-            
+
             if (totalMemUsed > 0.95 * maxMem) {
               holdAllCommits(true);
             } else {
               holdAllCommits(false);
             }
-            
+
             lastMemTotal = totalMemUsed;
           }
-          
+
         } catch (InterruptedException e) {
           log.warn(e, e);
         }
       }
     }
-    
+
     private void manageMemory() {
       while (true) {
         MemoryManagementActions mma = null;
-        
+
         try {
           ArrayList<TabletState> tablets;
           synchronized (tabletReports) {
             tablets = new ArrayList<TabletState>(tabletReports.values());
           }
           mma = memoryManager.getMemoryManagementActions(tablets);
-          
+
         } catch (Throwable t) {
           log.error("Memory manager failed " + t.getMessage(), t);
         }
-        
+
         try {
           if (mma != null && mma.tabletsToMinorCompact != null && mma.tabletsToMinorCompact.size()
> 0) {
             for (KeyExtent keyExtent : mma.tabletsToMinorCompact) {
               TabletStateImpl tabletReport = tabletReports.get(keyExtent);
-              
+
               if (tabletReport == null) {
                 log.warn("Memory manager asked to compact nonexistant tablet " + keyExtent);
                 continue;
               }
-              
+
               if (!tabletReport.getTablet().initiateMinorCompaction(MinorCompactionReason.SYSTEM))
{
                 if (tabletReport.getTablet().isClosed()) {
                   tabletReports.remove(tabletReport.getExtent());
@@ -351,48 +356,48 @@ public class TabletServerResourceManager {
                 }
               }
             }
-            
+
             // log.debug("mma.tabletsToMinorCompact = "+mma.tabletsToMinorCompact);
           }
         } catch (Throwable t) {
           log.error("Minor compactions for memory managment failed", t);
         }
-        
+
         UtilWaitThread.sleep(250);
       }
     }
-    
+
     public void updateMemoryUsageStats(Tablet tablet, long size, long lastCommitTime, long
mincSize) {
       memUsageReports.add(new TabletStateImpl(tablet, size, lastCommitTime, mincSize));
     }
-    
+
     public void tabletClosed(KeyExtent extent) {
       tabletReports.remove(extent);
     }
   }
-  
+
   private final Object commitHold = new Object();
   private volatile boolean holdCommits = false;
   private long holdStartTime;
-  
+
   protected void holdAllCommits(boolean holdAllCommits) {
     synchronized (commitHold) {
       if (holdCommits != holdAllCommits) {
         holdCommits = holdAllCommits;
-        
+
         if (holdCommits) {
           holdStartTime = System.currentTimeMillis();
         }
-        
+
         if (!holdCommits) {
           log.debug(String.format("Commits held for %6.2f secs", (System.currentTimeMillis()
- holdStartTime) / 1000.0));
           commitHold.notifyAll();
         }
       }
     }
-    
+
   }
-  
+
   void waitUntilCommitsAreEnabled() {
     if (holdCommits) {
       long timeout = System.currentTimeMillis() + conf.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT);
@@ -407,7 +412,7 @@ public class TabletServerResourceManager {
       }
     }
   }
-  
+
   public long holdTime() {
     if (!holdCommits)
       return 0;
@@ -415,12 +420,12 @@ public class TabletServerResourceManager {
       return System.currentTimeMillis() - holdStartTime;
     }
   }
-  
+
   public void close() {
     for (ExecutorService executorService : threadPools.values()) {
       executorService.shutdown();
     }
-    
+
     for (Entry<String,ExecutorService> entry : threadPools.entrySet()) {
       while (true) {
         try {
@@ -433,66 +438,66 @@ public class TabletServerResourceManager {
       }
     }
   }
-  
+
   public synchronized TabletResourceManager createTabletResourceManager() {
     TabletResourceManager trm = new TabletResourceManager();
     return trm;
   }
-  
+
   synchronized private void addTabletResource(TabletResourceManager tr) {
     tabletResources.add(tr);
   }
-  
+
   synchronized private void removeTabletResource(TabletResourceManager tr) {
     tabletResources.remove(tr);
   }
-  
+
   public class TabletResourceManager {
-    
+
     private final long creationTime = System.currentTimeMillis();
-    
+
     private volatile boolean openFilesReserved = false;
-    
+
     private volatile boolean closed = false;
-    
+
     private Tablet tablet;
-    
+
     private AccumuloConfiguration tableConf;
-    
+
     TabletResourceManager() {}
-    
+
     void setTablet(Tablet tablet, AccumuloConfiguration tableConf) {
       this.tablet = tablet;
       this.tableConf = tableConf;
       // TabletResourceManager is not really initialized until this
       // function is called.... so do not make it publicly available
       // until now
-      
+
       addTabletResource(this);
     }
-    
+
     // BEGIN methods that Tablets call to manage their set of open map files
-    
+
     public void importedMapFiles() {
       lastReportedCommitTime = System.currentTimeMillis();
     }
-    
+
     synchronized ScanFileManager newScanFileManager() {
       if (closed)
         throw new IllegalStateException("closed");
       return fileManager.newScanFileManager(tablet.getExtent());
     }
-    
+
     // END methods that Tablets call to manage their set of open map files
-    
+
     // BEGIN methods that Tablets call to manage memory
-    
+
     private AtomicLong lastReportedSize = new AtomicLong();
     private AtomicLong lastReportedMincSize = new AtomicLong();
     private volatile long lastReportedCommitTime = 0;
-    
+
     public void updateMemoryUsageStats(long size, long mincSize) {
-      
+
       // do not want to update stats for every little change,
       // so only do it under certain circumstances... the reason
       // for this is that reporting stats acquires a lock, do
@@ -510,32 +515,32 @@ public class TabletServerResourceManager {
       if ((lrms > 0 && mincSize == 0 || lrms == 0 && mincSize > 0)
&& lastReportedMincSize.compareAndSet(lrms, mincSize)) {
         report = true;
       }
-      
+
       long currentTime = System.currentTimeMillis();
       if ((delta > 32000 || delta < 0 || (currentTime - lastReportedCommitTime >
1000)) && lastReportedSize.compareAndSet(lrs, totalSize)) {
         if (delta > 0)
           lastReportedCommitTime = currentTime;
         report = true;
       }
-      
+
       if (report)
         memMgmt.updateMemoryUsageStats(tablet, size, lastReportedCommitTime, mincSize);
     }
-    
+
     // END methods that Tablets call to manage memory
-    
+
     // BEGIN methods that Tablets call to make decisions about major compaction
     // when too many files are open, we may want tablets to compact down
     // to one map file
     boolean needsMajorCompaction(SortedMap<FileRef,DataFileValue> tabletFiles, MajorCompactionReason
reason) {
       if (closed)
         return false;// throw new IOException("closed");
-        
+
       // int threshold;
-      
+
       if (reason == MajorCompactionReason.USER)
         return true;
-      
+
       if (reason == MajorCompactionReason.IDLE) {
         // threshold = 1;
         long idleTime;
@@ -546,12 +551,13 @@ public class TabletServerResourceManager {
         } else {
           idleTime = System.currentTimeMillis() - lastReportedCommitTime;
         }
-        
+
         if (idleTime < tableConf.getTimeInMillis(Property.TABLE_MAJC_COMPACTALL_IDLETIME))
{
           return false;
         }
       }
-      CompactionStrategy strategy  = Property.createInstanceFromPropertyName(tableConf, Property.TABLE_COMPACTION_STRATEGY,
CompactionStrategy.class, new DefaultCompactionStrategy());
+      CompactionStrategy strategy = Property.createInstanceFromPropertyName(tableConf, Property.TABLE_COMPACTION_STRATEGY,
CompactionStrategy.class,
+          new DefaultCompactionStrategy());
       strategy.init(Property.getCompactionStrategyOptions(tableConf));
       MajorCompactionRequest request = new MajorCompactionRequest(tablet.getExtent(), reason,
TabletServerResourceManager.this.fs, tableConf);
       request.setFiles(tabletFiles);
@@ -561,16 +567,16 @@ public class TabletServerResourceManager {
         return false;
       }
     }
-    
+
     // END methods that Tablets call to make decisions about major compaction
-    
+
     // tablets call this method to run minor compactions,
     // this allows us to control how many minor compactions
     // run concurrently in a tablet server
     void executeMinorCompaction(final Runnable r) {
       minorCompactionThreadPool.execute(new LoggingRunnable(log, r));
     }
-    
+
     void close() throws IOException {
       // always obtain locks in same order to avoid deadlock
       synchronized (TabletServerResourceManager.this) {
@@ -579,27 +585,27 @@ public class TabletServerResourceManager {
             throw new IOException("closed");
           if (openFilesReserved)
             throw new IOException("tired to close files while open files reserved");
-          
+
           TabletServerResourceManager.this.removeTabletResource(this);
-          
+
           memMgmt.tabletClosed(tablet.getExtent());
           memoryManager.tabletClosed(tablet.getExtent());
-          
+
           closed = true;
         }
       }
     }
-    
+
     public TabletServerResourceManager getTabletServerResourceManager() {
       return TabletServerResourceManager.this;
     }
-    
+
     public void executeMajorCompaction(KeyExtent tablet, Runnable compactionTask) {
       TabletServerResourceManager.this.executeMajorCompaction(tablet, compactionTask);
     }
-    
+
   }
-  
+
   public void executeSplit(KeyExtent tablet, Runnable splitTask) {
     if (tablet.isMeta()) {
       if (tablet.isRootTablet()) {
@@ -611,7 +617,7 @@ public class TabletServerResourceManager {
       splitThreadPool.execute(splitTask);
     }
   }
-  
+
   public void executeMajorCompaction(KeyExtent tablet, Runnable compactionTask) {
     if (tablet.isRootTablet()) {
       rootMajorCompactionThreadPool.execute(compactionTask);
@@ -621,7 +627,7 @@ public class TabletServerResourceManager {
       majorCompactionThreadPool.execute(compactionTask);
     }
   }
-  
+
   public void executeReadAhead(KeyExtent tablet, Runnable task) {
     if (tablet.isRootTablet()) {
       task.run();
@@ -631,15 +637,15 @@ public class TabletServerResourceManager {
       readAheadThreadPool.execute(task);
     }
   }
-  
+
   public void addAssignment(Runnable assignmentHandler) {
     assignmentPool.execute(assignmentHandler);
   }
-  
+
   public void addMetaDataAssignment(Runnable assignmentHandler) {
     assignMetaDataPool.execute(assignmentHandler);
   }
-  
+
   public void addMigration(KeyExtent tablet, Runnable migrationHandler) {
     if (tablet.isRootTablet()) {
       migrationHandler.run();
@@ -649,7 +655,7 @@ public class TabletServerResourceManager {
       migrationPool.execute(migrationHandler);
     }
   }
-  
+
   public void stopSplits() {
     splitThreadPool.shutdown();
     defaultSplitThreadPool.shutdown();
@@ -667,7 +673,7 @@ public class TabletServerResourceManager {
       }
     }
   }
-  
+
   public void stopNormalAssignments() {
     assignmentPool.shutdown();
     while (true) {
@@ -681,7 +687,7 @@ public class TabletServerResourceManager {
       }
     }
   }
-  
+
   public void stopMetadataAssignments() {
     assignMetaDataPool.shutdown();
     while (true) {
@@ -695,13 +701,13 @@ public class TabletServerResourceManager {
       }
     }
   }
-  
+
   public LruBlockCache getIndexCache() {
     return _iCache;
   }
-  
+
   public LruBlockCache getDataCache() {
     return _dCache;
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61353d1e/server/src/main/java/org/apache/accumulo/server/tabletserver/compaction/CompactionStrategy.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/compaction/CompactionStrategy.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/compaction/CompactionStrategy.java
index 10f41cd..1fe0537 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/compaction/CompactionStrategy.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/compaction/CompactionStrategy.java
@@ -23,43 +23,41 @@ import java.util.Map;
  * The interface for customizing major compactions.
  * <p>
  * The tablet server has one thread to ask many tablets if they should compact. When the
strategy returns true, then tablet is added to the queue of tablets
- * waiting for a compaction thread. Once a thread is available, the {@link #gatherInformation(MajorCompactionRequest)}
method is called outside the tablets' lock. This gives the strategy the
- * ability to read information that maybe expensive to fetch. Once the gatherInformation
returns, the tablet lock is grabbed and the compactionPlan computed.
- * This should *not* do expensive operations, especially not I/O. Note that the number of
files may change between calls to {@link #gatherInformation(MajorCompactionRequest)} and
- * {@link #getCompactionPlan(MajorCompactionRequest)}.
+ * waiting for a compaction thread. Once a thread is available, the {@link #gatherInformation(MajorCompactionRequest)}
method is called outside the tablets'
+ * lock. This gives the strategy the ability to read information that maybe expensive to
fetch. Once the gatherInformation returns, the tablet lock is grabbed
+ * and the compactionPlan computed. This should *not* do expensive operations, especially
not I/O. Note that the number of files may change between calls to
+ * {@link #gatherInformation(MajorCompactionRequest)} and {@link #getCompactionPlan(MajorCompactionRequest)}.
  * <p>
- * <b>Note:</b> the strategy object used for the {@link #shouldCompact(MajorCompactionRequest)}
call is going to be different from the one used in the compaction thread.
+ * <b>Note:</b> the strategy object used for the {@link #shouldCompact(MajorCompactionRequest)}
call is going to be different from the one used in the
+ * compaction thread.
  */
 public abstract class CompactionStrategy {
-  
+
   /**
-   * The settings for the compaction strategy pulled from zookeeper.  The <tt>table.compacations.major.strategy.opts</tt>
part of the setting will be removed.
+   * The settings for the compaction strategy pulled from zookeeper. The <tt>table.compacations.major.strategy.opts</tt>
part of the setting will be removed.
    * 
    * @param options
    */
   public void init(Map<String,String> options) {}
-  
+
   /**
    * Determine if this tablet is eligible for a major compaction. It's ok if it later determines
(through {@link #gatherInformation(MajorCompactionRequest)} and
    * {@link #getCompactionPlan(MajorCompactionRequest)}) that it does not need to. Any state
stored during shouldCompact will no longer exist when
    * {@link #gatherInformation(MajorCompactionRequest)} and {@link #getCompactionPlan(MajorCompactionRequest)}
are called.
    * 
-   * @param request
-   * @return
-   * @throws IOException
    */
   public abstract boolean shouldCompact(MajorCompactionRequest request) throws IOException;
-  
+
   /**
-   * Called prior to obtaining the tablet lock, useful for examining metadata or indexes.
-   * State collected during this method will be available during the call the {@link #getCompactionPlan(MajorCompactionRequest)}.
+   * Called prior to obtaining the tablet lock, useful for examining metadata or indexes.
State collected during this method will be available during the call
+   * the {@link #getCompactionPlan(MajorCompactionRequest)}.
    * 
    * @param request
    *          basic details about the tablet
    * @throws IOException
    */
   public void gatherInformation(MajorCompactionRequest request) throws IOException {}
-  
+
   /**
    * Get the plan for compacting a tablets files. Called while holding the tablet lock, so
it should not be doing any blocking.
    * 
@@ -69,5 +67,5 @@ public abstract class CompactionStrategy {
    * @throws IOException
    */
   abstract public CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws
IOException;
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61353d1e/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
index 29e1d23..7873df4 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -62,7 +62,6 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
@@ -146,7 +145,7 @@ public class TableOperationsIT {
     assertEquals(tableName, diskUsages.get(0).getTables().first());
 
     String newTable = makeTableName();
-    
+
     // clone table
     connector.tableOperations().clone(tableName, newTable, false, null, null);
 
@@ -182,36 +181,36 @@ public class TableOperationsIT {
     assertEquals(DefaultKeySizeConstraint.class.getName(), props.get(Property.TABLE_CONSTRAINT_PREFIX.toString()
+ "1"));
     connector.tableOperations().delete(tableName);
   }
-  
+
   @Test(timeout = 30 * 1000)
   public void createMergeClonedTable() throws Exception {
     String originalTable = makeTableName();
     TableOperations tops = connector.tableOperations();
-    
+
     TreeSet<Text> splits = Sets.newTreeSet(Arrays.asList(new Text("a"), new Text("b"),
new Text("c"), new Text("d")));
-    
+
     tops.create(originalTable);
     tops.addSplits(originalTable, splits);
-    
+
     BatchWriter bw = connector.createBatchWriter(originalTable, new BatchWriterConfig());
     for (Text row : splits) {
       Mutation m = new Mutation(row);
       for (int i = 0; i < 10; i++) {
         for (int j = 0; j < 10; j++) {
-          m.put(Integer.toString(i), Integer.toString(j), Integer.toString(i+j));
+          m.put(Integer.toString(i), Integer.toString(j), Integer.toString(i + j));
         }
       }
-      
+
       bw.addMutation(m);
     }
-      
+
     bw.close();
-    
+
     String clonedTable = makeTableName();
-    
+
     tops.clone(originalTable, clonedTable, true, null, null);
     tops.merge(clonedTable, null, new Text("b"));
-    
+
     Map<String,Integer> rowCounts = Maps.newHashMap();
     Scanner s = connector.createScanner(clonedTable, new Authorizations());
     for (Entry<Key,Value> entry : s) {
@@ -219,22 +218,22 @@ public class TableOperationsIT {
       String row = key.getRow().toString();
       String cf = key.getColumnFamily().toString(), cq = key.getColumnQualifier().toString();
       String value = entry.getValue().toString();
-      
+
       if (rowCounts.containsKey(row)) {
         rowCounts.put(row, rowCounts.get(row) + 1);
       } else {
         rowCounts.put(row, 1);
       }
-      
+
       Assert.assertEquals(Integer.parseInt(cf) + Integer.parseInt(cq), Integer.parseInt(value));
     }
-    
+
     Collection<Text> clonedSplits = tops.listSplits(clonedTable);
     Set<Text> expectedSplits = Sets.newHashSet(new Text("b"), new Text("c"), new Text("d"));
     for (Text clonedSplit : clonedSplits) {
       Assert.assertTrue("Encountered unexpected split on the cloned table: " + clonedSplit,
expectedSplits.remove(clonedSplit));
     }
-    
+
     Assert.assertTrue("Did not find all expected splits on the cloned table: " + expectedSplits,
expectedSplits.isEmpty());
   }
 


Mime
View raw message