accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject git commit: ACCUMULO-2753 used TServerInstance to encode mutations
Date Mon, 09 Jun 2014 20:33:20 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 8070e1ca0 -> ced3293b3


ACCUMULO-2753 used TServerInstance to encode mutations


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ced3293b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ced3293b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ced3293b

Branch: refs/heads/master
Commit: ced3293b324331177f743fe0ef866af56c646e50
Parents: 8070e1c
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Jun 9 16:33:22 2014 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Jun 9 16:33:22 2014 -0400

----------------------------------------------------------------------
 .../server/master/state/MetaDataStateStore.java        | 13 +++++--------
 .../accumulo/server/master/state/TServerInstance.java  | 13 +++++++++++--
 .../accumulo/server/util/MasterMetadataUtil.java       |  4 ++--
 .../accumulo/test/MasterRepairsDualAssignmentIT.java   |  5 ++---
 .../accumulo/test/functional/SplitRecoveryIT.java      |  2 +-
 5 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ced3293b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
index e4d1eeb..63617d6 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
@@ -27,11 +27,9 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.security.SystemCredentials;
-import org.apache.hadoop.io.Text;
 
 public class MetaDataStateStore extends TabletStateStore {
   // private static final Logger log = Logger.getLogger(MetaDataStateStore.class);
@@ -75,9 +73,8 @@ public class MetaDataStateStore extends TabletStateStore {
     try {
       for (Assignment assignment : assignments) {
         Mutation m = new Mutation(assignment.tablet.getMetadataEntry());
-        Text cq = assignment.server.asColumnQualifier();
-        m.put(TabletsSection.CurrentLocationColumnFamily.NAME, cq, assignment.server.asMutationValue());
-        m.putDelete(TabletsSection.FutureLocationColumnFamily.NAME, cq);
+        assignment.server.putLocation(m);
+        assignment.server.clearFutureLocation(m);
         writer.addMutation(m);
       }
     } catch (Exception ex) {
@@ -109,7 +106,7 @@ public class MetaDataStateStore extends TabletStateStore {
     try {
       for (Assignment assignment : assignments) {
         Mutation m = new Mutation(assignment.tablet.getMetadataEntry());
-        m.put(TabletsSection.FutureLocationColumnFamily.NAME, assignment.server.asColumnQualifier(),
assignment.server.asMutationValue());
+        assignment.server.putFutureLocation(m);
         writer.addMutation(m);
       }
     } catch (Exception ex) {
@@ -131,10 +128,10 @@ public class MetaDataStateStore extends TabletStateStore {
       for (TabletLocationState tls : tablets) {
         Mutation m = new Mutation(tls.extent.getMetadataEntry());
         if (tls.current != null) {
-          m.putDelete(TabletsSection.CurrentLocationColumnFamily.NAME, tls.current.asColumnQualifier());
+          tls.current.clearLocation(m);
         }
         if (tls.future != null) {
-          m.putDelete(TabletsSection.FutureLocationColumnFamily.NAME, tls.future.asColumnQualifier());
+          tls.future.clearFutureLocation(m);
         }
         writer.addMutation(m);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ced3293b/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
b/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
index a692514..8a09e75 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
@@ -78,6 +78,14 @@ public class TServerInstance implements Comparable<TServerInstance>,
Serializabl
     m.putDelete(TabletsSection.LastLocationColumnFamily.NAME, asColumnQualifier());
   }
   
+  public void clearFutureLocation(Mutation m) {
+    m.putDelete(TabletsSection.FutureLocationColumnFamily.NAME, asColumnQualifier());
+  }
+
+  public void clearLocation(Mutation m) {
+    m.putDelete(TabletsSection.CurrentLocationColumnFamily.NAME, asColumnQualifier());
+  }
+  
   @Override
   public int compareTo(TServerInstance other) {
     if (this == other)
@@ -115,11 +123,11 @@ public class TServerInstance implements Comparable<TServerInstance>,
Serializabl
     return getLocation().toString();
   }
   
-  public Text asColumnQualifier() {
+  private Text asColumnQualifier() {
     return new Text(this.getSession());
   }
   
-  public Value asMutationValue() {
+  private Value asMutationValue() {
     return new Value(getLocation().toString().getBytes(StandardCharsets.UTF_8));
   }
   
@@ -140,4 +148,5 @@ public class TServerInstance implements Comparable<TServerInstance>,
Serializabl
     in.defaultReadObject();
     location = HostAndPort.fromString(in.readObject().toString());
   }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ced3293b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
index e936b97..a72d221 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
@@ -77,8 +77,8 @@ public class MasterMetadataUtil {
       TabletsSection.ServerColumnFamily.COMPACT_COLUMN.put(m, new Value(("" + lastCompactID).getBytes()));
     
     if (location != null) {
-      m.put(TabletsSection.CurrentLocationColumnFamily.NAME, location.asColumnQualifier(),
location.asMutationValue());
-      m.putDelete(TabletsSection.FutureLocationColumnFamily.NAME, location.asColumnQualifier());
+      location.putLocation(m);
+      location.clearFutureLocation(m);
     }
     
     for (Entry<FileRef,DataFileValue> entry : datafileSizes.entrySet()) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ced3293b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index 6801b7f..91d9cf4 100644
--- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.CurrentLocationColumnFamily;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.fate.util.UtilWaitThread;
@@ -120,7 +119,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
     // throw a mutation in as if we were the dying tablet
     BatchWriter bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
     Mutation assignment = new Mutation(moved.extent.getMetadataEntry());
-    assignment.put(CurrentLocationColumnFamily.NAME, moved.current.asColumnQualifier(), moved.current.asMutationValue());
+    moved.current.putLocation(assignment);
     bw.addMutation(assignment);
     bw.close();
     // wait for the master to fix the problem
@@ -128,7 +127,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
     // now jam up the metadata table
     bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
     assignment = new Mutation(new KeyExtent(new Text(MetadataTable.ID), null, null).getMetadataEntry());
-    assignment.put(CurrentLocationColumnFamily.NAME, moved.current.asColumnQualifier(), moved.current.asMutationValue());
+    moved.current.putLocation(assignment);
     bw.addMutation(assignment);
     bw.close();
     waitForCleanStore(new RootTabletStateStore(c.getInstance(), creds, null));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ced3293b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
index 5817090..c09a08d 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
@@ -168,7 +168,7 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
     Writer writer = new Writer(HdfsZooInstance.getInstance(), SystemCredentials.get(), MetadataTable.ID);
     Assignment assignment = new Assignment(high, instance);
     Mutation m = new Mutation(assignment.tablet.getMetadataEntry());
-    m.put(TabletsSection.FutureLocationColumnFamily.NAME, assignment.server.asColumnQualifier(),
assignment.server.asMutationValue());
+    assignment.server.putFutureLocation(m);
     writer.update(m);
     
     if (steps >= 1) {


Mime
View raw message