hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffr...@apache.org
Subject svn commit: r1566507 - in /hbase/branches/0.98: hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
Date Mon, 10 Feb 2014 05:27:14 GMT
Author: jeffreyz
Date: Mon Feb 10 05:27:14 2014
New Revision: 1566507

URL: http://svn.apache.org/r1566507
Log:
HBASE-10486: ProtobufUtil Append & Increment deserialization lost cell level timestamp

Modified:
    hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
    hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java

Modified: hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java?rev=1566507&r1=1566506&r2=1566507&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
(original)
+++ hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
Mon Feb 10 05:27:14 2014
@@ -683,7 +683,7 @@ public final class ProtobufUtil {
           if (qv.hasTags()) {
             tags = qv.getTags().toByteArray();
           }
-          append.add(CellUtil.createCell(row, family, qualifier, append.getTimeStamp(),
+          append.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
               KeyValue.Type.Put, value, tags));
         }
       }
@@ -761,7 +761,7 @@ public final class ProtobufUtil {
           if (qv.hasTags()) {
             tags = qv.getTags().toByteArray();
           }
-          increment.add(CellUtil.createCell(row, family, qualifier, increment.getTimeStamp(),
+          increment.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
               KeyValue.Type.Put, value, tags));
         }
       }

Modified: hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java?rev=1566507&r1=1566506&r2=1566507&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
(original)
+++ hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
Mon Feb 10 05:27:14 2014
@@ -105,19 +105,22 @@ public class TestProtobufUtil {
    */
   @Test
   public void testAppend() throws IOException {
+    long timeStamp = 111111;
     MutationProto.Builder mutateBuilder = MutationProto.newBuilder();
     mutateBuilder.setRow(ByteString.copyFromUtf8("row"));
     mutateBuilder.setMutateType(MutationType.APPEND);
-    mutateBuilder.setTimestamp(111111);
+    mutateBuilder.setTimestamp(timeStamp);
     ColumnValue.Builder valueBuilder = ColumnValue.newBuilder();
     valueBuilder.setFamily(ByteString.copyFromUtf8("f1"));
     QualifierValue.Builder qualifierBuilder = QualifierValue.newBuilder();
     qualifierBuilder.setQualifier(ByteString.copyFromUtf8("c1"));
     qualifierBuilder.setValue(ByteString.copyFromUtf8("v1"));
+    qualifierBuilder.setTimestamp(timeStamp);
     valueBuilder.addQualifierValue(qualifierBuilder.build());
     qualifierBuilder.setQualifier(ByteString.copyFromUtf8("c2"));
     qualifierBuilder.setValue(ByteString.copyFromUtf8("v2"));
     valueBuilder.addQualifierValue(qualifierBuilder.build());
+    qualifierBuilder.setTimestamp(timeStamp);
     mutateBuilder.addColumnValue(valueBuilder.build());
 
     MutationProto proto = mutateBuilder.build();
@@ -131,15 +134,8 @@ public class TestProtobufUtil {
     Append append = ProtobufUtil.toAppend(proto, null);
 
     // append always use the latest timestamp,
-    // add the timestamp to the original mutate
-    long timestamp = append.getTimeStamp();
-    mutateBuilder.setTimestamp(timestamp);
-    for (ColumnValue.Builder column: mutateBuilder.getColumnValueBuilderList()) {
-      for (QualifierValue.Builder qualifier:
-          column.getQualifierValueBuilderList()) {
-        qualifier.setTimestamp(timestamp);
-      }
-    }
+    // reset the timestamp to the original mutate
+    mutateBuilder.setTimestamp(append.getTimeStamp());
     assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.APPEND, append));
   }
 



Mime
View raw message