hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1190142 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
Date Fri, 28 Oct 2011 03:29:22 GMT
Author: nspiegelberg
Date: Fri Oct 28 03:29:21 2011
New Revision: 1190142

URL: http://svn.apache.org/viewvc?rev=1190142&view=rev
Log:
HBASE-4679 Thrift null mutation error

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
    hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1190142&r1=1190141&r2=1190142&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Fri Oct 28 03:29:21 2011
@@ -383,6 +383,7 @@ Release 0.92.0 - Unreleased
                of ArithmeticException: / by zero.
    HBASE-4300  Start of new-version master fails if old master's znode is
                hanging around
+   HBASE-4679  Thrift null mutation error
 
   TESTS
    HBASE-4492  TestRollingRestart fails intermittently

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=1190142&r1=1190141&r2=1190142&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Fri
Oct 28 03:29:21 2011
@@ -595,9 +595,13 @@ public class ThriftServer {
             }
           } else {
             if(famAndQf.length == 1) {
-              put.add(famAndQf[0], new byte[0], getBytes(m.value));
+              put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
+                  m.value != null ? m.value.array()
+                      : HConstants.EMPTY_BYTE_ARRAY);
             } else {
-              put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
+              put.add(famAndQf[0], famAndQf[1],
+                  m.value != null ? m.value.array()
+                      : HConstants.EMPTY_BYTE_ARRAY);
             }
           }
         }
@@ -640,9 +644,13 @@ public class ThriftServer {
             }
           } else {
             if(famAndQf.length == 1) {
-              put.add(famAndQf[0], new byte[0], getBytes(m.value));
+              put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
+                  m.value != null ? m.value.array()
+                      : HConstants.EMPTY_BYTE_ARRAY);
             } else {
-              put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
+              put.add(famAndQf[0], famAndQf[1],
+                  m.value != null ? m.value.array()
+                      : HConstants.EMPTY_BYTE_ARRAY);
             }
           }
         }

Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java?rev=1190142&r1=1190141&r2=1190142&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
(original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
Fri Oct 28 03:29:21 2011
@@ -179,6 +179,14 @@ public class TestThriftServer {
     size = handler.getRow(tableAname, rowBname).size();
     assertEquals(0, size);
 
+    // Try null mutation
+    List<Mutation> mutations = new ArrayList<Mutation>();
+    mutations.add(new Mutation(false, columnAname, null));
+    handler.mutateRow(tableAname, rowAname, mutations);
+    TRowResult rowResult3 = handler.getRow(tableAname, rowAname).get(0);
+    assertEquals(rowAname, rowResult3.row);
+    assertEquals(0, rowResult3.columns.get(columnAname).value.array().length);
+
     // Teardown
     handler.disableTable(tableAname);
     handler.deleteTable(tableAname);



Mime
View raw message