accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1396821 - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/data/Mutation.java server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java
Date Wed, 10 Oct 2012 21:57:19 GMT
Author: kturner
Date: Wed Oct 10 21:57:19 2012
New Revision: 1396821

URL: http://svn.apache.org/viewvc?rev=1396821&view=rev
Log:
ACCUMULO-786 sped up deserialization of SeverMutation

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Mutation.java?rev=1396821&r1=1396820&r2=1396821&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Mutation.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Mutation.java Wed Oct
10 21:57:19 2012
@@ -408,6 +408,10 @@ public class Mutation implements Writabl
     return updates;
   }
   
+  protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts,
long ts, boolean deleted, byte[] val) {
+    return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
+  }
+
   private ColumnUpdate deserializeColumnUpdate(SimpleReader in) {
     if (useOldDeserialize)
       return oldDeserializeColumnUpdate(in);
@@ -434,7 +438,7 @@ public class Mutation implements Writabl
       in.readBytes(val);
     }
     
-    return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
+    return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
   }
   
   private ColumnUpdate newDeserializeColumnUpdate(SimpleReader in) {
@@ -459,7 +463,7 @@ public class Mutation implements Writabl
       in.readBytes(val);
     }
     
-    return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
+    return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
   }
   
   private int cachedValLens = -1;

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java?rev=1396821&r1=1396820&r2=1396821&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerColumnUpdate.java
Wed Oct 10 21:57:19 2012
@@ -6,8 +6,8 @@ public class ServerColumnUpdate extends 
   
   ServerMutation parent;
 
-  public ServerColumnUpdate(ColumnUpdate update, ServerMutation serverMutation) {
-    super(update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(),
update.hasTimestamp(), update.hasTimestamp() ? update.getTimestamp() : 0, update.isDeleted(),
update.getValue());
+  public ServerColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean
deleted, byte[] val, ServerMutation serverMutation) {
+    super(cf, cq, cv, hasts, ts, deleted, val);
     parent = serverMutation;
   }
 

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java?rev=1396821&r1=1396820&r2=1396821&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/data/ServerMutation.java
Wed Oct 10 21:57:19 2012
@@ -1,17 +1,16 @@
 package org.apache.accumulo.server.data;
 
+import static org.apache.accumulo.core.data.Mutation.SERIALIZED_FORMAT.VERSION2;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.accumulo.core.data.ColumnUpdate;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.thrift.TMutation;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.WritableUtils;
-import static org.apache.accumulo.core.data.Mutation.SERIALIZED_FORMAT.VERSION2;;
 
 /**
  * Mutation that holds system time as computed by the tablet server when not provided by
the user.
@@ -60,19 +59,14 @@ public class ServerMutation extends Muta
   public long getSystemTimestamp() {
     return this.systemTime;
   }
-  
-  public List<ColumnUpdate> getUpdates() {
-    List<ColumnUpdate> updates = super.getUpdates();
-    List<ColumnUpdate> result = new ArrayList<ColumnUpdate>(updates.size());
-    for (ColumnUpdate update : updates) {
-      result.add(new ServerColumnUpdate(update, this));
-    }
-    return result;
+
+  @Override
+  protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts,
long ts, boolean deleted, byte[] val) {
+    return new ServerColumnUpdate(cf, cq, cv, hasts, ts, deleted, val, this);
   }
 
   @Override
   public long estimatedMemoryUsed() {
     return super.estimatedMemoryUsed() + 8;
   }
-
 }



Mime
View raw message