accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1396730 [2/2] - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/data/ core/src/main/java/org/apache/accumulo/core/data/thrift/ core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/ core/src/main/thrift/ core/src/...
Date Wed, 10 Oct 2012 18:48:49 GMT
Modified: accumulo/trunk/core/src/main/thrift/tabletserver.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/tabletserver.thrift?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/tabletserver.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/tabletserver.thrift Wed Oct 10 18:48:48 2012
@@ -159,9 +159,3 @@ service TabletClientService extends clie
 }
 
 typedef i32 TabletID
-
-struct TabletMutations {
-	1:TabletID tabletID,
-	2:i64 seq,
-	3:list<data.TMutation> mutations
-}

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java Wed
Oct 10 18:48:48 2012
@@ -63,8 +63,6 @@ public class MutationTest extends TestCa
     assertEquals("cq1", new String(cu.getColumnQualifier()));
     assertEquals("", new String(cu.getColumnVisibility()));
     assertFalse(cu.hasTimestamp());
-    cu.setSystemTimestamp(42l);
-    assertEquals(42l, cu.getTimestamp());
     
     cu = updates.get(1);
     
@@ -87,7 +85,6 @@ public class MutationTest extends TestCa
     assertEquals("cq1", new String(cu.getColumnQualifier()));
     assertEquals("", new String(cu.getColumnVisibility()));
     assertFalse(cu.hasTimestamp());
-    assertEquals(42l, cu.getTimestamp());
     
     cu = updates.get(1);
     
@@ -362,20 +359,13 @@ public class MutationTest extends TestCa
   
   
   public void testNewSerialization() throws Exception {
-    Mutation m1 = new Mutation("row");
-    ColumnVisibility vis = new ColumnVisibility("vis");
-    m1.put("cf", "cq", vis, "value");
-    ByteArrayOutputStream bos = new ByteArrayOutputStream();
-    DataOutputStream dos = new DataOutputStream(bos);
-    m1.write(dos);
-    dos.close();
-
     // write an old mutation
     OldMutation m2 = new OldMutation("r1");
     m2.put("cf1", "cq1", "v1");
     m2.put("cf2", "cq2", new ColumnVisibility("cv2"), "v2");
-    bos = new ByteArrayOutputStream();
-    dos = new DataOutputStream(bos);
+    m2.putDelete("cf3", "cq3");
+    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+    DataOutputStream dos = new DataOutputStream(bos);
     m2.write(dos);
     dos.close();
     long oldSize = dos.size(); 
@@ -386,18 +376,20 @@ public class MutationTest extends TestCa
     
     // check it
     assertEquals("r1", new String(m2.getRow()));
-    assertEquals(2, m2.getUpdates().size());
-    assertEquals(2, m2.size());
+    assertEquals(3, m2.getUpdates().size());
+    assertEquals(3, m2.size());
     assertEquals(m2.getUpdates().get(0), "cf1", "cq1", "", 0l, false, false, "v1");
     assertEquals(m2.getUpdates().get(1), "cf2", "cq2", "cv2", 0l, false, false, "v2");
+    assertEquals(m2.getUpdates().get(2), "cf3", "cq3", "", 0l, false, true, "");
 
-    m1 = convert(m2);
+    Mutation m1 = convert(m2);
     
     assertEquals("r1", new String(m1.getRow()));
-    assertEquals(2, m1.getUpdates().size());
-    assertEquals(2, m1.size());
+    assertEquals(3, m1.getUpdates().size());
+    assertEquals(3, m1.size());
     assertEquals(m1.getUpdates().get(0), "cf1", "cq1", "", 0l, false, false, "v1");
     assertEquals(m1.getUpdates().get(1), "cf2", "cq2", "cv2", 0l, false, false, "v2");
+    assertEquals(m2.getUpdates().get(2), "cf3", "cq3", "", 0l, false, true, "");
     
     Text exampleRow = new Text(" 123456789 123456789 123456789 123456789 123456789");
     int exampleLen = exampleRow.getLength();

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/OldMutation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/OldMutation.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/OldMutation.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/data/OldMutation.java Wed Oct
10 18:48:48 2012
@@ -363,7 +363,7 @@ public class OldMutation implements Writ
       in.readBytes(val);
     }
     
-    return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val, null);
+    return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
   }
   
   private int cachedValLens = -1;
@@ -469,27 +469,24 @@ public class OldMutation implements Writ
   
   public boolean equals(Mutation m) {
     serialize();
-    if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data,
m.data)) {
-      if (values == null && m.values == null)
-        return true;
-      
-      if (values != null && m.values != null && values.size() == m.values.size())
{
-        for (int i = 0; i < values.size(); i++) {
-          if (!Arrays.equals(values.get(i), m.values.get(i)))
-            return false;
-        }
-        
-        return true;
-      }
-      
+    if (!Arrays.equals(row, m.getRow()))
+      return false;
+    List<ColumnUpdate> oldcus = this.getUpdates();
+    List<ColumnUpdate> newcus = m.getUpdates();
+    if (oldcus.size() != newcus.size())
+      return false;
+    for (int i = 0; i < newcus.size(); i++) {
+      ColumnUpdate oldcu = oldcus.get(i);
+      ColumnUpdate newcu = newcus.get(i);
+      if (!oldcu.equals(newcu))
+        return false;
     }
-    
     return false;
   }
   
   public TMutation toThrift() {
     serialize();
-    return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values),
entries, 0);
+    return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values),
entries);
   }
   
 }

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
Wed Oct 10 18:48:48 2012
@@ -22,32 +22,37 @@ package org.apache.accumulo.server.logge
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.accumulo.core.data.ColumnUpdate;
 import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.hadoop.io.Writable;
 
 public class LogFileValue implements Writable {
   
-  private static final Mutation[] empty = new Mutation[0];
+  private static final List<Mutation> empty = Collections.emptyList();
   
-  public Mutation[] mutations = empty;
+  public List<Mutation> mutations = empty;
   
   @Override
   public void readFields(DataInput in) throws IOException {
     int count = in.readInt();
-    mutations = new Mutation[count];
+    mutations = new ArrayList<Mutation>(count);
     for (int i = 0; i < count; i++) {
-      mutations[i] = new Mutation();
-      mutations[i].readFields(in);
+      ServerMutation mutation = new ServerMutation();
+      mutation.readFields(in);
+      mutations.add(mutation);
     }
   }
   
   @Override
   public void write(DataOutput out) throws IOException {
-    out.writeInt(mutations.length);
-    for (int i = 0; i < mutations.length; i++) {
-      mutations[i].write(out);
+    out.writeInt(mutations.size());
+    for (Mutation m : mutations) {
+      m.write(out);
     }
   }
   
@@ -63,16 +68,16 @@ public class LogFileValue implements Wri
   }
   
   public static String format(LogFileValue lfv, int maxMutations) {
-    if (lfv.mutations.length == 0)
+    if (lfv.mutations.size() == 0)
       return "";
     StringBuilder builder = new StringBuilder();
-    builder.append(lfv.mutations.length + " mutations:\n");
-    for (int i = 0; i < lfv.mutations.length; i++) {
-      if (i >= maxMutations) {
+    builder.append(lfv.mutations.size() + " mutations:\n");
+    int i = 0;
+    for (Mutation m : lfv.mutations) {
+      if (i++ >= maxMutations) {
         builder.append("...");
         break;
       }
-      Mutation m = lfv.mutations[i];
       builder.append("  " + new String(m.getRow()) + "\n");
       for (ColumnUpdate update : m.getUpdates()) {
         String value = new String(update.getValue());

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java
Wed Oct 10 18:48:48 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.metan
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map.Entry;
 
@@ -93,7 +94,7 @@ public class PrintEvents {
         m.readFields(dis);
         
         LogFileValue lfv = new LogFileValue();
-        lfv.mutations = new Mutation[] {m};
+        lfv.mutations = Collections.singletonList(m);
         
         System.out.println(LogFileValue.format(lfv, 1));
         

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java
Wed Oct 10 18:48:48 2012
@@ -23,6 +23,7 @@ import org.apache.accumulo.core.data.Mut
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.server.trace.TraceFileSystem;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
@@ -65,7 +66,7 @@ public class MutationLog {
     
     final FSDataInputStream login = fs.open(logfile);
     
-    final Mutation mutation = new Mutation();
+    final Mutation mutation = new ServerMutation();
     
     return new Iterator<Mutation>() {
       

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
Wed Oct 10 18:48:48 2012
@@ -144,6 +144,7 @@ import org.apache.accumulo.server.client
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.conf.TableConfiguration;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.server.logger.LogFileKey;
 import org.apache.accumulo.server.logger.LogFileValue;
 import org.apache.accumulo.server.master.state.Assignment;
@@ -1457,7 +1458,7 @@ public class TabletServer extends Abstra
         if (us.currentTablet != null) {
           List<Mutation> mutations = us.queuedMutations.get(us.currentTablet);
           for (TMutation tmutation : tmutations) {
-            Mutation mutation = new Mutation(tmutation);
+            Mutation mutation = new ServerMutation(tmutation);
             mutations.add(mutation);
             us.queuedMutationSize += mutation.numBytes();
           }
@@ -1672,7 +1673,7 @@ public class TabletServer extends Abstra
       long opid = writeTracker.startWrite(TabletType.type(keyExtent));
       
       try {
-        Mutation mutation = new Mutation(tmutation);
+        Mutation mutation = new ServerMutation(tmutation);
         List<Mutation> mutations = Collections.singletonList(mutation);
         
         Span prep = Trace.start("prep");

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletTime.java
Wed Oct 10 18:48:48 2012
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.accumulo.core.client.admin.TimeType;
 import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.server.util.time.RelativeTime;
 
 public abstract class TabletTime {
@@ -55,7 +56,8 @@ public abstract class TabletTime {
   abstract long getAndUpdateTime();
   
   protected void setSystemTimes(Mutation mutation, long lastCommitTime) {
-    mutation.setSystemTimestamp(lastCommitTime);
+    ServerMutation m = (ServerMutation)mutation;
+    m.setSystemTimestamp(lastCommitTime);
   }
   
   static TabletTime getInstance(String metadataValue) {

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
Wed Oct 10 18:48:48 2012
@@ -37,7 +37,7 @@ import org.apache.accumulo.core.conf.Acc
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.tabletserver.thrift.TabletMutations;
+import org.apache.accumulo.core.tabletserver.TabletMutations;
 import org.apache.accumulo.core.util.Daemon;
 import org.apache.accumulo.core.util.StringUtil;
 import org.apache.accumulo.server.logger.LogFileKey;
@@ -310,7 +310,7 @@ public class DfsLogger {
   }
 
   public LoggerOperation log(int seq, int tid, Mutation mutation) throws IOException {
-    return logManyTablets(Collections.singletonList(new TabletMutations(tid, seq, Collections.singletonList(mutation.toThrift()))));
+    return logManyTablets(Collections.singletonList(new TabletMutations(tid, seq, Collections.singletonList(mutation))));
   }
   
   public LoggerOperation logManyTablets(List<TabletMutations> mutations) throws IOException
{
@@ -318,16 +318,13 @@ public class DfsLogger {
     
     synchronized (DfsLogger.this) {
       try {
-        for (TabletMutations mutation : mutations) {
+        for (TabletMutations tabletMutations : mutations) {
           LogFileKey key = new LogFileKey();
           key.event = MANY_MUTATIONS;
-          key.seq = mutation.seq;
-          key.tid = mutation.tabletID;
+          key.seq = tabletMutations.getSeq();
+          key.tid = tabletMutations.getTid();
           LogFileValue value = new LogFileValue();
-          Mutation[] m = new Mutation[mutation.mutations.size()];
-          for (int i = 0; i < m.length; i++)
-            m[i] = new Mutation(mutation.mutations.get(i));
-          value.mutations = m;
+          value.mutations = tabletMutations.getMutations();
           write(key, value);
         }
       } catch (Exception e) {

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java
Wed Oct 10 18:48:48 2012
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.conf.ServerConfiguration;
@@ -208,10 +209,10 @@ public class SortedLogRecovery {
       // log.info("Replaying " + key);
       // log.info(value);
       if (key.event == MUTATION) {
-        mr.receive(value.mutations[0]);
+        mr.receive(value.mutations.get(0));
       } else if (key.event == MANY_MUTATIONS) {
-        for (int i = 0; i < value.mutations.length; i++) {
-          mr.receive(value.mutations[i]);
+        for (Mutation m : value.mutations) {
+          mr.receive(m);
         }
       } else {
         throw new RuntimeException("unexpected log key type: " + key.event);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/TabletServerLogger.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/TabletServerLogger.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/TabletServerLogger.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/TabletServerLogger.java
Wed Oct 10 18:48:48 2012
@@ -33,8 +33,7 @@ import java.util.concurrent.locks.Reentr
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.thrift.TMutation;
-import org.apache.accumulo.core.tabletserver.thrift.TabletMutations;
+import org.apache.accumulo.core.tabletserver.TabletMutations;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.server.tabletserver.Tablet;
 import org.apache.accumulo.server.tabletserver.Tablet.CommitSession;
@@ -366,10 +365,7 @@ public class TabletServerLogger {
         List<TabletMutations> copy = new ArrayList<TabletMutations>(loggables.size());
         for (Entry<CommitSession,List<Mutation>> entry : loggables.entrySet())
{
           CommitSession cs = entry.getKey();
-          ArrayList<TMutation> tmutations = new ArrayList<TMutation>(entry.getValue().size());
-          for (Mutation m : entry.getValue())
-            tmutations.add(m.toThrift());
-          copy.add(new TabletMutations(cs.getLogId(), cs.getWALogSeq(), tmutations));
+          copy.add(new TabletMutations(cs.getLogId(), cs.getWALogSeq(), entry.getValue()));
         }
         return logger.logManyTablets(copy);
       }

Modified: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/logger/LogFileTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/test/java/org/apache/accumulo/server/logger/LogFileTest.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/test/java/org/apache/accumulo/server/logger/LogFileTest.java
(original)
+++ accumulo/trunk/server/src/test/java/org/apache/accumulo/server/logger/LogFileTest.java
Wed Oct 10 18:48:48 2012
@@ -27,15 +27,11 @@ import static org.junit.Assert.assertTru
 
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.Collection;
 
-import org.apache.accumulo.core.data.ColumnUpdate;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.server.logger.LogEvents;
-import org.apache.accumulo.server.logger.LogFileKey;
-import org.apache.accumulo.server.logger.LogFileValue;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.DataOutputBuffer;
 import org.apache.hadoop.io.Text;
@@ -53,7 +49,7 @@ public class LogFileTest {
     key.tablet = tablet;
     key.tserverSession = keyResult.tserverSession;
     LogFileValue value = new LogFileValue();
-    value.mutations = mutations != null ? mutations : new Mutation[0];
+    value.mutations = Arrays.asList(mutations != null ? mutations : new Mutation[0]);
     DataOutputBuffer out = new DataOutputBuffer();
     key.write(out);
     value.write(out);
@@ -63,20 +59,10 @@ public class LogFileTest {
     keyResult.readFields(in);
     valueResult.readFields(in);
     assertTrue(key.compareTo(keyResult) == 0);
-    assertTrue(Arrays.equals(value.mutations, valueResult.mutations));
+    assertEquals(value.mutations, valueResult.mutations);
     assertTrue(in.read() == -1);
   }
   
-  static void assertEqualsMutations(Mutation[] a, Mutation[] b) {
-    if (a.length == b.length)
-      for (int i = 0; i < a.length; i++) {
-        assertEquals(a[i], b[i]);
-        Collection<ColumnUpdate> au = a[i].getUpdates();
-        Collection<ColumnUpdate> bu = a[i].getUpdates();
-        assertEquals(au, bu);
-      }
-  }
-  
   @Test
   public void testReadFields() throws IOException {
     LogFileKey key = new LogFileKey();
@@ -99,18 +85,18 @@ public class LogFileTest {
     assertEquals(key.seq, 5);
     assertEquals(key.tid, 6);
     assertEquals(key.tablet, tablet);
-    Mutation m = new Mutation(new Text("row"));
+    Mutation m = new ServerMutation(new Text("row"));
     m.put(new Text("cf"), new Text("cq"), new Value("value".getBytes()));
     readWrite(MUTATION, 7, 8, null, null, new Mutation[] {m}, key, value);
     assertEquals(key.event, MUTATION);
     assertEquals(key.seq, 7);
     assertEquals(key.tid, 8);
-    assertEqualsMutations(value.mutations, new Mutation[] {m});
+    assertEquals(value.mutations, Arrays.asList(m));
     readWrite(MANY_MUTATIONS, 9, 10, null, null, new Mutation[] {m, m}, key, value);
     assertEquals(key.event, MANY_MUTATIONS);
     assertEquals(key.seq, 9);
     assertEquals(key.tid, 10);
-    assertEqualsMutations(value.mutations, new Mutation[] {m, m});
+    assertEquals(value.mutations, Arrays.asList(m, m));
   }
   
   @Test

Modified: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecoveryTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecoveryTest.java?rev=1396730&r1=1396729&r2=1396730&view=diff
==============================================================================
--- accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecoveryTest.java
(original)
+++ accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecoveryTest.java
Wed Oct 10 18:48:48 2012
@@ -37,6 +37,7 @@ import org.apache.accumulo.core.data.Key
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.server.logger.LogEvents;
 import org.apache.accumulo.server.logger.LogFileKey;
 import org.apache.accumulo.server.logger.LogFileValue;
@@ -91,10 +92,10 @@ public class SortedLogRecoveryTest {
         result.key.tablet = (KeyExtent) fileExtentMutation;
         break;
       case MUTATION:
-        result.value.mutations = new Mutation[] {(Mutation) fileExtentMutation};
+        result.value.mutations = Arrays.asList((Mutation) fileExtentMutation);
         break;
       case MANY_MUTATIONS:
-        result.value.mutations = (Mutation[]) fileExtentMutation;
+        result.value.mutations = Arrays.asList((Mutation[])fileExtentMutation);
     }
     return result;
   }
@@ -142,12 +143,11 @@ public class SortedLogRecoveryTest {
   
   @Test
   public void testCompactionCrossesLogs() throws IOException {
-    // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, 1, "2"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(MUTATION, 2, 1,
ignored), createKeyValue(MUTATION, 4, 1, ignored),};
@@ -180,15 +180,15 @@ public class SortedLogRecoveryTest {
   @Test
   public void testCompactionCrossesLogs5() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
-    Mutation m4 = new Mutation(new Text("row4"));
+    Mutation m4 = new ServerMutation(new Text("row4"));
     m4.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(MUTATION, 2, 1,
ignored), createKeyValue(MUTATION, 4, 1, ignored),};
@@ -218,17 +218,17 @@ public class SortedLogRecoveryTest {
   @Test
   public void testCompactionCrossesLogs6() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
-    Mutation m4 = new Mutation(new Text("row4"));
+    Mutation m4 = new ServerMutation(new Text("row4"));
     m4.put(cf, cq, value);
-    Mutation m5 = new Mutation(new Text("row5"));
+    Mutation m5 = new ServerMutation(new Text("row5"));
     m5.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, 1, "2"), createKeyValue(DEFINE_TABLET,
1, 1, extent), createKeyValue(MUTATION, 1, 1, ignored),
         createKeyValue(MUTATION, 3, 1, m),};
@@ -277,7 +277,7 @@ public class SortedLogRecoveryTest {
   @Test
   public void testSimple() throws IOException {
     // Create a test log
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent), createKeyValue(MUTATION, 2, 1, m),};
     Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
@@ -292,9 +292,9 @@ public class SortedLogRecoveryTest {
   @Test
   public void testSkipSuccessfulCompaction() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(COMPACTION_FINISH,
4, 1, null), createKeyValue(MUTATION, 2, 1, ignored),
@@ -311,9 +311,9 @@ public class SortedLogRecoveryTest {
   @Test
   public void testSkipSuccessfulCompactionAcrossFiles() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(MUTATION, 2, 1,
ignored),};
@@ -332,11 +332,11 @@ public class SortedLogRecoveryTest {
   @Test
   public void testGetMutationsAfterCompactionStart() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, new Value("123".getBytes()));
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(MUTATION, 2, 1,
ignored), createKeyValue(MUTATION, 4, 1, m),};
@@ -356,11 +356,11 @@ public class SortedLogRecoveryTest {
   @Test
   public void testDoubleFinish() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, new Value("123".getBytes()));
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_FINISH, 2, 1, null), createKeyValue(COMPACTION_START, 4,
1, "somefile"), createKeyValue(COMPACTION_FINISH, 6, 1, null),
@@ -378,13 +378,13 @@ public class SortedLogRecoveryTest {
   @Test
   public void testCompactionCrossesLogs2() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 3, 1, "somefile"), createKeyValue(MUTATION, 2, 1,
ignored), createKeyValue(MUTATION, 4, 1, m),};
@@ -407,9 +407,9 @@ public class SortedLogRecoveryTest {
   @Test
   public void testBug1() throws IOException {
     // this unit test reproduces a bug that occurred, nothing should recover
-    Mutation m1 = new Mutation(new Text("row1"));
+    Mutation m1 = new ServerMutation(new Text("row1"));
     m1.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 30, 1, "somefile"), createKeyValue(COMPACTION_FINISH,
32, 1, "somefile"), createKeyValue(MUTATION, 29, 1, m1),
@@ -425,13 +425,13 @@ public class SortedLogRecoveryTest {
   @Test
   public void testBug2() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 2, 1, "somefile"), createKeyValue(COMPACTION_FINISH,
4, 1, null), createKeyValue(MUTATION, 3, 1, m),};
@@ -452,19 +452,19 @@ public class SortedLogRecoveryTest {
   @Test
   public void testCompactionCrossesLogs4() throws IOException {
     // Create a test log
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
-    Mutation m4 = new Mutation(new Text("row4"));
+    Mutation m4 = new ServerMutation(new Text("row4"));
     m4.put(cf, cq, value);
-    Mutation m5 = new Mutation(new Text("row5"));
+    Mutation m5 = new ServerMutation(new Text("row5"));
     m5.put(cf, cq, value);
-    Mutation m6 = new Mutation(new Text("row6"));
+    Mutation m6 = new ServerMutation(new Text("row6"));
     m6.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 4, 1, "somefile"),
@@ -501,17 +501,17 @@ public class SortedLogRecoveryTest {
   
   @Test
   public void testLookingForBug3() throws IOException {
-    Mutation ignored = new Mutation(new Text("ignored"));
+    Mutation ignored = new ServerMutation(new Text("ignored"));
     ignored.put(cf, cq, value);
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put(cf, cq, value);
-    Mutation m2 = new Mutation(new Text("row2"));
+    Mutation m2 = new ServerMutation(new Text("row2"));
     m2.put(cf, cq, value);
-    Mutation m3 = new Mutation(new Text("row3"));
+    Mutation m3 = new ServerMutation(new Text("row3"));
     m3.put(cf, cq, value);
-    Mutation m4 = new Mutation(new Text("row4"));
+    Mutation m4 = new ServerMutation(new Text("row4"));
     m4.put(cf, cq, value);
-    Mutation m5 = new Mutation(new Text("row5"));
+    Mutation m5 = new ServerMutation(new Text("row5"));
     m5.put(cf, cq, value);
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
         createKeyValue(COMPACTION_START, 2, 1, "somefile"), createKeyValue(COMPACTION_FINISH,
3, 1, null), createKeyValue(MUTATION, 1, 1, ignored),
@@ -538,9 +538,9 @@ public class SortedLogRecoveryTest {
     // there was a bug where the oldest tablet id was used instead
     // of the newest
     
-    Mutation ignored = new Mutation("row1");
+    Mutation ignored = new ServerMutation(new Text("row1"));
     ignored.put("foo", "bar", "v1");
-    Mutation m = new Mutation(new Text("row1"));
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put("foo", "bar", "v1");
     
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 1, extent),
@@ -562,7 +562,7 @@ public class SortedLogRecoveryTest {
   public void testNoFinish0() throws Exception {
     // its possible that a minor compaction finishes successfully, but the process dies before
writing the compaction event
     
-    Mutation ignored = new Mutation("row1");
+    Mutation ignored = new ServerMutation(new Text("row1"));
     ignored.put("foo", "bar", "v1");
     
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 2, extent),
@@ -581,9 +581,9 @@ public class SortedLogRecoveryTest {
   public void testNoFinish1() throws Exception {
     // its possible that a minor compaction finishes successfully, but the process dies before
writing the compaction event
     
-    Mutation ignored = new Mutation("row1");
+    Mutation ignored = new ServerMutation(new Text("row1"));
     ignored.put("foo", "bar", "v1");
-    Mutation m = new Mutation("row1");
+    Mutation m = new ServerMutation(new Text("row1"));
     m.put("foo", "bar", "v2");
     
     KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET,
1, 2, extent),



Mime
View raw message