accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1381570 - /accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
Date Thu, 06 Sep 2012 12:19:20 GMT
Author: ecn
Date: Thu Sep  6 12:19:20 2012
New Revision: 1381570

URL: http://svn.apache.org/viewvc?rev=1381570&view=rev
Log:
ACCUMULO-456: applied ctubbsii patch to check for WALogs

Modified:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java?rev=1381570&r1=1381569&r2=1381570&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
Thu Sep  6 12:19:20 2012
@@ -69,7 +69,7 @@ class ExportInfo implements Serializable
 class WriteExportFiles extends MasterRepo {
   
   private static final long serialVersionUID = 1L;
-  private ExportInfo tableInfo;
+  private final ExportInfo tableInfo;
   
   WriteExportFiles(ExportInfo tableInfo) {
     this.tableInfo = tableInfo;
@@ -98,13 +98,25 @@ class WriteExportFiles extends MasterRep
     
     Scanner metaScanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
     metaScanner.setRange(new KeyExtent(new Text(tableInfo.tableID), null, null).toMetadataRange());
+    
+    // scan for locations
     metaScanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
+    metaScanner.fetchColumnFamily(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY);
     
-    // TODO look for walogs
-    for (Entry<Key,Value> entry : metaScanner) {
+    if (metaScanner.iterator().hasNext()) {
       return 500;
     }
     
+    // use the same range to check for walogs that we used to check for hosted (or future
hosted) tablets
+    // this is done as a separate scan after we check for locations, because walogs are okay
only if there is no location
+    metaScanner.clearColumns();
+    metaScanner.fetchColumnFamily(Constants.METADATA_LOG_COLUMN_FAMILY);
+    
+    if (metaScanner.iterator().hasNext()) {
+      throw new ThriftTableOperationException(tableInfo.tableID, tableInfo.tableName, TableOperation.EXPORT,
TableOperationExceptionType.OTHER,
+          "Write ahead logs found for table");
+    }
+
     return 0;
   }
 
@@ -277,7 +289,7 @@ class WriteExportFiles extends MasterRep
 public class ExportTable extends MasterRepo {
   private static final long serialVersionUID = 1L;
   
-  private ExportInfo tableInfo;
+  private final ExportInfo tableInfo;
 
   public ExportTable(String tableName, String tableId, String exportDir) {
     tableInfo = new ExportInfo();



Mime
View raw message