accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1344015 - in /accumulo/trunk/server/src/main/java/org/apache/accumulo/server: tabletserver/Compactor.java tabletserver/MinorCompactor.java test/functional/BadIteratorMincTest.java
Date Tue, 29 May 2012 21:40:46 GMT
Author: kturner
Date: Tue May 29 21:40:45 2012
New Revision: 1344015

URL: http://svn.apache.org/viewvc?rev=1344015&view=rev
Log:
ACCUMULO-58 stopped attempting failed minor compaction when table deleted

Modified:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BadIteratorMincTest.java

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java?rev=1344015&r1=1344014&r2=1344015&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
Tue May 29 21:40:45 2012
@@ -79,7 +79,7 @@ public class Compactor implements Callab
   private CompactionEnv env;
   private Configuration conf;
   private FileSystem fs;
-  private KeyExtent extent;
+  protected KeyExtent extent;
   private List<IteratorSetting> iterators;
   
   Compactor(Configuration conf, FileSystem fs, Map<String,DataFileValue> files, InMemoryMap
imm, String outputFile, boolean propogateDeletes,

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java?rev=1344015&r1=1344014&r2=1344015&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
Tue May 29 21:40:45 2012
@@ -22,10 +22,13 @@ import java.util.Map;
 import java.util.Random;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
-import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.util.MetadataTable.DataFileValue;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.accumulo.server.problems.ProblemReport;
 import org.apache.accumulo.server.problems.ProblemReports;
@@ -64,6 +67,15 @@ public class MinorCompactor extends Comp
     });
   }
   
+  private boolean isTableDeleting() {
+    try {
+      return Tables.getTableState(HdfsZooInstance.getInstance(), extent.getTableId().toString())
== TableState.DELETING;
+    } catch (Exception e) {
+      log.warn("Failed to determine if table " + extent.getTableId() + " was deleting ",
e);
+      return false; // can not get positive confirmation that its deleting.
+    }
+  }
+
   @Override
   public CompactionStats call() {
     log.debug("Begin minor compaction " + getOutputFile() + " " + getExtent());
@@ -75,7 +87,6 @@ public class MinorCompactor extends Comp
     boolean reportedProblem = false;
     
     do {
-      
       try {
         CompactionStats ret = super.call();
         
@@ -117,6 +128,9 @@ public class MinorCompactor extends Comp
         log.warn("Failed to delete failed MinC file " + getOutputFile() + " " + e.getMessage());
       }
       
+      if (isTableDeleting())
+        return new CompactionStats(0, 0);
+
     } while (true);
   }
   

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BadIteratorMincTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BadIteratorMincTest.java?rev=1344015&r1=1344014&r2=1344015&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BadIteratorMincTest.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BadIteratorMincTest.java
Tue May 29 21:40:45 2012
@@ -95,6 +95,26 @@ public class BadIteratorMincTest extends
     
     if (count != 1)
       throw new Exception("Did not see expected # entries " + count);
+    
+    // now try putting bad iterator back and deleting the table
+    getConnector().tableOperations().setProperty("foo", Property.TABLE_ITERATOR_PREFIX.getKey()
+ "minc.badi", "30," + BadIterator.class.getName());
+    bw = getConnector().createBatchWriter("foo", 1000000, 60000l, 2);
+    m = new Mutation(new Text("r2"));
+    m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
+    bw.addMutation(m);
+    bw.close();
+    
+    // make sure property is given time to propagate
+    UtilWaitThread.sleep(1000);
+    
+    getConnector().tableOperations().flush("foo", null, null, false);
+    
+    // make sure the flush has time to start
+    UtilWaitThread.sleep(1000);
+    
+    // this should not hang
+    getConnector().tableOperations().delete("foo");
+
   }
   
 }



Mime
View raw message