accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject svn commit: r1431013 - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java fate/src/main/java/org/apache/accumulo/fate/TStore.java
Date Wed, 09 Jan 2013 19:13:19 GMT
Author: ctubbsii
Date: Wed Jan  9 19:13:18 2013
New Revision: 1431013

URL: http://svn.apache.org/viewvc?rev=1431013&view=rev
Log:
ACCUMULO-934 Add default case to switch statements in AgeOffStore, added javadoc comment for
UNKNOWN fate state

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java?rev=1431013&r1=1431012&r2=1431013&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
Wed Jan  9 19:13:18 2013
@@ -40,7 +40,6 @@ import org.apache.accumulo.core.client.a
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileOperations;
@@ -182,12 +181,11 @@ public class MockTableOperations extends
     long time = System.currentTimeMillis();
     MockTable table = acu.tables.get(tableName);
     if (table == null) {
-      throw new TableNotFoundException(null, tableName,
-          "The table was not found");
+      throw new TableNotFoundException(null, tableName, "The table was not found");
     }
     Path importPath = new Path(dir);
     Path failurePath = new Path(failureDir);
-
+    
     FileSystem fs = acu.getFileSystem();
     /*
      * check preconditions
@@ -222,9 +220,8 @@ public class MockTableOperations extends
      */
     for (FileStatus importStatus : fs.listStatus(importPath)) {
       try {
-        FileSKVIterator importIterator = FileOperations.getInstance()
-            .openReader(importStatus.getPath().toString(), true, fs,
-                fs.getConf(), AccumuloConfiguration.getDefaultConfiguration());
+        FileSKVIterator importIterator = FileOperations.getInstance().openReader(importStatus.getPath().toString(),
true, fs, fs.getConf(),
+            AccumuloConfiguration.getDefaultConfiguration());
         while (importIterator.hasTop()) {
           Key key = importIterator.getTopKey();
           Value value = importIterator.getTopValue();
@@ -233,12 +230,10 @@ public class MockTableOperations extends
           }
           Mutation mutation = new Mutation(key.getRow());
           if (!key.isDeleted()) {
-            mutation.put(key.getColumnFamily(), key.getColumnQualifier(),
-                new ColumnVisibility(key.getColumnVisibilityData().toArray()),
-                key.getTimestamp(), value);
+            mutation.put(key.getColumnFamily(), key.getColumnQualifier(), new ColumnVisibility(key.getColumnVisibilityData().toArray()),
key.getTimestamp(),
+                value);
           } else {
-            mutation.putDelete(key.getColumnFamily(), key.getColumnQualifier(),
-                new ColumnVisibility(key.getColumnVisibilityData().toArray()),
+            mutation.putDelete(key.getColumnFamily(), key.getColumnQualifier(), new ColumnVisibility(key.getColumnVisibilityData().toArray()),
                 key.getTimestamp());
           }
           table.addMutation(mutation);
@@ -248,8 +243,7 @@ public class MockTableOperations extends
         FSDataOutputStream failureWriter = null;
         DataInputStream failureReader = null;
         try {
-          failureWriter = fs.create(failurePath.suffix("/"
-              + importStatus.getPath().getName()));
+          failureWriter = fs.create(failurePath.suffix("/" + importStatus.getPath().getName()));
           failureReader = fs.open(importStatus.getPath());
           int read = 0;
           byte[] buffer = new byte[1024];
@@ -298,7 +292,7 @@ public class MockTableOperations extends
   public void merge(String tableName, Text start, Text end) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
     if (!exists(tableName))
       throw new TableNotFoundException(tableName, tableName, "");
-}
+  }
   
   @Override
   public void deleteRows(String tableName, Text start, Text end) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
@@ -333,7 +327,7 @@ public class MockTableOperations extends
   public void flush(String tableName, Text start, Text end, boolean wait) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
     if (!exists(tableName))
       throw new TableNotFoundException(tableName, tableName, "");
- }
+  }
   
   @Override
   public Text getMaxRow(String tableName, Authorizations auths, Text startRow, boolean startInclusive,
Text endRow, boolean endInclusive)

Modified: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java?rev=1431013&r1=1431012&r2=1431013&view=diff
==============================================================================
--- accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java (original)
+++ accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/AgeOffStore.java Wed Jan  9
19:13:18 2013
@@ -27,9 +27,9 @@ import java.util.Map.Entry;
 import org.apache.log4j.Logger;
 
 /**
- * This store removes Repos, in the store it wraps, that are in a finished or new state for
more than a configurable time period.    
+ * This store removes Repos, in the store it wraps, that are in a finished or new state for
more than a configurable time period.
  * 
- * No external time source is used.  It starts tracking idle time when its created.
+ * No external time source is used. It starts tracking idle time when its created.
  * 
  */
 public class AgeOffStore<T> implements TStore<T> {
@@ -37,9 +37,9 @@ public class AgeOffStore<T> implements T
   public static interface TimeSource {
     long currentTimeMillis();
   }
-
+  
   final private static Logger log = Logger.getLogger(AgeOffStore.class);
-
+  
   private TStore<T> store;
   private Map<Long,Long> candidates;
   private long ageOffTime;
@@ -70,7 +70,7 @@ public class AgeOffStore<T> implements T
   
   public void ageOff() {
     HashSet<Long> oldTxs = new HashSet<Long>();
-
+    
     synchronized (this) {
       long time = timeSource.currentTimeMillis();
       if (minTime < time && time - minTime >= ageOffTime) {
@@ -96,6 +96,8 @@ public class AgeOffStore<T> implements T
               store.delete(txid);
               log.debug("Aged off FATE tx " + String.format("%016x", txid));
               break;
+            default:
+              break;
           }
           
         } finally {
@@ -114,7 +116,7 @@ public class AgeOffStore<T> implements T
     candidates = new HashMap<Long,Long>();
     
     minTime = Long.MAX_VALUE;
-
+    
     List<Long> txids = store.list();
     for (Long txid : txids) {
       store.reserve(txid);
@@ -124,6 +126,8 @@ public class AgeOffStore<T> implements T
           case FAILED:
           case SUCCESSFUL:
             addCandidate(txid);
+          default:
+            break;
         }
       } finally {
         store.unreserve(txid, 0);
@@ -139,7 +143,7 @@ public class AgeOffStore<T> implements T
       }
     });
   }
-
+  
   @Override
   public long create() {
     long txid = store.create();
@@ -185,7 +189,7 @@ public class AgeOffStore<T> implements T
   @Override
   public void setStatus(long tid, org.apache.accumulo.fate.TStore.TStatus status) {
     store.setStatus(tid, status);
-
+    
     switch (status) {
       case IN_PROGRESS:
       case FAILED_IN_PROGRESS:
@@ -195,6 +199,8 @@ public class AgeOffStore<T> implements T
       case SUCCESSFUL:
         addCandidate(tid);
         break;
+      default:
+        break;
     }
   }
   

Modified: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java?rev=1431013&r1=1431012&r2=1431013&view=diff
==============================================================================
--- accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java (original)
+++ accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java Wed Jan  9 19:13:18
2013
@@ -39,7 +39,9 @@ public interface TStore<T> {
     /** Transaction has failed and has been fully rolled back */
     FAILED,
     /** Transaction has succeeded */
-    SUCCESSFUL, UNKNOWN
+    SUCCESSFUL,
+    /** Unrecognized or unknown transaction state */
+    UNKNOWN
   }
   
   /**
@@ -135,7 +137,7 @@ public interface TStore<T> {
    * 
    * @return
    */
-
+  
   public List<Long> list();
-
+  
 }



Mime
View raw message