You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by uj...@apache.org on 2015/04/10 03:15:41 UTC
[1/6] accumulo git commit: ACCUMULO-3718 make Mutation#hashCode and
Mutation#equals not change the state of the mutation
Repository: accumulo
Updated Branches:
refs/heads/1.5 83ee1c17e -> 73ce9cfb9
refs/heads/1.6 6605ad415 -> 6fa2090b6
refs/heads/master aac619c96 -> 9c8dcaf0a
ACCUMULO-3718 make Mutation#hashCode and Mutation#equals not change the state of the mutation
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/73ce9cfb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/73ce9cfb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/73ce9cfb
Branch: refs/heads/1.5
Commit: 73ce9cfb925b9b5606aee941467fc3c045bc2fac
Parents: 83ee1c1
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 19:17:58 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 19:17:58 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 34 +++++++++++++++++---
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 0861cc4..81ad531 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -191,6 +191,20 @@ public class Mutation implements Writable {
}
}
+ /* This is so hashCode & equals can be called without changing this object.
+ *
+ * It will return a copy of the current data buffer if serialized has not been
+ * called previously. Otherwise, this.data will be returned since the buffer is
+ * null and will not change.
+ */
+ private byte[] serializedSnapshot() {
+ if (buffer != null) {
+ return buffer.toArray();
+ } else {
+ return this.data;
+ }
+ }
+
/**
* @since 1.5.0
*/
@@ -691,13 +705,13 @@ public class Mutation implements Writable {
@Override
public int hashCode() {
- return toThrift().hashCode();
+ return toThrift(false).hashCode();
}
public boolean equals(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
if (values == null && m.values == null)
return true;
@@ -716,7 +730,17 @@ public class Mutation implements Writable {
}
public TMutation toThrift() {
- serialize();
+ return toThrift(true);
+ }
+
+ private TMutation toThrift(boolean serialize) {
+ byte[] data;
+ if (serialize) {
+ this.serialize();
+ data = this.data;
+ } else {
+ data = serializedSnapshot();
+ }
return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values), entries);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
index 8b50788..740baa7 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.data;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -608,4 +609,31 @@ public class MutationTest {
new Mutation(tm1);
}
+ /* The following two tests assert that no exception is thrown after calling
+ * hashCode or equals on a Mutation. These guard against the condition noted
+ * in ACCUMULO-3718.
+ */
+ @Test
+ public void testPutAfterHashCode() {
+ Mutation m = new Mutation("r");
+ m.hashCode();
+ try {
+ m.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#hashCode then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
+
+ @Test
+ public void testPutAfterEquals() {
+ Mutation m = new Mutation("r");
+ Mutation m2 = new Mutation("r2");
+ m.equals(m2);
+ try {
+ m.put("cf", "cq", "v");
+ m2.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#equals then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
}
[2/6] accumulo git commit: ACCUMULO-3718 make Mutation#hashCode and
Mutation#equals not change the state of the mutation
Posted by uj...@apache.org.
ACCUMULO-3718 make Mutation#hashCode and Mutation#equals not change the state of the mutation
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/73ce9cfb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/73ce9cfb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/73ce9cfb
Branch: refs/heads/1.6
Commit: 73ce9cfb925b9b5606aee941467fc3c045bc2fac
Parents: 83ee1c1
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 19:17:58 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 19:17:58 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 34 +++++++++++++++++---
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 0861cc4..81ad531 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -191,6 +191,20 @@ public class Mutation implements Writable {
}
}
+ /* This is so hashCode & equals can be called without changing this object.
+ *
+ * It will return a copy of the current data buffer if serialized has not been
+ * called previously. Otherwise, this.data will be returned since the buffer is
+ * null and will not change.
+ */
+ private byte[] serializedSnapshot() {
+ if (buffer != null) {
+ return buffer.toArray();
+ } else {
+ return this.data;
+ }
+ }
+
/**
* @since 1.5.0
*/
@@ -691,13 +705,13 @@ public class Mutation implements Writable {
@Override
public int hashCode() {
- return toThrift().hashCode();
+ return toThrift(false).hashCode();
}
public boolean equals(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
if (values == null && m.values == null)
return true;
@@ -716,7 +730,17 @@ public class Mutation implements Writable {
}
public TMutation toThrift() {
- serialize();
+ return toThrift(true);
+ }
+
+ private TMutation toThrift(boolean serialize) {
+ byte[] data;
+ if (serialize) {
+ this.serialize();
+ data = this.data;
+ } else {
+ data = serializedSnapshot();
+ }
return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values), entries);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
index 8b50788..740baa7 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.data;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -608,4 +609,31 @@ public class MutationTest {
new Mutation(tm1);
}
+ /* The following two tests assert that no exception is thrown after calling
+ * hashCode or equals on a Mutation. These guard against the condition noted
+ * in ACCUMULO-3718.
+ */
+ @Test
+ public void testPutAfterHashCode() {
+ Mutation m = new Mutation("r");
+ m.hashCode();
+ try {
+ m.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#hashCode then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
+
+ @Test
+ public void testPutAfterEquals() {
+ Mutation m = new Mutation("r");
+ Mutation m2 = new Mutation("r2");
+ m.equals(m2);
+ try {
+ m.put("cf", "cq", "v");
+ m2.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#equals then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
}
[3/6] accumulo git commit: ACCUMULO-3718 make Mutation#hashCode and
Mutation#equals not change the state of the mutation
Posted by uj...@apache.org.
ACCUMULO-3718 make Mutation#hashCode and Mutation#equals not change the state of the mutation
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/73ce9cfb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/73ce9cfb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/73ce9cfb
Branch: refs/heads/master
Commit: 73ce9cfb925b9b5606aee941467fc3c045bc2fac
Parents: 83ee1c1
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 19:17:58 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 19:17:58 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 34 +++++++++++++++++---
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 0861cc4..81ad531 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -191,6 +191,20 @@ public class Mutation implements Writable {
}
}
+ /* This is so hashCode & equals can be called without changing this object.
+ *
+ * It will return a copy of the current data buffer if serialized has not been
+ * called previously. Otherwise, this.data will be returned since the buffer is
+ * null and will not change.
+ */
+ private byte[] serializedSnapshot() {
+ if (buffer != null) {
+ return buffer.toArray();
+ } else {
+ return this.data;
+ }
+ }
+
/**
* @since 1.5.0
*/
@@ -691,13 +705,13 @@ public class Mutation implements Writable {
@Override
public int hashCode() {
- return toThrift().hashCode();
+ return toThrift(false).hashCode();
}
public boolean equals(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
if (values == null && m.values == null)
return true;
@@ -716,7 +730,17 @@ public class Mutation implements Writable {
}
public TMutation toThrift() {
- serialize();
+ return toThrift(true);
+ }
+
+ private TMutation toThrift(boolean serialize) {
+ byte[] data;
+ if (serialize) {
+ this.serialize();
+ data = this.data;
+ } else {
+ data = serializedSnapshot();
+ }
return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values), entries);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73ce9cfb/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
index 8b50788..740baa7 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.data;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -608,4 +609,31 @@ public class MutationTest {
new Mutation(tm1);
}
+ /* The following two tests assert that no exception is thrown after calling
+ * hashCode or equals on a Mutation. These guard against the condition noted
+ * in ACCUMULO-3718.
+ */
+ @Test
+ public void testPutAfterHashCode() {
+ Mutation m = new Mutation("r");
+ m.hashCode();
+ try {
+ m.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#hashCode then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
+
+ @Test
+ public void testPutAfterEquals() {
+ Mutation m = new Mutation("r");
+ Mutation m2 = new Mutation("r2");
+ m.equals(m2);
+ try {
+ m.put("cf", "cq", "v");
+ m2.put("cf", "cq", "v");
+ } catch(IllegalStateException e) {
+ fail("Calling Mutation#equals then Mutation#put should not result in an IllegalStateException.");
+ }
+ }
}
[5/6] accumulo git commit: Merge branch '1.5' into 1.6
Posted by uj...@apache.org.
Merge branch '1.5' into 1.6
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6fa2090b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6fa2090b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6fa2090b
Branch: refs/heads/1.6
Commit: 6fa2090b6fa2c3189ed6b20c6b1f2506451cc97c
Parents: 6605ad4 73ce9cf
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 19:50:18 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 19:50:18 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 34 +++++++++++++++++---
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6fa2090b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 34d8df1,81ad531..233a12e
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@@ -583,25 -705,13 +597,25 @@@ public class Mutation implements Writab
@Override
public int hashCode() {
- return toThrift().hashCode();
+ return toThrift(false).hashCode();
}
+ /**
+ * Checks if this mutation equals another. This method may be removed in a future API revision in favor of {@link #equals(Object)}. See ACCUMULO-1627 for more
+ * information.
+ *
+ * @param m
+ * mutation
+ * @return true if the given mutation equals this one, false otehrwise
+ */
public boolean equals(Mutation m) {
+ return this.equals((Object) m);
+ }
+
+ private boolean equalMutation(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
if (values == null && m.values == null)
return true;
[6/6] accumulo git commit: Merge branch '1.6'
Posted by uj...@apache.org.
Merge branch '1.6'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9c8dcaf0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9c8dcaf0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9c8dcaf0
Branch: refs/heads/master
Commit: 9c8dcaf0aa9ddf0a9fd068290d0cb4237318ffaa
Parents: aac619c 6fa2090
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 21:11:13 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 21:11:13 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 35 ++++++++++++++++----
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/9c8dcaf0/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index ed51204,233a12e..f532a52
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@@ -97,11 -79,21 +97,25 @@@ public class Mutation implements Writab
}
}
+ /* This is so hashCode & equals can be called without changing this object.
+ *
+ * It will return a copy of the current data buffer if serialized has not been
+ * called previously. Otherwise, this.data will be returned since the buffer is
+ * null and will not change.
+ */
+ private byte[] serializedSnapshot() {
+ if (buffer != null) {
+ return buffer.toArray();
+ } else {
+ return this.data;
+ }
+ }
+
/**
+ * Creates a new mutation. A defensive copy is made.
+ *
+ * @param row
+ * row ID
* @since 1.5.0
*/
public Mutation(byte[] row) {
@@@ -1101,14 -613,9 +1115,13 @@@
}
private boolean equalMutation(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
+ // If two mutations don't have the same
+ if (!replicationSources.equals(m.replicationSources)) {
+ return false;
+ }
-
if (values == null && m.values == null)
return true;
@@@ -1126,25 -633,21 +1139,35 @@@
return false;
}
+ /**
+ * Converts this mutation to Thrift.
+ *
+ * @return Thrift mutation
+ */
public TMutation toThrift() {
- serialize();
+ return toThrift(true);
+ }
+
+ private TMutation toThrift(boolean serialize) {
+ byte[] data;
+ if (serialize) {
+ this.serialize();
+ data = this.data;
+ } else {
+ data = serializedSnapshot();
+ }
- return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values), entries);
+ TMutation tmutation = new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data), ByteBufferUtil.toByteBuffers(values), entries);
+ if (!this.replicationSources.isEmpty()) {
+ tmutation.setSources(new ArrayList<>(replicationSources));
+ }
+ return tmutation;
}
+ /**
+ * Gets the serialization format used to (de)serialize this mutation.
+ *
+ * @return serialization format
+ */
protected SERIALIZED_FORMAT getSerializedFormat() {
return this.useOldDeserialize ? SERIALIZED_FORMAT.VERSION1 : SERIALIZED_FORMAT.VERSION2;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/9c8dcaf0/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
----------------------------------------------------------------------
[4/6] accumulo git commit: Merge branch '1.5' into 1.6
Posted by uj...@apache.org.
Merge branch '1.5' into 1.6
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6fa2090b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6fa2090b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6fa2090b
Branch: refs/heads/master
Commit: 6fa2090b6fa2c3189ed6b20c6b1f2506451cc97c
Parents: 6605ad4 73ce9cf
Author: Bill Slacum <uj...@apache.org>
Authored: Thu Apr 9 19:50:18 2015 -0400
Committer: Bill Slacum <uj...@apache.org>
Committed: Thu Apr 9 19:50:18 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/core/data/Mutation.java | 34 +++++++++++++++++---
.../apache/accumulo/core/data/MutationTest.java | 28 ++++++++++++++++
2 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6fa2090b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 34d8df1,81ad531..233a12e
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@@ -583,25 -705,13 +597,25 @@@ public class Mutation implements Writab
@Override
public int hashCode() {
- return toThrift().hashCode();
+ return toThrift(false).hashCode();
}
+ /**
+ * Checks if this mutation equals another. This method may be removed in a future API revision in favor of {@link #equals(Object)}. See ACCUMULO-1627 for more
+ * information.
+ *
+ * @param m
+ * mutation
+ * @return true if the given mutation equals this one, false otehrwise
+ */
public boolean equals(Mutation m) {
+ return this.equals((Object) m);
+ }
+
+ private boolean equalMutation(Mutation m) {
- serialize();
- m.serialize();
- if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(data, m.data)) {
+ byte[] myData = serializedSnapshot();
+ byte[] otherData = m.serializedSnapshot();
+ if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData, otherData)) {
if (values == null && m.values == null)
return true;