You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/04/16 21:41:23 UTC

svn commit: r1468576 - in /accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server: gc/SimpleGarbageCollector.java master/Master.java util/MetadataTable.java

Author: ecn
Date: Tue Apr 16 19:41:23 2013
New Revision: 1468576

URL: http://svn.apache.org/r1468576
Log:
ACCUMULO-1264 add a little upgrade to move !METDATA file deletion markers to the root tablet

Modified:
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1468576&r1=1468575&r2=1468576&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java Tue Apr 16 19:41:23 2013
@@ -737,6 +737,13 @@ public class SimpleGarbageCollector impl
         log.error("Problem removing entries from the metadata table: ", e);
       }
     }
+    if (rootWriter != null) {
+      try {
+        rootWriter.close();
+      } catch (MutationsRejectedException e) {
+        log.error("Problem removing entries from the metadata table: ", e);
+      }
+    }
   }
   
   private boolean isDir(String delete) {

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1468576&r1=1468575&r2=1468576&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java Tue Apr 16 19:41:23 2013
@@ -304,6 +304,7 @@ public class Master implements LiveTServ
           @Override
           public void run() {
             try {
+              MetadataTable.moveMetaDeleteMarkers(instance, SecurityConstants.getSystemCredentials());
               Accumulo.updateAccumuloVersion(fs);
               
               log.info("Upgrade complete");

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java?rev=1468576&r1=1468575&r2=1468576&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java Tue Apr 16 19:41:23 2013
@@ -1230,4 +1230,28 @@ public class MetadataTable extends org.a
     
     update(SecurityConstants.getSystemCredentials(), m);
   }
+
+  public static void moveMetaDeleteMarkers(Instance instance, TCredentials creds) {
+    // move delete markers from the normal delete keyspace to the root tablet delete keyspace if the files are for the !METADATA table
+    Scanner scanner = new ScannerImpl(instance, creds, Constants.METADATA_TABLE_ID, Constants.NO_AUTHS);
+    scanner.setRange(new Range(Constants.METADATA_DELETES_KEYSPACE));
+    for (Entry<Key,Value> entry : scanner) {
+      String row = entry.getKey().getRow().toString();
+      if (row.startsWith(Constants.METADATA_DELETE_FLAG_PREFIX + "/" + Constants.METADATA_TABLE_ID)) {
+        String filename = row.substring(Constants.METADATA_DELETE_FLAG_PREFIX.length());
+        // add the new entry first
+        log.info("Moving " + filename + " marker to the root tablet");
+        Mutation m = new Mutation(Constants.METADATA_DELETE_FLAG_FOR_METADATA_PREFIX + filename);
+        m.put(new byte[]{}, new byte[]{}, new byte[]{});
+        update(creds, m);
+        // remove the old entry
+        m = new Mutation(entry.getKey().getRow());
+        m.putDelete(new byte[]{}, new byte[]{});
+        update(creds, m);
+      } else {
+        break;
+      }
+    }
+    
+  }
 }