incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1189806 [28/46] - in /incubator/accumulo: branches/1.3/contrib/ branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/ branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/admin/ branches/1.3/src/core/src/main/...
Date Thu, 27 Oct 2011 15:25:17 GMT
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java Thu Oct 27 15:24:51 2011
@@ -154,14 +154,17 @@ public class Tablet {
     }
     
     private void decrementCommitsInProgress() {
-      if (commitsInProgress < 1) throw new IllegalStateException("commitsInProgress = " + commitsInProgress);
+      if (commitsInProgress < 1)
+        throw new IllegalStateException("commitsInProgress = " + commitsInProgress);
       
       commitsInProgress--;
-      if (commitsInProgress == 0) Tablet.this.notifyAll();
+      if (commitsInProgress == 0)
+        Tablet.this.notifyAll();
     }
     
     private void incrementCommitsInProgress() {
-      if (commitsInProgress < 0) throw new IllegalStateException("commitsInProgress = " + commitsInProgress);
+      if (commitsInProgress < 0)
+        throw new IllegalStateException("commitsInProgress = " + commitsInProgress);
       
       commitsInProgress++;
     }
@@ -209,7 +212,8 @@ public class Tablet {
     }
     
     private long getMaxCommittedTime() {
-      if (maxCommittedTime == Long.MIN_VALUE) throw new IllegalStateException("Tried to read max committed time when it was never set");
+      if (maxCommittedTime == Long.MIN_VALUE)
+        throw new IllegalStateException("Tried to read max committed time when it was never set");
       return maxCommittedTime;
     }
     
@@ -313,8 +317,10 @@ public class Tablet {
     
     void updateMemoryUsageStats() {
       long other = 0;
-      if (otherMemTable != null) other = otherMemTable.estimatedSizeInBytes();
-      else if (deletingMemTable != null) other = deletingMemTable.estimatedSizeInBytes();
+      if (otherMemTable != null)
+        other = otherMemTable.estimatedSizeInBytes();
+      else if (deletingMemTable != null)
+        other = deletingMemTable.estimatedSizeInBytes();
       
       tabletResources.updateMemoryUsageStats(memTable.estimatedSizeInBytes(), other);
     }
@@ -322,7 +328,8 @@ public class Tablet {
     List<MemoryIterator> getIterators() {
       List<MemoryIterator> toReturn = new ArrayList<MemoryIterator>(2);
       toReturn.add(memTable.skvIterator());
-      if (otherMemTable != null) toReturn.add(otherMemTable.skvIterator());
+      if (otherMemTable != null)
+        toReturn.add(otherMemTable.skvIterator());
       return toReturn;
     }
     
@@ -333,7 +340,8 @@ public class Tablet {
     }
     
     public long getNumEntries() {
-      if (otherMemTable != null) return memTable.getNumEntries() + otherMemTable.getNumEntries();
+      if (otherMemTable != null)
+        return memTable.getNumEntries() + otherMemTable.getNumEntries();
       return memTable.getNumEntries();
     }
     
@@ -475,7 +483,8 @@ public class Tablet {
       
       String name = (new Path(file)).getName();
       
-      if (name.startsWith(MyMapFile.EXTENSION + "_")) genIndex = 1;
+      if (name.startsWith(MyMapFile.EXTENSION + "_"))
+        genIndex = 1;
       
       int gen = Integer.parseInt(name.split("[_.]")[genIndex]);
       if (gen > maxGen) {
@@ -494,7 +503,8 @@ public class Tablet {
       
       String name = (new Path(file)).getName();
       
-      if (name.startsWith(MyMapFile.EXTENSION + "_")) genIndex = 1;
+      if (name.startsWith(MyMapFile.EXTENSION + "_"))
+        genIndex = 1;
       
       String split[] = name.split("[_.]");
       
@@ -578,18 +588,22 @@ public class Tablet {
       synchronized (Tablet.this) {
         Set<String> absFilePaths = scanFileReservations.remove(reservationId);
         
-        if (absFilePaths == null) throw new IllegalArgumentException("Unknown scan reservation id " + reservationId);
+        if (absFilePaths == null)
+          throw new IllegalArgumentException("Unknown scan reservation id " + reservationId);
         
         boolean notify = false;
         for (String path : absFilePaths) {
           long refCount = fileScanReferenceCounts.decrement(path, 1);
           if (refCount == 0) {
-            if (filesToDeleteAfterScan.remove(path)) filesToDelete.add(path);
+            if (filesToDeleteAfterScan.remove(path))
+              filesToDelete.add(path);
             notify = true;
-          } else if (refCount < 0) throw new IllegalStateException("Scan ref count for " + path + " is " + refCount);
+          } else if (refCount < 0)
+            throw new IllegalStateException("Scan ref count for " + path + " is " + refCount);
         }
         
-        if (notify) Tablet.this.notifyAll();
+        if (notify)
+          Tablet.this.notifyAll();
       }
       
       if (filesToDelete.size() > 0) {
@@ -599,14 +613,17 @@ public class Tablet {
     }
     
     void removeFilesAfterScan(Set<String> scanFiles) {
-      if (scanFiles.size() == 0) return;
+      if (scanFiles.size() == 0)
+        return;
       
       Set<String> filesToDelete = new HashSet<String>();
       
       synchronized (Tablet.this) {
         for (String path : scanFiles) {
-          if (fileScanReferenceCounts.get(path) == 0) filesToDelete.add(path);
-          else filesToDeleteAfterScan.add(path);
+          if (fileScanReferenceCounts.get(path) == 0)
+            filesToDelete.add(path);
+          else
+            filesToDeleteAfterScan.add(path);
         }
       }
       
@@ -623,7 +640,8 @@ public class Tablet {
       Span waitForScans = Trace.start("waitForScans");
       synchronized (Tablet.this) {
         if (blockNewScans) {
-          if (reservationsBlocked) throw new IllegalStateException();
+          if (reservationsBlocked)
+            throw new IllegalStateException();
           
           reservationsBlocked = true;
         }
@@ -639,7 +657,8 @@ public class Tablet {
         }
         
         for (String path : pathsToWaitFor) {
-          if (fileScanReferenceCounts.get(path) > 0) inUse.add(path);
+          if (fileScanReferenceCounts.get(path) > 0)
+            inUse.add(path);
         }
         
         if (blockNewScans) {
@@ -670,8 +689,10 @@ public class Tablet {
         relPaths.put(tpath, path);
         relSizes.put(path, paths.get(tpath));
         
-        if (bulkDir == null) bulkDir = tmpPath.getParent().toString();
-        else if (!bulkDir.equals(tmpPath.getParent().toString())) throw new IllegalArgumentException("bulk files in different dirs " + bulkDir + " " + tmpPath);
+        if (bulkDir == null)
+          bulkDir = tmpPath.getParent().toString();
+        else if (!bulkDir.equals(tmpPath.getParent().toString()))
+          throw new IllegalArgumentException("bulk files in different dirs " + bulkDir + " " + tmpPath);
         
       }
       
@@ -849,7 +870,8 @@ public class Tablet {
         
         // rename before putting in metadata table, so files in metadata table should
         // always exist
-        if (!fs.rename(new Path(tmpDatafile), new Path(newDatafile))) log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
+        if (!fs.rename(new Path(tmpDatafile), new Path(newDatafile)))
+          log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
         
         if (dfv.getNumEntries() == 0) {
           fs.delete(new Path(newDatafile), true);
@@ -892,7 +914,8 @@ public class Tablet {
             throw new IllegalStateException("Target map file already exist " + newDatafile);
           }
           
-          if (!fs.rename(new Path(tmpDatafile), new Path(newDatafile))) log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
+          if (!fs.rename(new Path(tmpDatafile), new Path(newDatafile)))
+            log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
           
           // start deleting files, if we do not finish they will be cleaned
           // up later
@@ -931,7 +954,8 @@ public class Tablet {
       
       if (!extent.equals(Constants.ROOT_TABLET_EXTENT)) {
         Set<String> filesInUseByScans = waitForScansToFinish(oldDatafiles, false, 10000);
-        if (filesInUseByScans.size() > 0) log.debug("Adding scan refs to metadata " + extent + " " + abs2rel(filesInUseByScans));
+        if (filesInUseByScans.size() > 0)
+          log.debug("Adding scan refs to metadata " + extent + " " + abs2rel(filesInUseByScans));
         MetadataTable.replaceDatafiles(extent, datafilesToDelete, abs2rel(filesInUseByScans), shortPath, dfv, SecurityConstants.systemCredentials,
             tabletServer.getClientAddressString(), lastLocation, tabletServer.getLock());
         removeFilesAfterScan(filesInUseByScans);
@@ -966,7 +990,8 @@ public class Tablet {
           }
         }
         
-        if (inconsistent) log.error("data file sets inconsistent " + paths + " " + datafileSizes.keySet());
+        if (inconsistent)
+          log.error("data file sets inconsistent " + paths + " " + datafileSizes.keySet());
         
       }
       
@@ -1023,7 +1048,8 @@ public class Tablet {
     
     // log.debug("extent : "+extent+"   entries : "+entries);
     
-    if (entries.size() == 1) return entries.values().iterator().next().toString();
+    if (entries.size() == 1)
+      return entries.values().iterator().next().toString();
     return null;
   }
   
@@ -1206,7 +1232,8 @@ public class Tablet {
           reader.close();
         }
         
-        if (maxTime + 1 > rtime) time = TabletTime.LOGICAL_TIME_ID + "" + (maxTime + 1);
+        if (maxTime + 1 > rtime)
+          time = TabletTime.LOGICAL_TIME_ID + "" + (maxTime + 1);
       }
     }
     
@@ -1251,7 +1278,8 @@ public class Tablet {
       }
       
       public void propertyChanged(String prop) {
-        if (prop.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())) reloadConstraints();
+        if (prop.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey()))
+          reloadConstraints();
         else if (prop.equals(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey())) {
           try {
             log.info("Default security labels changed for extent: " + extent.toString());
@@ -1367,7 +1395,8 @@ public class Tablet {
         String expectedCompactedFile = location.toString() + "/" + filename.split("\\+")[1];
         if (fs.exists(new Path(expectedCompactedFile))) {
           // compaction finished, but did not finish deleting compacted files.. so delete it
-          if (!fs.delete(file.getPath(), true)) log.warn("Delete of file: " + file.getPath().toString() + " return false");
+          if (!fs.delete(file.getPath(), true))
+            log.warn("Delete of file: " + file.getPath().toString() + " return false");
           continue;
         }
         // compaction did not finish, so put files back
@@ -1376,13 +1405,15 @@ public class Tablet {
         filename = filename.split("\\+", 3)[2];
         path = location + "/" + filename;
         
-        if (!fs.rename(file.getPath(), new Path(path))) log.warn("Rename of " + file.getPath().toString() + " to " + path + " returned false");
+        if (!fs.rename(file.getPath(), new Path(path)))
+          log.warn("Rename of " + file.getPath().toString() + " to " + path + " returned false");
       }
       
       if (filename.endsWith("_tmp")) {
         if (deleteTmp) {
           log.warn("cleaning up old tmp file: " + path);
-          if (!fs.delete(file.getPath(), true)) log.warn("Delete of tmp file: " + file.getPath().toString() + " return false");
+          if (!fs.delete(file.getPath(), true))
+            log.warn("Delete of tmp file: " + file.getPath().toString() + " return false");
           
         }
         continue;
@@ -1427,7 +1458,8 @@ public class Tablet {
     boolean tabletClosed = false;
     
     Set<ByteSequence> cfset = null;
-    if (columnSet.size() > 0) cfset = LocalityGroupUtil.families(columnSet);
+    if (columnSet.size() > 0)
+      cfset = LocalityGroupUtil.families(columnSet);
     
     for (Range range : ranges) {
       
@@ -1439,8 +1471,10 @@ public class Tablet {
       int entriesAdded = 0;
       
       try {
-        if (cfset != null) mmfi.seek(range, cfset, true);
-        else mmfi.seek(range, LocalityGroupUtil.EMPTY_CF_SET, false);
+        if (cfset != null)
+          mmfi.seek(range, cfset, true);
+        else
+          mmfi.seek(range, LocalityGroupUtil.EMPTY_CF_SET, false);
         
         while (mmfi.hasTop()) {
           Key key = mmfi.getTopKey();
@@ -1492,10 +1526,13 @@ public class Tablet {
   }
   
   private void handleTabletClosedDuringScan(ArrayList<KVEntry> results, LookupResult lookupResult, boolean exceededMemoryUsage, Range range, int entriesAdded) {
-    if (exceededMemoryUsage) throw new IllegalStateException("tablet should not exceed memory usage or close, not both");
+    if (exceededMemoryUsage)
+      throw new IllegalStateException("tablet should not exceed memory usage or close, not both");
     
-    if (entriesAdded > 0) addUnfinishedRange(lookupResult, range, results.get(results.size() - 1).key, false);
-    else lookupResult.unfinishedRanges.add(range);
+    if (entriesAdded > 0)
+      addUnfinishedRange(lookupResult, range, results.get(results.size() - 1).key, false);
+    else
+      lookupResult.unfinishedRanges.add(range);
     
     lookupResult.closed = true;
   }
@@ -1609,8 +1646,10 @@ public class Tablet {
       retBatch.continueKey = null;
     }
     
-    if (endOfTabletReached && results.size() == 0) retBatch.results = null;
-    else retBatch.results = results;
+    if (endOfTabletReached && results.size() == 0)
+      retBatch.results = null;
+    else
+      retBatch.results = results;
     
     return retBatch;
   }
@@ -1675,16 +1714,19 @@ public class Tablet {
     
     synchronized ScanBatch read() throws IOException, TabletClosedException {
       
-      if (sawException) throw new IllegalStateException("Tried to use scanner after exception occurred.");
+      if (sawException)
+        throw new IllegalStateException("Tried to use scanner after exception occurred.");
       
-      if (scanClosed) throw new IllegalStateException("Tried to use scanner after it was closed.");
+      if (scanClosed)
+        throw new IllegalStateException("Tried to use scanner after it was closed.");
       
       Batch results = null;
       
       ScanDataSource dataSource;
       
       if (options.isolated) {
-        if (isolatedDataSource == null) isolatedDataSource = new ScanDataSource(options);
+        if (isolatedDataSource == null)
+          isolatedDataSource = new ScanDataSource(options);
         dataSource = isolatedDataSource;
       } else {
         dataSource = new ScanDataSource(options);
@@ -1695,8 +1737,10 @@ public class Tablet {
         SortedKeyValueIterator<Key,Value> iter;
         
         if (options.isolated) {
-          if (isolatedIter == null) isolatedIter = new SourceSwitchingIterator(dataSource, true);
-          else isolatedDataSource.fileManager.reattach();
+          if (isolatedIter == null)
+            isolatedIter = new SourceSwitchingIterator(dataSource, true);
+          else
+            isolatedDataSource.fileManager.reattach();
           iter = isolatedIter;
         } else {
           iter = new SourceSwitchingIterator(dataSource, false);
@@ -1716,8 +1760,10 @@ public class Tablet {
         
       } catch (IterationInterruptedException iie) {
         sawException = true;
-        if (isClosed()) throw new TabletClosedException(iie);
-        else throw iie;
+        if (isClosed())
+          throw new TabletClosedException(iie);
+        else
+          throw iie;
       } catch (IOException ioe) {
         if (shutdownInProgress()) {
           log.debug("IOException while shutdown in progress ", ioe);
@@ -1733,8 +1779,10 @@ public class Tablet {
       } finally {
         // code in finally block because always want
         // to return mapfiles, even when exception is thrown
-        if (!options.isolated) dataSource.close(false);
-        else if (dataSource.fileManager != null) dataSource.fileManager.detach();
+        if (!options.isolated)
+          dataSource.close(false);
+        else if (dataSource.fileManager != null)
+          dataSource.fileManager.detach();
         
         synchronized (Tablet.this) {
           if (results != null && results.results != null) {
@@ -1753,7 +1801,8 @@ public class Tablet {
       options.interruptFlag.set(true);
       synchronized (this) {
         scanClosed = true;
-        if (isolatedDataSource != null) isolatedDataSource.close(false);
+        if (isolatedDataSource != null)
+          isolatedDataSource.close(false);
       }
     }
   }
@@ -1820,13 +1869,15 @@ public class Tablet {
           fileReservationId = -1;
         }
         
-        if (fileManager != null) fileManager.releaseOpenFiles(false);
+        if (fileManager != null)
+          fileManager.releaseOpenFiles(false);
         
         expectedDeletionCount = dataSourceDeletions.get();
         iter = null;
         
         return this;
-      } else return this;
+      } else
+        return this;
     }
     
     @Override
@@ -1836,7 +1887,8 @@ public class Tablet {
     
     @Override
     public SortedKeyValueIterator<Key,Value> iterator() throws IOException {
-      if (iter == null) iter = createIterator();
+      if (iter == null)
+        iter = createIterator();
       return iter;
     }
     
@@ -1846,11 +1898,14 @@ public class Tablet {
       
       synchronized (Tablet.this) {
         
-        if (memIters != null) throw new IllegalStateException("Tried to create new scan iterator w/o releasing memory");
+        if (memIters != null)
+          throw new IllegalStateException("Tried to create new scan iterator w/o releasing memory");
         
-        if (Tablet.this.closed) throw new TabletClosedException();
+        if (Tablet.this.closed)
+          throw new TabletClosedException();
         
-        if (interruptFlag.get()) throw new IterationInterruptedException(extent.toString() + " " + interruptFlag.hashCode());
+        if (interruptFlag.get())
+          throw new IterationInterruptedException(extent.toString() + " " + interruptFlag.hashCode());
         
         // only acquire the file manager when we know the tablet is open
         if (fileManager == null) {
@@ -1858,7 +1913,8 @@ public class Tablet {
           activeScans.add(this);
         }
         
-        if (fileManager.getNumOpenFiles() != 0) throw new IllegalStateException("Tried to create new scan iterator w/o releasing files");
+        if (fileManager.getNumOpenFiles() != 0)
+          throw new IllegalStateException("Tried to create new scan iterator w/o releasing files");
         
         // set this before trying to get iterators in case
         // getIterators() throws an exception
@@ -1902,7 +1958,8 @@ public class Tablet {
       
       synchronized (Tablet.this) {
         activeScans.remove(this);
-        if (activeScans.size() == 0) Tablet.this.notifyAll();
+        if (activeScans.size() == 0)
+          Tablet.this.notifyAll();
       }
       
       if (fileManager != null) {
@@ -1957,11 +2014,14 @@ public class Tablet {
       if (!failed) {
         lastMinorCompactionFinishTime = System.currentTimeMillis();
       }
-      if (tabletServer.mincMetrics.isEnabled()) tabletServer.mincMetrics.add(TabletServerMinCMetrics.minc, (lastMinorCompactionFinishTime - start));
+      if (tabletServer.mincMetrics.isEnabled())
+        tabletServer.mincMetrics.add(TabletServerMinCMetrics.minc, (lastMinorCompactionFinishTime - start));
       if (hasQueueTime) {
         timer.updateTime(Operation.MINOR, queued, start, count, failed);
-        if (tabletServer.mincMetrics.isEnabled()) tabletServer.mincMetrics.add(TabletServerMinCMetrics.queue, (start - queued));
-      } else timer.updateTime(Operation.MINOR, start, count, failed);
+        if (tabletServer.mincMetrics.isEnabled())
+          tabletServer.mincMetrics.add(TabletServerMinCMetrics.queue, (start - queued));
+      } else
+        timer.updateTime(Operation.MINOR, start, count, failed);
     }
   }
   
@@ -2052,9 +2112,10 @@ public class Tablet {
           logMessage.append(" closing " + closing);
           logMessage.append(" closed " + closed);
           logMessage.append(" majorCompactionWaitingToStart " + majorCompactionWaitingToStart);
-          if (tabletMemory != null) logMessage.append(" tabletMemory.memoryReservedForMinC() " + tabletMemory.memoryReservedForMinC());
-          if (tabletMemory != null && tabletMemory.getMemTable() != null) logMessage.append(" tabletMemory.getMemTable().getNumEntries() "
-              + tabletMemory.getMemTable().getNumEntries());
+          if (tabletMemory != null)
+            logMessage.append(" tabletMemory.memoryReservedForMinC() " + tabletMemory.memoryReservedForMinC());
+          if (tabletMemory != null && tabletMemory.getMemTable() != null)
+            logMessage.append(" tabletMemory.getMemTable().getNumEntries() " + tabletMemory.getMemTable().getNumEntries());
           
           return false;
         }
@@ -2071,7 +2132,8 @@ public class Tablet {
       }
     } finally {
       // log outside of sync block
-      if (logMessage != null && log.isDebugEnabled()) log.debug(logMessage);
+      if (logMessage != null && log.isDebugEnabled())
+        log.debug(logMessage);
     }
     
     tabletResources.executeMinorCompaction(mct);
@@ -2143,7 +2205,8 @@ public class Tablet {
       Violations more = cc.check(extent, mutation);
       if (more != null) {
         violations.add(more);
-        if (violators == null) violators = new ArrayList<Mutation>();
+        if (violators == null)
+          violators = new ArrayList<Mutation>();
         violators.add(mutation);
       }
     }
@@ -2167,7 +2230,8 @@ public class Tablet {
         // if everything is a violation, then it is expected that
         // code calling this will not log or commit
         commitSession = finishPreparingMutations(time);
-        if (commitSession == null) return null;
+        if (commitSession == null)
+          return null;
       }
       
       throw new TConstraintViolationException(violations, violators, nonViolators, commitSession);
@@ -2187,7 +2251,8 @@ public class Tablet {
     
     commitSession.decrementCommitsInProgress();
     writesInProgress--;
-    if (writesInProgress == 0) this.notifyAll();
+    if (writesInProgress == 0)
+      this.notifyAll();
   }
   
   public void commit(CommitSession commitSession, List<Mutation> mutations) {
@@ -2216,7 +2281,8 @@ public class Tablet {
       
       // decrement here in case an exception is thrown below
       writesInProgress--;
-      if (writesInProgress == 0) this.notifyAll();
+      if (writesInProgress == 0)
+        this.notifyAll();
       
       commitSession.decrementCommitsInProgress();
       
@@ -2248,9 +2314,12 @@ public class Tablet {
     synchronized (this) {
       if (closed || closing || closeComplete) {
         String msg = "Tablet " + getExtent() + " already";
-        if (closed) msg += " closed";
-        if (closing) msg += " closing";
-        if (closeComplete) msg += " closeComplete";
+        if (closed)
+          msg += " closed";
+        if (closing)
+          msg += " closing";
+        if (closeComplete)
+          msg += " closeComplete";
         throw new IllegalStateException(msg);
       }
       
@@ -2343,7 +2412,8 @@ public class Tablet {
           UtilWaitThread.sleep(500);
         }
       }
-      if (err != null) throw err;
+      if (err != null)
+        throw err;
     }
     
     try {
@@ -2494,7 +2564,8 @@ public class Tablet {
    * 
    */
   public boolean needsMajorCompaction(boolean idleCompaction) {
-    if (majorCompactionInProgress) return false;
+    if (majorCompactionInProgress)
+      return false;
     return tabletResources.needsMajorCompaction(idleCompaction);
   }
   
@@ -2604,7 +2675,8 @@ public class Tablet {
           Key candidate = keys.get(keys.firstKey());
           if (candidate.compareRow(lastRow) != 0) {
             // we should use this ratio in split size estimations
-            if (log.isTraceEnabled()) log.trace(String.format("Splitting at %6.2f instead of .5, row at .5 is same as end row\n", keys.firstKey()));
+            if (log.isTraceEnabled())
+              log.trace(String.format("Splitting at %6.2f instead of .5, row at .5 is same as end row\n", keys.firstKey()));
             return new SplitRowSpec(keys.firstKey(), candidate.getRow());
           }
           
@@ -2651,8 +2723,10 @@ public class Tablet {
   public synchronized boolean needsSplit() {
     boolean ret;
     
-    if (closing || closed) ret = false;
-    else ret = findSplitRow() != null;
+    if (closing || closed)
+      ret = false;
+    else
+      ret = findSplitRow() != null;
     
     return ret;
   }
@@ -2737,7 +2811,8 @@ public class Tablet {
         
         readers.clear();
         
-        if (e instanceof IOException) throw (IOException) e;
+        if (e instanceof IOException)
+          throw (IOException) e;
         throw new IOException("Failed to open map data files", e);
       }
     }
@@ -2879,7 +2954,9 @@ public class Tablet {
             mfw.close();
           } finally {
             Path path = new Path(compactTmpName);
-            if (!fs.delete(path, true)) if (fs.exists(path)) log.error("Unable to delete " + compactTmpName);
+            if (!fs.delete(path, true))
+              if (fs.exists(path))
+                log.error("Unable to delete " + compactTmpName);
           }
         }
       } catch (IOException e) {
@@ -2950,7 +3027,8 @@ public class Tablet {
       while (numToCompact > 0) {
         fileNames.add(getNextMapFilename());
         numToCompact -= maxFilesToCompact;
-        if (numToCompact > 0) numToCompact++;
+        if (numToCompact > 0)
+          numToCompact++;
       }
       
       t3 = System.currentTimeMillis();
@@ -3011,8 +3089,10 @@ public class Tablet {
     PriorityQueue<Pair<String,Long>> fileHeap = new PriorityQueue<Pair<String,Long>>(filesToCompact.size(), new Comparator<Pair<String,Long>>() {
       @Override
       public int compare(Pair<String,Long> o1, Pair<String,Long> o2) {
-        if (o1.getSecond() == o2.getSecond()) return o1.getFirst().compareTo(o2.getFirst());
-        if (o1.getSecond() < o2.getSecond()) return -1;
+        if (o1.getSecond() == o2.getSecond())
+          return o1.getFirst().compareTo(o2.getFirst());
+        if (o1.getSecond() < o2.getSecond())
+          return -1;
         return 1;
       }
     });
@@ -3230,7 +3310,8 @@ public class Tablet {
       
       // choose a split point
       SplitRowSpec splitPoint;
-      if (sp == null) splitPoint = findSplitRow();
+      if (sp == null)
+        splitPoint = findSplitRow();
       else {
         Text tsp = new Text(sp);
         splitPoint = new SplitRowSpec(FileUtil.estimatePercentageLTE(extent.getPrevEndRow(), extent.getEndRow(), tabletResources.getCopyOfMapFilePaths(), tsp),
@@ -3348,7 +3429,8 @@ public class Tablet {
         throw new IOException("Timeout waiting " + (lockWait / 1000.) + " seconds to get tablet lock");
       }
       
-      if (writesInProgress < 0) throw new IllegalStateException("writesInProgress < 0 " + writesInProgress);
+      if (writesInProgress < 0)
+        throw new IllegalStateException("writesInProgress < 0 " + writesInProgress);
       
       writesInProgress++;
     }
@@ -3358,10 +3440,12 @@ public class Tablet {
       lastMapFileImportTime = System.currentTimeMillis();
     } finally {
       synchronized (this) {
-        if (writesInProgress < 1) throw new IllegalStateException("writesInProgress < 1 " + writesInProgress);
+        if (writesInProgress < 1)
+          throw new IllegalStateException("writesInProgress < 1 " + writesInProgress);
         
         writesInProgress--;
-        if (writesInProgress == 0) this.notifyAll();
+        if (writesInProgress == 0)
+          this.notifyAll();
       }
     }
   }
@@ -3378,7 +3462,8 @@ public class Tablet {
     logLock.lock();
     
     synchronized (this) {
-      if (removingLogs) throw new IllegalStateException("Attempted to clear logs when removal of logs in progress");
+      if (removingLogs)
+        throw new IllegalStateException("Attempted to clear logs when removal of logs in progress");
       
       for (RemoteLogger logger : otherLogs) {
         otherLogsCopy.add(logger.toString());
@@ -3392,7 +3477,8 @@ public class Tablet {
       
       otherLogs = Collections.emptySet();
       
-      if (doomed.size() > 0) removingLogs = true;
+      if (doomed.size() > 0)
+        removingLogs = true;
     }
     
     // do debug logging outside tablet lock
@@ -3438,30 +3524,40 @@ public class Tablet {
         
         boolean addToOther;
         
-        if (memTable == tabletMemory.otherMemTable) addToOther = true;
-        else if (memTable == tabletMemory.memTable) addToOther = false;
-        else throw new IllegalArgumentException("passed in memtable that is not in use");
+        if (memTable == tabletMemory.otherMemTable)
+          addToOther = true;
+        else if (memTable == tabletMemory.memTable)
+          addToOther = false;
+        else
+          throw new IllegalArgumentException("passed in memtable that is not in use");
         
         if (mincFinish) {
-          if (addToOther) throw new IllegalStateException("Adding to other logs for mincFinish");
-          if (otherLogs.size() != 0) throw new IllegalStateException("Expect other logs to be 0 when min finish, but its " + otherLogs);
+          if (addToOther)
+            throw new IllegalStateException("Adding to other logs for mincFinish");
+          if (otherLogs.size() != 0)
+            throw new IllegalStateException("Expect other logs to be 0 when min finish, but its " + otherLogs);
           
           // when writing a minc finish event, there is no need to add the log to !METADATA
           // if nothing has been logged for the tablet since the minor compaction started
-          if (currentLogs.size() == 0) return false;
+          if (currentLogs.size() == 0)
+            return false;
         }
         
         int numAdded = 0;
         int numContained = 0;
         for (RemoteLogger logger : more) {
           if (addToOther) {
-            if (otherLogs.add(logger)) numAdded++;
+            if (otherLogs.add(logger))
+              numAdded++;
             
-            if (currentLogs.contains(logger)) numContained++;
+            if (currentLogs.contains(logger))
+              numContained++;
           } else {
-            if (currentLogs.add(logger)) numAdded++;
+            if (currentLogs.add(logger))
+              numAdded++;
             
-            if (otherLogs.contains(logger)) numContained++;
+            if (otherLogs.contains(logger))
+              numContained++;
           }
         }
         
@@ -3483,7 +3579,8 @@ public class Tablet {
         return false;
       }
     } finally {
-      if (releaseLock) logLock.unlock();
+      if (releaseLock)
+        logLock.unlock();
     }
   }
   

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletIteratorEnvironment.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletIteratorEnvironment.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletIteratorEnvironment.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletIteratorEnvironment.java Thu Oct 27 15:24:51 2011
@@ -35,7 +35,8 @@ public class TabletIteratorEnvironment i
   private AccumuloConfiguration config;
   
   TabletIteratorEnvironment(IteratorScope scope, AccumuloConfiguration config) {
-    if (scope == IteratorScope.majc) throw new IllegalArgumentException("must set if compaction is full");
+    if (scope == IteratorScope.majc)
+      throw new IllegalArgumentException("must set if compaction is full");
     
     this.scope = scope;
     this.trm = null;
@@ -43,7 +44,8 @@ public class TabletIteratorEnvironment i
   }
   
   TabletIteratorEnvironment(IteratorScope scope, AccumuloConfiguration config, ScanFileManager trm) {
-    if (scope == IteratorScope.majc) throw new IllegalArgumentException("must set if compaction is full");
+    if (scope == IteratorScope.majc)
+      throw new IllegalArgumentException("must set if compaction is full");
     
     this.scope = scope;
     this.trm = trm;
@@ -51,7 +53,8 @@ public class TabletIteratorEnvironment i
   }
   
   TabletIteratorEnvironment(IteratorScope scope, boolean fullMajC, AccumuloConfiguration config) {
-    if (scope != IteratorScope.majc) throw new IllegalArgumentException("Tried to set maj compaction type when scope was " + scope);
+    if (scope != IteratorScope.majc)
+      throw new IllegalArgumentException("Tried to set maj compaction type when scope was " + scope);
     
     this.scope = scope;
     this.trm = null;
@@ -71,7 +74,8 @@ public class TabletIteratorEnvironment i
   
   @Override
   public boolean isFullMajorCompaction() {
-    if (scope != IteratorScope.majc) throw new IllegalStateException("Asked about major compaction type when scope is " + scope);
+    if (scope != IteratorScope.majc)
+      throw new IllegalStateException("Asked about major compaction type when scope is " + scope);
     return fullMajorCompaction;
   }
   

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Thu Oct 27 15:24:51 2011
@@ -368,7 +368,8 @@ public class TabletServer extends Abstra
     synchronized Session reserveSession(long sessionId) {
       Session session = sessions.get(sessionId);
       if (session != null) {
-        if (session.reserved) throw new IllegalStateException();
+        if (session.reserved)
+          throw new IllegalStateException();
         session.reserved = true;
       }
       
@@ -377,19 +378,22 @@ public class TabletServer extends Abstra
     }
     
     synchronized void unreserveSession(Session session) {
-      if (!session.reserved) throw new IllegalStateException();
+      if (!session.reserved)
+        throw new IllegalStateException();
       session.reserved = false;
       session.lastAccessTime = System.currentTimeMillis();
     }
     
     synchronized void unreserveSession(long sessionId) {
       Session session = getSession(sessionId);
-      if (session != null) unreserveSession(session);
+      if (session != null)
+        unreserveSession(session);
     }
     
     synchronized Session getSession(long sessionId) {
       Session session = sessions.get(sessionId);
-      if (session != null) session.lastAccessTime = System.currentTimeMillis();
+      if (session != null)
+        session.lastAccessTime = System.currentTimeMillis();
       return session;
     }
     
@@ -400,7 +404,8 @@ public class TabletServer extends Abstra
       }
       
       // do clean up out side of lock..
-      if (session != null) session.cleanup();
+      if (session != null)
+        session.cleanup();
       
       return session;
     }
@@ -441,7 +446,8 @@ public class TabletServer extends Abstra
             }
             
             // call clean up outside of lock
-            if (sessionToCleanup != null) sessionToCleanup.cleanup();
+            if (sessionToCleanup != null)
+              sessionToCleanup.cleanup();
           }
         };
         
@@ -521,9 +527,11 @@ public class TabletServer extends Abstra
     @Override
     public void cleanup() {
       try {
-        if (nextBatchTask != null) nextBatchTask.cancel(true);
+        if (nextBatchTask != null)
+          nextBatchTask.cancel(true);
       } finally {
-        if (scanner != null) scanner.close();
+        if (scanner != null)
+          scanner.close();
       }
     }
     
@@ -547,7 +555,8 @@ public class TabletServer extends Abstra
     
     @Override
     public void cleanup() {
-      if (lookupTask != null) lookupTask.cancel(true);
+      if (lookupTask != null)
+        lookupTask.cancel(true);
     }
   }
   
@@ -573,13 +582,15 @@ public class TabletServer extends Abstra
     }
     
     synchronized void finishWrite(long operationId) {
-      if (operationId == -1) return;
+      if (operationId == -1)
+        return;
       
       boolean removed = false;
       
       for (TabletType ttype : TabletType.values()) {
         removed = inProgressWrites.get(ttype).remove(operationId);
-        if (removed) break;
+        if (removed)
+          break;
       }
       
       if (!removed) {
@@ -601,7 +612,8 @@ public class TabletServer extends Abstra
     }
     
     public long startWrite(Set<Tablet> keySet) {
-      if (keySet.size() == 0) return -1;
+      if (keySet.size() == 0)
+        return -1;
       
       ArrayList<KeyExtent> extents = new ArrayList<KeyExtent>(keySet.size());
       
@@ -642,8 +654,8 @@ public class TabletServer extends Abstra
       
       for (Entry<TKeyExtent,Map<String,MapFileInfo>> entry : files.entrySet()) {
         try {
-          if (!authenticator.hasTablePermission(credentials, credentials.user, new String(entry.getKey().getTable()), TablePermission.BULK_IMPORT)) throw new ThriftSecurityException(
-              credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+          if (!authenticator.hasTablePermission(credentials, credentials.user, new String(entry.getKey().getTable()), TablePermission.BULK_IMPORT))
+            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
         } catch (AccumuloSecurityException e) {
           throw e.asThriftException();
         }
@@ -690,15 +702,19 @@ public class TabletServer extends Abstra
       }
       
       protected void addResult(Object o) {
-        if (state.compareAndSet(INITIAL, ADDED)) resultQueue.add(o);
-        else if (state.get() == ADDED) throw new IllegalStateException("Tried to add more than one result");
+        if (state.compareAndSet(INITIAL, ADDED))
+          resultQueue.add(o);
+        else if (state.get() == ADDED)
+          throw new IllegalStateException("Tried to add more than one result");
       }
       
       @Override
       public boolean cancel(boolean mayInterruptIfRunning) {
-        if (!mayInterruptIfRunning) throw new IllegalArgumentException("Cancel will always attempt to interupt running next batch task");
+        if (!mayInterruptIfRunning)
+          throw new IllegalArgumentException("Cancel will always attempt to interupt running next batch task");
         
-        if (state.get() == CANCELED) return true;
+        if (state.get() == CANCELED)
+          return true;
         
         if (state.compareAndSet(INITIAL, CANCELED)) {
           interruptFlag.set(true);
@@ -720,25 +736,30 @@ public class TabletServer extends Abstra
         
         ArrayBlockingQueue<Object> localRQ = resultQueue;
         
-        if (state.get() == CANCELED) throw new CancellationException();
+        if (state.get() == CANCELED)
+          throw new CancellationException();
         
-        if (localRQ == null && state.get() == ADDED) throw new IllegalStateException("Tried to get result twice");
+        if (localRQ == null && state.get() == ADDED)
+          throw new IllegalStateException("Tried to get result twice");
         
         Object r = localRQ.poll(timeout, unit);
         
         // could have been canceled while waiting
         if (state.get() == CANCELED) {
-          if (r != null) throw new IllegalStateException("Nothing should have been added when in canceled state");
+          if (r != null)
+            throw new IllegalStateException("Nothing should have been added when in canceled state");
           
           throw new CancellationException();
         }
         
-        if (r == null) throw new TimeoutException();
+        if (r == null)
+          throw new TimeoutException();
         
         // make this method stop working now that something is being returned
         resultQueue = null;
         
-        if (r instanceof Throwable) throw new ExecutionException((Throwable) r);
+        if (r instanceof Throwable)
+          throw new ExecutionException((Throwable) r);
         
         return (T) r;
       }
@@ -763,7 +784,8 @@ public class TabletServer extends Abstra
         this.scanID = scanID;
         this.interruptFlag = interruptFlag;
         
-        if (interruptFlag.get()) cancel(true);
+        if (interruptFlag.get())
+          cancel(true);
       }
       
       @Override
@@ -772,7 +794,8 @@ public class TabletServer extends Abstra
         ScanSession scanSession = (ScanSession) sessionManager.getSession(scanID);
         
         try {
-          if (isCancelled() || scanSession == null) return;
+          if (isCancelled() || scanSession == null)
+            return;
           
           Tablet tablet = onlineTablets.get(scanSession.extent);
           
@@ -822,7 +845,8 @@ public class TabletServer extends Abstra
         MultiScanSession session = (MultiScanSession) sessionManager.getSession(scanID);
         
         try {
-          if (isCancelled() || session == null) return;
+          if (isCancelled() || session == null)
+            return;
           
           long maxResultsSize = acuConf.getMemoryInBytes(Property.TABLE_SCAN_MAXMEM);
           long bytesAdded = 0;
@@ -856,7 +880,8 @@ public class TabletServer extends Abstra
             try {
               
               // do the following check to avoid a race condition between setting false below and the task being canceled
-              if (isCancelled()) interruptFlag.set(true);
+              if (isCancelled())
+                interruptFlag.set(true);
               
               lookupResult = tablet.lookup(entry.getValue(), session.columnSet, session.auths, results, maxResultsSize - bytesAdded, session.ssiList,
                   session.ssio, interruptFlag);
@@ -926,12 +951,13 @@ public class TabletServer extends Abstra
       Authorizations userauths = null;
       
       try {
-        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(textent.getTable()), TablePermission.READ)) throw new ThriftSecurityException(
-            credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(textent.getTable()), TablePermission.READ))
+          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
         
         userauths = authenticator.getUserAuthorizations(credentials, credentials.user);
         for (byte[] auth : authorizations)
-          if (!userauths.contains(auth)) throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
+          if (!userauths.contains(auth))
+            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
       } catch (AccumuloSecurityException e) {
         throw e.asThriftException();
       }
@@ -950,10 +976,12 @@ public class TabletServer extends Abstra
       // the restarted client may not see the write unless we wait here.
       // this behavior is very important when the client is reading the
       // !METADATA table
-      if (waitForWrites) writeTracker.waitForWrites(TabletType.type(extent));
+      if (waitForWrites)
+        writeTracker.waitForWrites(TabletType.type(extent));
       
       Tablet tablet = onlineTablets.get(extent);
-      if (tablet == null) throw new NotServingTabletException(textent);
+      if (tablet == null)
+        throw new NotServingTabletException(textent);
       
       ScanSession scanSession = new ScanSession();
       scanSession.user = credentials.user;
@@ -1014,15 +1042,19 @@ public class TabletServer extends Abstra
         scanSession.nextBatchTask = null;
       } catch (ExecutionException e) {
         sessionManager.removeSession(scanID);
-        if (e.getCause() instanceof NotServingTabletException) throw (NotServingTabletException) e.getCause();
-        else if (e.getCause() instanceof TooManyFilesException) throw new org.apache.accumulo.core.tabletserver.thrift.TooManyFilesException(
-            scanSession.extent.toThrift());
-        else throw new RuntimeException(e);
+        if (e.getCause() instanceof NotServingTabletException)
+          throw (NotServingTabletException) e.getCause();
+        else if (e.getCause() instanceof TooManyFilesException)
+          throw new org.apache.accumulo.core.tabletserver.thrift.TooManyFilesException(scanSession.extent.toThrift());
+        else
+          throw new RuntimeException(e);
       } catch (CancellationException ce) {
         sessionManager.removeSession(scanID);
         Tablet tablet = onlineTablets.get(scanSession.extent);
-        if (tablet == null || tablet.isClosed()) throw new NotServingTabletException(scanSession.extent.toThrift());
-        else throw new NoSuchScanIDException();
+        if (tablet == null || tablet.isClosed())
+          throw new NotServingTabletException(scanSession.extent.toThrift());
+        else
+          throw new NoSuchScanIDException();
       } catch (TimeoutException e) {
         long timeout = acuConf.getTimeInMillis(Property.TSERV_CLIENT_TIMEOUT);
         List<TKeyValue> param = Collections.emptyList();
@@ -1046,7 +1078,8 @@ public class TabletServer extends Abstra
         resourceManager.executeReadAhead(scanSession.extent, scanSession.nextBatchTask);
       }
       
-      if (!scanResult.more) closeScan(tinfo, scanID);
+      if (!scanResult.more)
+        closeScan(tinfo, scanID);
       
       return scanResult;
     }
@@ -1079,12 +1112,13 @@ public class TabletServer extends Abstra
       Authorizations userauths = null;
       try {
         for (String table : tables)
-          if (!authenticator.hasTablePermission(credentials, credentials.user, table, TablePermission.READ)) throw new ThriftSecurityException(
-              credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+          if (!authenticator.hasTablePermission(credentials, credentials.user, table, TablePermission.READ))
+            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
         
         userauths = authenticator.getUserAuthorizations(credentials, credentials.user);
         for (byte[] auth : authorizations)
-          if (!userauths.contains(auth)) throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
+          if (!userauths.contains(auth))
+            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
       } catch (AccumuloSecurityException e) {
         throw e.asThriftException();
       }
@@ -1105,7 +1139,8 @@ public class TabletServer extends Abstra
         
       }
       
-      if (waitForWrites) writeTracker.waitForWrites(TabletType.type(batch.keySet()));
+      if (waitForWrites)
+        writeTracker.waitForWrites(TabletType.type(batch.keySet()));
       
       MultiScanSession mss = new MultiScanSession();
       mss.user = credentials.user;
@@ -1199,7 +1234,8 @@ public class TabletServer extends Abstra
       // Make sure user is real
       try {
         if (!authenticator.authenticateUser(credentials, credentials.user, credentials.password)) {
-          if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+          if (updateMetrics.isEnabled())
+            updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
           throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
         }
       } catch (AccumuloSecurityException e) {
@@ -1236,7 +1272,8 @@ public class TabletServer extends Abstra
             } else {
               // not serving tablet, so report all mutations as failures
               us.failures.put(keyExtent, 0l);
-              if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.unknownTabletErrors, 0);
+              if (updateMetrics.isEnabled())
+                updateMetrics.add(TabletServerUpdateMetrics.unknownTabletErrors, 0);
             }
           } else {
             log.warn("Denying access to table " + keyExtent.getTableId() + " for user " + us.credentials.user);
@@ -1244,7 +1281,8 @@ public class TabletServer extends Abstra
             us.authTimes.addStat(t2 - t1);
             us.currentTablet = null;
             us.authFailures.add(keyExtent);
-            if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+            if (updateMetrics.isEnabled())
+              updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
             return;
           }
         } catch (AccumuloSecurityException e) {
@@ -1253,7 +1291,8 @@ public class TabletServer extends Abstra
           us.authTimes.addStat(t2 - t1);
           us.currentTablet = null;
           us.authFailures.add(keyExtent);
-          if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+          if (updateMetrics.isEnabled())
+            updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
           return;
         } finally {
           sessionManager.unreserveSession(us);
@@ -1275,7 +1314,8 @@ public class TabletServer extends Abstra
           Mutation mutation = new Mutation(tmutation);
           us.queuedMutations.get(us.currentTablet).add(mutation);
           us.queuedMutationSize += mutation.numBytes();
-          if (us.queuedMutationSize > AccumuloConfiguration.getSystemConfiguration().getMemoryInBytes(Property.TSERV_MUTATION_QUEUE_MAX)) flush(us);
+          if (us.queuedMutationSize > AccumuloConfiguration.getSystemConfiguration().getMemoryInBytes(Property.TSERV_MUTATION_QUEUE_MAX))
+            flush(us);
         }
       } finally {
         sessionManager.unreserveSession(us);
@@ -1292,9 +1332,11 @@ public class TabletServer extends Abstra
       
       boolean containsMetadataTablet = false;
       for (Tablet tablet : us.queuedMutations.keySet())
-        if (tablet.getExtent().getTableId().toString().equals(Constants.METADATA_TABLE_ID)) containsMetadataTablet = true;
+        if (tablet.getExtent().getTableId().toString().equals(Constants.METADATA_TABLE_ID))
+          containsMetadataTablet = true;
       
-      if (!containsMetadataTablet && us.queuedMutations.size() > 0) TabletServer.this.resourceManager.waitUntilCommitsAreEnabled();
+      if (!containsMetadataTablet && us.queuedMutations.size() > 0)
+        TabletServer.this.resourceManager.waitUntilCommitsAreEnabled();
       
       Span prep = Trace.start("prep");
       for (Entry<Tablet,? extends List<Mutation>> entry : us.queuedMutations.entrySet()) {
@@ -1303,7 +1345,8 @@ public class TabletServer extends Abstra
         List<Mutation> mutations = entry.getValue();
         if (mutations.size() > 0) {
           try {
-            if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.mutationArraySize, mutations.size());
+            if (updateMetrics.isEnabled())
+              updateMetrics.add(TabletServerUpdateMetrics.mutationArraySize, mutations.size());
             
             CommitSession commitSession = tablet.prepareMutationsForCommit(mutations);
             if (commitSession == null) {
@@ -1318,7 +1361,8 @@ public class TabletServer extends Abstra
             
           } catch (TConstraintViolationException e) {
             us.violations.add(e.getViolations());
-            if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.constraintViolations, 0);
+            if (updateMetrics.isEnabled())
+              updateMetrics.add(TabletServerUpdateMetrics.constraintViolations, 0);
             
             if (e.getNonViolators().size() > 0) {
               // only log and commit mutations if there were some that did not
@@ -1346,7 +1390,8 @@ public class TabletServer extends Abstra
       long pt2 = System.currentTimeMillis();
       long avgPrepareTime = (long) ((pt2 - pt1) / (double) us.queuedMutations.size());
       us.prepareTimes.addStat(pt2 - pt1);
-      if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.commitPrep, (avgPrepareTime));
+      if (updateMetrics.isEnabled())
+        updateMetrics.add(TabletServerUpdateMetrics.commitPrep, (avgPrepareTime));
       
       if (error != null) {
         for (Entry<CommitSession,List<Mutation>> e : sendables.entrySet()) {
@@ -1363,7 +1408,8 @@ public class TabletServer extends Abstra
             
             long t2 = System.currentTimeMillis();
             us.walogTimes.addStat(t2 - t1);
-            if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.waLogWriteTime, (t2 - t1));
+            if (updateMetrics.isEnabled())
+              updateMetrics.add(TabletServerUpdateMetrics.waLogWriteTime, (t2 - t1));
             
             break;
           } catch (IOException ex) {
@@ -1400,7 +1446,8 @@ public class TabletServer extends Abstra
         us.flushTime += (t2 - pt1);
         us.commitTimes.addStat(t2 - t1);
         
-        if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.commitTime, avgCommitTime);
+        if (updateMetrics.isEnabled())
+          updateMetrics.add(TabletServerUpdateMetrics.commitTime, avgCommitTime);
         commit.stop();
       } finally {
         us.queuedMutations.clear();
@@ -1455,8 +1502,8 @@ public class TabletServer extends Abstra
     public void update(TInfo tinfo, AuthInfo credentials, TKeyExtent tkeyExtent, TMutation tmutation) throws NotServingTabletException,
         ConstraintViolationException, ThriftSecurityException {
       try {
-        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(tkeyExtent.getTable()), TablePermission.WRITE)) throw new ThriftSecurityException(
-            credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(tkeyExtent.getTable()), TablePermission.WRITE))
+          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
       } catch (AccumuloSecurityException e) {
         throw e.asThriftException();
       }
@@ -1467,7 +1514,8 @@ public class TabletServer extends Abstra
         throw new NotServingTabletException(tkeyExtent);
       }
       
-      if (!keyExtent.getTableId().toString().equals(Constants.METADATA_TABLE_ID)) TabletServer.this.resourceManager.waitUntilCommitsAreEnabled();
+      if (!keyExtent.getTableId().toString().equals(Constants.METADATA_TABLE_ID))
+        TabletServer.this.resourceManager.waitUntilCommitsAreEnabled();
       
       long opid = writeTracker.startWrite(TabletType.type(keyExtent));
       
@@ -1510,8 +1558,8 @@ public class TabletServer extends Abstra
       try {
         if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_TABLE)
             && !authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
-            && !authenticator.hasTablePermission(credentials, credentials.user, tableId, TablePermission.ALTER_TABLE)) throw new ThriftSecurityException(
-            credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+            && !authenticator.hasTablePermission(credentials, credentials.user, tableId, TablePermission.ALTER_TABLE))
+          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
       } catch (AccumuloSecurityException e) {
         throw e.asThriftException();
       }
@@ -1753,8 +1801,8 @@ public class TabletServer extends Abstra
     public List<ActiveScan> getActiveScans(TInfo tinfo, AuthInfo credentials) throws ThriftSecurityException, TException {
       
       try {
-        if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)) throw new ThriftSecurityException(credentials.user,
-            SecurityErrorCode.PERMISSION_DENIED);
+        if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM))
+          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
       } catch (AccumuloSecurityException e) {
         throw e.asThriftException();
       }
@@ -2143,7 +2191,8 @@ public class TabletServer extends Abstra
           successful = true;
         } catch (Throwable e) {
           log.warn("exception trying to assign tablet " + extentToOpen + " " + locationToOpen, e);
-          if (e.getMessage() != null) log.warn(e.getMessage());
+          if (e.getMessage() != null)
+            log.warn(e.getMessage());
           String table = extent.getTableId().toString();
           ProblemReports.getInstance().report(new ProblemReport(table, TABLET_LOAD, extentToOpen.getUUID().toString(), getClientAddressString(), e));
         }
@@ -2235,9 +2284,11 @@ public class TabletServer extends Abstra
     Set<String> result = loggerStrategy.getLoggers(Collections.unmodifiableSet(allLoggers));
     Set<String> bogus = new HashSet<String>(result);
     bogus.removeAll(allLoggers);
-    if (!bogus.isEmpty()) log.warn("logger strategy is returning loggers that are not candidates");
+    if (!bogus.isEmpty())
+      log.warn("logger strategy is returning loggers that are not candidates");
     result.removeAll(bogus);
-    if (result.isEmpty()) log.warn("strategy returned no useful loggers");
+    if (result.isEmpty())
+      log.warn("strategy returned no useful loggers");
     return result;
   }
   
@@ -2272,7 +2323,8 @@ public class TabletServer extends Abstra
   private String getMasterAddress() {
     try {
       List<String> locations = HdfsZooInstance.getInstance().getMasterLocations();
-      if (locations.size() == 0) return null;
+      if (locations.size() == 0)
+        return null;
       return locations.get(0);
     } catch (Exception e) {
       log.warn("Failed to obtain master host " + e);
@@ -2512,7 +2564,8 @@ public class TabletServer extends Abstra
         Text metadataEntry = extent.getMetadataEntry();
         for (Entry<Key,Value> entry : tabletsKeyValues.entrySet()) {
           Key key = entry.getKey();
-          if (!metadataEntry.equals(key.getRow())) continue;
+          if (!metadataEntry.equals(key.getRow()))
+            continue;
           Text cf = key.getColumnFamily();
           if (cf.equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
             future = new TServerInstance(entry.getValue(), key.getColumnQualifier());
@@ -2609,13 +2662,15 @@ public class TabletServer extends Abstra
   }
   
   public String getClientAddressString() {
-    if (clientAddress == null) return null;
+    if (clientAddress == null)
+      return null;
     return AddressUtil.toString(clientAddress);
   }
   
   TServerInstance getTabletSession() {
     String address = getClientAddressString();
-    if (address == null) return null;
+    if (address == null)
+      return null;
     
     try {
       return new TServerInstance(address, tabletServerLock.getSessionId());
@@ -2634,7 +2689,8 @@ public class TabletServer extends Abstra
       Accumulo.init("tserver");
       log.info("Tablet server starting on " + local.getHostAddress());
       
-      if (args.length > 0) conf.set("tabletserver.hostname", args[0]);
+      if (args.length > 0)
+        conf.set("tabletserver.hostname", args[0]);
       Accumulo.enableTracing(local.getHostAddress(), "tserver");
     } catch (IOException e) {
       log.fatal("couldn't get a reference to the filesystem. quitting");
@@ -2647,8 +2703,10 @@ public class TabletServer extends Abstra
       try {
         System.load(path);
         log.info("Trying to lock memory pages to RAM");
-        if (MLock.lockMemoryPages() < 0) log.error("Failed to lock memory pages to RAM");
-        else log.info("Memory pages are now locked into RAM");
+        if (MLock.lockMemoryPages() < 0)
+          log.error("Failed to lock memory pages to RAM");
+        else
+          log.info("Memory pages are now locked into RAM");
       } catch (Throwable t) {
         log.error("Failed to load native library for locking pages to RAM " + path + " (" + t + ")", t);
       }
@@ -2732,10 +2790,14 @@ public class TabletServer extends Abstra
       table.ingestByteRate += tablet.ingestByteRate();
       long recsInMemory = tablet.getNumEntriesInMemory();
       table.recsInMemory += recsInMemory;
-      if (tablet.minorCompactionRunning()) table.minor.running++;
-      if (tablet.minorCompactionQueued()) table.minor.queued++;
-      if (tablet.majorCompactionRunning()) table.major.running++;
-      if (tablet.majorCompactionQueued()) table.major.queued++;
+      if (tablet.minorCompactionRunning())
+        table.minor.running++;
+      if (tablet.minorCompactionQueued())
+        table.minor.queued++;
+      if (tablet.majorCompactionRunning())
+        table.major.running++;
+      if (tablet.majorCompactionQueued())
+        table.major.queued++;
     }
     ArrayList<KeyExtent> offlineTabletsCopy = new ArrayList<KeyExtent>();
     synchronized (this.unopenedTablets) {
@@ -2806,7 +2868,8 @@ public class TabletServer extends Abstra
           break;
         }
       }
-      if (recovery == null) throw new IOException("Unable to find recovery files for extent " + tablet.getExtent() + " logEntry: " + entry);
+      if (recovery == null)
+        throw new IOException("Unable to find recovery files for extent " + tablet.getExtent() + " logEntry: " + entry);
       recoveryLogs.add(recovery);
     }
     logger.recover(tablet, recoveryLogs, tabletFiles, mutationReceiver);
@@ -2866,7 +2929,8 @@ public class TabletServer extends Abstra
     if (this.isEnabled()) {
       int result = 0;
       for (Tablet tablet : Collections.unmodifiableCollection(onlineTablets.values())) {
-        if (tablet.majorCompactionRunning()) result++;
+        if (tablet.majorCompactionRunning())
+          result++;
       }
       return result;
     }
@@ -2878,7 +2942,8 @@ public class TabletServer extends Abstra
     if (this.isEnabled()) {
       int result = 0;
       for (Tablet tablet : Collections.unmodifiableCollection(onlineTablets.values())) {
-        if (tablet.majorCompactionQueued()) result++;
+        if (tablet.majorCompactionQueued())
+          result++;
       }
       return result;
     }
@@ -2890,7 +2955,8 @@ public class TabletServer extends Abstra
     if (this.isEnabled()) {
       int result = 0;
       for (Tablet tablet : Collections.unmodifiableCollection(onlineTablets.values())) {
-        if (tablet.minorCompactionRunning()) result++;
+        if (tablet.minorCompactionRunning())
+          result++;
       }
       return result;
     }
@@ -2902,7 +2968,8 @@ public class TabletServer extends Abstra
     if (this.isEnabled()) {
       int result = 0;
       for (Tablet tablet : Collections.unmodifiableCollection(onlineTablets.values())) {
-        if (tablet.minorCompactionQueued()) result++;
+        if (tablet.minorCompactionQueued())
+          result++;
       }
       return result;
     }
@@ -2911,13 +2978,15 @@ public class TabletServer extends Abstra
   
   @Override
   public int getOnlineCount() {
-    if (this.isEnabled()) return onlineTablets.size();
+    if (this.isEnabled())
+      return onlineTablets.size();
     return 0;
   }
   
   @Override
   public int getOpeningCount() {
-    if (this.isEnabled()) return openingTablets.size();
+    if (this.isEnabled())
+      return openingTablets.size();
     return 0;
   }
   
@@ -2935,25 +3004,29 @@ public class TabletServer extends Abstra
   
   @Override
   public int getUnopenedCount() {
-    if (this.isEnabled()) return unopenedTablets.size();
+    if (this.isEnabled())
+      return unopenedTablets.size();
     return 0;
   }
   
   @Override
   public String getName() {
-    if (this.isEnabled()) return getClientAddressString();
+    if (this.isEnabled())
+      return getClientAddressString();
     return "";
   }
   
   @Override
   public long getTotalMinorCompactions() {
-    if (this.isEnabled()) return totalMinorCompactions;
+    if (this.isEnabled())
+      return totalMinorCompactions;
     return 0;
   }
   
   @Override
   public double getHoldTime() {
-    if (this.isEnabled()) return this.resourceManager.holdTime() / 1000.;
+    if (this.isEnabled())
+      return this.resourceManager.holdTime() / 1000.;
     return 0;
   }
   
@@ -2966,7 +3039,8 @@ public class TabletServer extends Abstra
         result += tablet.getDatafiles().size();
         count++;
       }
-      if (count == 0) return 0;
+      if (count == 0)
+        return 0;
       return result / (double) count;
     }
     return 0;

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java Thu Oct 27 15:24:51 2011
@@ -381,7 +381,8 @@ public class TabletServerResourceManager
       synchronized (commitHold) {
         while (holdCommits) {
           try {
-            if (System.currentTimeMillis() > timeout) throw new HoldTimeoutException("Commits are held");
+            if (System.currentTimeMillis() > timeout)
+              throw new HoldTimeoutException("Commits are held");
             commitHold.wait(1000);
           } catch (InterruptedException e) {}
         }
@@ -390,7 +391,8 @@ public class TabletServerResourceManager
   }
   
   public long holdTime() {
-    if (!holdCommits) return 0;
+    if (!holdCommits)
+      return 0;
     synchronized (commitHold) {
       return System.currentTimeMillis() - holdStartTime;
     }
@@ -404,7 +406,8 @@ public class TabletServerResourceManager
     for (Entry<String,ExecutorService> entry : threadPools.entrySet()) {
       while (true) {
         try {
-          if (entry.getValue().awaitTermination(60, TimeUnit.SECONDS)) break;
+          if (entry.getValue().awaitTermination(60, TimeUnit.SECONDS))
+            break;
           log.info("Waiting for thread pool " + entry.getKey() + " to shutdown");
         } catch (InterruptedException e) {
           log.warn(e);
@@ -490,8 +493,10 @@ public class TabletServerResourceManager
     }
     
     synchronized void addMapFile(String name, long size) throws IOException {
-      if (closed) throw new IOException("closed");
-      if (openFilesReserved) throw new IOException("tried to add map file while open files reserved");
+      if (closed)
+        throw new IOException("closed");
+      if (openFilesReserved)
+        throw new IOException("tried to add map file while open files reserved");
       
       if (mapFiles.keySet().contains(name)) {
         log.error("Adding map files that is already in set " + name);
@@ -501,8 +506,10 @@ public class TabletServerResourceManager
     }
     
     synchronized void removeMapFiles(Set<String> filesCompacted) throws IOException {
-      if (closed) throw new IOException("closed");
-      if (openFilesReserved) throw new IOException("tried to remove map files while open files reserved");
+      if (closed)
+        throw new IOException("closed");
+      if (openFilesReserved)
+        throw new IOException("tried to remove map files while open files reserved");
       
       for (String file : filesCompacted) {
         if (!mapFiles.keySet().contains(file)) {
@@ -514,17 +521,20 @@ public class TabletServerResourceManager
     }
     
     synchronized SortedSet<String> getCopyOfMapFilePaths() throws IOException {
-      if (closed) throw new IOException("closed");
+      if (closed)
+        throw new IOException("closed");
       return new TreeSet<String>(mapFiles.keySet());
     }
     
     synchronized boolean containsAllMapFiles(TreeSet<String> filesToCompact) throws IOException {
-      if (closed) throw new IOException("closed");
+      if (closed)
+        throw new IOException("closed");
       return mapFiles.keySet().containsAll(filesToCompact);
     }
     
     synchronized ScanFileManager newScanFileManager() {
-      if (closed) throw new IllegalStateException("closed");
+      if (closed)
+        throw new IllegalStateException("closed");
       return fileManager.newScanFileManager(tablet.getExtent());
     }
     
@@ -558,11 +568,13 @@ public class TabletServerResourceManager
       
       long currentTime = System.currentTimeMillis();
       if ((delta > 32000 || delta < 0 || (currentTime - lastReportedCommitTime > 1000)) && lastReportedSize.compareAndSet(lrs, totalSize)) {
-        if (delta > 0) lastReportedCommitTime = currentTime;
+        if (delta > 0)
+          lastReportedCommitTime = currentTime;
         report = true;
       }
       
-      if (report) memMgmt.updateMemoryUsageStats(tablet, size, lastReportedCommitTime, mincSize);
+      if (report)
+        memMgmt.updateMemoryUsageStats(tablet, size, lastReportedCommitTime, mincSize);
     }
     
     // END methods that Tablets call to manage memory
@@ -623,13 +635,17 @@ public class TabletServerResourceManager
         return files;
       }
       
-      if (mapFiles.size() <= 1) return null;
+      if (mapFiles.size() <= 1)
+        return null;
       TreeSet<MapFileInfo> candidateFiles = new TreeSet<MapFileInfo>(new Comparator<MapFileInfo>() {
         @Override
         public int compare(MapFileInfo o1, MapFileInfo o2) {
-          if (o1 == o2) return 0;
-          if (o1.size < o2.size) return -1;
-          if (o1.size > o2.size) return 1;
+          if (o1 == o2)
+            return 0;
+          if (o1.size < o2.size)
+            return -1;
+          if (o1.size > o2.size)
+            return 1;
           return o1.path.compareTo(o2.path);
         }
       });
@@ -663,7 +679,8 @@ public class TabletServerResourceManager
               @Override
               public int compare(Entry<String,Long> e1, Entry<String,Long> e2) {
                 int cmp = e1.getValue().compareTo(e2.getValue());
-                if (cmp == 0) cmp = e1.getKey().compareTo(e2.getKey());
+                if (cmp == 0)
+                  cmp = e1.getKey().compareTo(e2.getKey());
                 return cmp;
               }
             });
@@ -683,8 +700,9 @@ public class TabletServerResourceManager
     }
     
     synchronized boolean needsMajorCompaction(boolean idleCompaction) {
-      if (closed) return false;// throw new IOException("closed");
-      
+      if (closed)
+        return false;// throw new IOException("closed");
+        
       // int threshold;
       
       if (idleCompaction) {
@@ -721,8 +739,10 @@ public class TabletServerResourceManager
       // always obtain locks in same order to avoid deadlock
       synchronized (TabletServerResourceManager.this) {
         synchronized (this) {
-          if (closed) throw new IOException("closed");
-          if (openFilesReserved) throw new IOException("tired to close files while open files reserved");
+          if (closed)
+            throw new IOException("closed");
+          if (openFilesReserved)
+            throw new IOException("tired to close files while open files reserved");
           
           mapFiles.clear();
           

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletStatsKeeper.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletStatsKeeper.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletStatsKeeper.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletStatsKeeper.java Thu Oct 27 15:24:51 2011
@@ -59,7 +59,8 @@ public class TabletStatsKeeper {
         data.queueTime += t;
         data.sumDev += t * t;
         data.queueSumDev += q * q;
-        if (data.elapsed < 0 || data.sumDev < 0 || data.queueSumDev < 0 || data.queueTime < 0) resetTimes();
+        if (data.elapsed < 0 || data.sumDev < 0 || data.queueSumDev < 0 || data.queueTime < 0)
+          resetTimes();
       }
     } catch (Exception E) {
       resetTimes();
@@ -81,7 +82,8 @@ public class TabletStatsKeeper {
         data.elapsed += t;
         data.sumDev += t * t;
         
-        if (data.elapsed < 0 || data.sumDev < 0 || data.queueSumDev < 0 || data.queueTime < 0) resetTimes();
+        if (data.elapsed < 0 || data.sumDev < 0 || data.queueSumDev < 0 || data.queueTime < 0)
+          resetTimes();
       }
     } catch (Exception E) {
       resetTimes();

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java Thu Oct 27 15:24:51 2011
@@ -96,7 +96,8 @@ public abstract class TabletTime {
     
     @Override
     void useMaxTimeFromWALog(long time) {
-      if (time < lastTime) throw new IllegalStateException("Existing time " + this.lastTime + " > " + time);
+      if (time < lastTime)
+        throw new IllegalStateException("Existing time " + this.lastTime + " > " + time);
       
       lastTime = time;
     }
@@ -107,7 +108,8 @@ public abstract class TabletTime {
       long currTime = RelativeTime.currentTimeMillis();
       
       synchronized (this) {
-        if (mutations.size() == 0) return lastTime;
+        if (mutations.size() == 0)
+          return lastTime;
         
         if (currTime < lastTime) {
           if (currTime - lastUpdateTime > 0) {
@@ -167,7 +169,8 @@ public abstract class TabletTime {
     
     @Override
     long setUpdateTimes(List<Mutation> mutations) {
-      if (mutations.size() == 0) return getTime();
+      if (mutations.size() == 0)
+        return getTime();
       
       long time = nextTime.getAndAdd(mutations.size());
       for (Mutation mutation : mutations)

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/MultiReader.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/MultiReader.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/MultiReader.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/MultiReader.java Thu Oct 27 15:24:51 2011
@@ -74,8 +74,10 @@ public class MultiReader {
         cache();
         o.cache();
         // no more data: always goes to the end
-        if (!cached) return 1;
-        if (!o.cached) return -1;
+        if (!cached)
+          return 1;
+        if (!o.cached)
+          return -1;
         return key.compareTo(o.key);
       } catch (IOException ex) {
         throw new RuntimeException(ex);
@@ -88,14 +90,16 @@ public class MultiReader {
   public MultiReader(FileSystem fs, Configuration conf, String directory) throws IOException {
     boolean foundFinish = false;
     for (FileStatus child : fs.listStatus(new Path(directory))) {
-      if (child.getPath().getName().startsWith("_")) continue;
+      if (child.getPath().getName().startsWith("_"))
+        continue;
       if (child.getPath().getName().equals("finished")) {
         foundFinish = true;
         continue;
       }
       heap.add(new Index(new Reader(fs, child.getPath().toString(), conf)));
     }
-    if (!foundFinish) throw new IOException("Sort \"finished\" flag not found in " + directory);
+    if (!foundFinish)
+      throw new IOException("Sort \"finished\" flag not found in " + directory);
   }
   
   private static void copy(Writable src, Writable dest) throws IOException {
@@ -154,7 +158,8 @@ public class MultiReader {
         problem = ex;
       }
     }
-    if (problem != null) throw problem;
+    if (problem != null)
+      throw problem;
     heap = null;
   }
   

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RemoteLogger.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RemoteLogger.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RemoteLogger.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RemoteLogger.java Thu Oct 27 15:24:51 2011
@@ -46,7 +46,8 @@ public class RemoteLogger {
   @Override
   public boolean equals(Object obj) {
     // filename is unique
-    if (obj == null) return false;
+    if (obj == null)
+      return false;
     return getFileName().equals(((RemoteLogger) obj).getFileName());
   }
   

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RoundRobinLoggerStrategy.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RoundRobinLoggerStrategy.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RoundRobinLoggerStrategy.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/RoundRobinLoggerStrategy.java Thu Oct 27 15:24:51 2011
@@ -38,7 +38,8 @@ public class RoundRobinLoggerStrategy ex
   
   @Override
   public Set<String> getLoggers(Set<String> allLoggers) {
-    if (allLoggers.size() == 0) return allLoggers;
+    if (allLoggers.size() == 0)
+      return allLoggers;
     int numberOfLoggersToUse = getNumberOfLoggersToUse();
     Set<String> result = new HashSet<String>();
     
@@ -46,7 +47,8 @@ public class RoundRobinLoggerStrategy ex
     if (!preferences.isEmpty()) {
       for (int i = 0; result.size() < numberOfLoggersToUse && i < preferences.size(); i++) {
         String preferred = preferences.get(i);
-        if (allLoggers.contains(preferred)) result.add(preferred);
+        if (allLoggers.contains(preferred))
+          result.add(preferred);
       }
     }
     
@@ -54,7 +56,8 @@ public class RoundRobinLoggerStrategy ex
     List<String> loggers = new ArrayList<String>(allLoggers);
     Collections.sort(loggers);
     int pos = Collections.binarySearch(loggers, myHostName);
-    if (pos < 0) pos = -pos - 1;
+    if (pos < 0)
+      pos = -pos - 1;
     for (int i = 0; result.size() < numberOfLoggersToUse && i < loggers.size(); i++) {
       String selection = loggers.get((pos + i) % loggers.size());
       log.debug("Choosing logger " + selection);

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java Thu Oct 27 15:24:51 2011
@@ -57,7 +57,8 @@ public class SortedLogRecovery {
     
     private void update(long newFinish) {
       this.seq = this.lastStart;
-      if (newFinish != -1) lastFinish = newFinish;
+      if (newFinish != -1)
+        lastFinish = newFinish;
     }
     
     private void update(int newStartFile, long newStart) {
@@ -93,8 +94,8 @@ public class SortedLogRecovery {
       
     }
     
-    if (lastStartToFinish.compactionStatus == Status.LOOKING_FOR_FINISH) throw new RuntimeException(
-        "COMPACTION_FINISH (without preceding COMPACTION_START) not followed by successful minor compaction");
+    if (lastStartToFinish.compactionStatus == Status.LOOKING_FOR_FINISH)
+      throw new RuntimeException("COMPACTION_FINISH (without preceding COMPACTION_START) not followed by successful minor compaction");
     
     for (int i = 0; i < recoveryLogs.size(); i++) {
       String logfile = recoveryLogs.get(i);
@@ -117,12 +118,14 @@ public class SortedLogRecovery {
     LogFileKey key = new LogFileKey();
     LogFileValue value = new LogFileValue();
     int tid = -1;
-    if (!reader.next(key, value)) throw new RuntimeException("Unable to read log entries");
-    if (key.event != OPEN) throw new RuntimeException("First log entry value is not OPEN");
+    if (!reader.next(key, value))
+      throw new RuntimeException("Unable to read log entries");
+    if (key.event != OPEN)
+      throw new RuntimeException("First log entry value is not OPEN");
     
     if (key.tserverSession.compareTo(lastStartToFinish.tserverSession) != 0) {
-      if (lastStartToFinish.compactionStatus == Status.LOOKING_FOR_FINISH) throw new RuntimeException(
-          "COMPACTION_FINISH (without preceding COMPACTION_START) is not followed by a successful minor compaction.");
+      if (lastStartToFinish.compactionStatus == Status.LOOKING_FOR_FINISH)
+        throw new RuntimeException("COMPACTION_FINISH (without preceding COMPACTION_START) is not followed by a successful minor compaction.");
       lastStartToFinish.update(key.tserverSession);
     }
     
@@ -132,7 +135,8 @@ public class SortedLogRecovery {
     // for the maximum tablet id, find the minimum sequence #... may be ok to find the max seq, but just want to make the code behave like it used to
     while (reader.next(key, value)) {
       // LogReader.printEntry(entry);
-      if (key.event != DEFINE_TABLET) break;
+      if (key.event != DEFINE_TABLET)
+        break;
       if (key.tablet.equals(extent)) {
         if (tid != key.tid) {
           tid = key.tid;
@@ -153,22 +157,30 @@ public class SortedLogRecovery {
     reader.seek(key);
     while (reader.next(key, value)) {
       // LogFileEntry.printEntry(entry);
-      if (key.tid != tid) break;
+      if (key.tid != tid)
+        break;
       if (key.event == COMPACTION_START) {
-        if (lastStartToFinish.compactionStatus == Status.INITIAL) lastStartToFinish.compactionStatus = Status.COMPLETE;
-        if (key.seq <= lastStartToFinish.lastStart) throw new RuntimeException("Sequence numbers are not increasing for start/stop events.");
+        if (lastStartToFinish.compactionStatus == Status.INITIAL)
+          lastStartToFinish.compactionStatus = Status.COMPLETE;
+        if (key.seq <= lastStartToFinish.lastStart)
+          throw new RuntimeException("Sequence numbers are not increasing for start/stop events.");
         lastStartToFinish.update(fileno, key.seq);
         
         // Tablet server finished the minor compaction, but didn't remove the entry from the METADATA table.
-        if (tabletFiles.contains(key.filename)) lastStartToFinish.update(-1);
+        if (tabletFiles.contains(key.filename))
+          lastStartToFinish.update(-1);
       } else if (key.event == COMPACTION_FINISH) {
-        if (key.seq <= lastStartToFinish.lastStart) throw new RuntimeException("Sequence numbers are not increasing for start/stop events.");
-        if (lastStartToFinish.compactionStatus == Status.INITIAL) lastStartToFinish.compactionStatus = Status.LOOKING_FOR_FINISH;
-        else if (lastStartToFinish.lastFinish > lastStartToFinish.lastStart) throw new RuntimeException(
-            "COMPACTION_FINISH does not have preceding COMPACTION_START event.");
-        else lastStartToFinish.compactionStatus = Status.COMPLETE;
+        if (key.seq <= lastStartToFinish.lastStart)
+          throw new RuntimeException("Sequence numbers are not increasing for start/stop events.");
+        if (lastStartToFinish.compactionStatus == Status.INITIAL)
+          lastStartToFinish.compactionStatus = Status.LOOKING_FOR_FINISH;
+        else if (lastStartToFinish.lastFinish > lastStartToFinish.lastStart)
+          throw new RuntimeException("COMPACTION_FINISH does not have preceding COMPACTION_START event.");
+        else
+          lastStartToFinish.compactionStatus = Status.COMPLETE;
         lastStartToFinish.update(key.seq);
-      } else break;
+      } else
+        break;
     }
     return tid;
   }
@@ -186,8 +198,10 @@ public class SortedLogRecovery {
     key.seq = lastStartToFinish.seq;
     reader.seek(key);
     while (true) {
-      if (!reader.next(key, value)) break;
-      if (key.tid != tid) break;
+      if (!reader.next(key, value))
+        break;
+      if (key.tid != tid)
+        break;
       // log.info("Replaying " + key);
       // log.info(value);
       if (key.event == MUTATION) {



Mime
View raw message