hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1572708 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/KeyValue.java main/java/org/apache/hadoop/hbase/regionserver/Store.java test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java
Date Thu, 27 Feb 2014 19:18:22 GMT
Author: liyin
Date: Thu Feb 27 19:18:22 2014
New Revision: 1572708

URL: http://svn.apache.org/r1572708
Log:
[HBASE-7099][89-fb]i Bugfix in compaction hook if value is null

Author: adela

Summary: if value is null we would get nullpointer exception

Test Plan: ran TestLowerToUpperCompactionHook

Reviewers: aaiyer, manukranthk, rshroff

Reviewed By: aaiyer

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1191952

Task ID: 2095744

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/KeyValue.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1572708&r1=1572707&r2=1572708&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/KeyValue.java Thu Feb 27
19:18:22 2014
@@ -2263,7 +2263,7 @@ public class KeyValue implements Writabl
     KeyValue newKV = new KeyValue(bytes, getRowOffset(), getRowLength(), bytes,
         getFamilyOffset(), getFamilyLength(), bytes, getQualifierOffset(),
         getQualifierLength(), this.getTimestamp(), Type.codeToType(this
-            .getType()), newValue, 0, newValue.length);
+            .getType()), newValue, 0, newValue == null ? 0 : newValue.length);
     newKV.setMemstoreTS(this.getMemstoreTS());
     return newKV;
   }

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1572708&r1=1572707&r2=1572708&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Thu
Feb 27 19:18:22 2014
@@ -1437,7 +1437,7 @@ public class Store extends SchemaConfigu
                   // if exception happened just write unmodified keyvalue
                   writer.append(kv, kvContext);
                   LOG.error("Exception happened while executing compaction hook, leaving
KV unchanged: "
-                      + e.getCause());
+                       ,e);
                   kvsErrors++;
                 }
               } else {

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java?rev=1572708&r1=1572707&r2=1572708&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/compactionhook/LowerToUpperCompactionHook.java
Thu Feb 27 19:18:22 2014
@@ -39,6 +39,10 @@ public class LowerToUpperCompactionHook 
     if (currentValue.equals("aba")) {
       throw new IllegalArgumentException("dummy exception!");
     }
+    if (currentValue.equals("abb")) {
+      kvModified.modifyValue(null);
+      return kvModified;
+    }
     // create a copy of the kv and transform it to uppercase.
     String newValueString = currentValue;
     newValueString = newValueString.toUpperCase();



Mime
View raw message