From 90e8591cb4ed45a17a2624c412380c8bc4aa5fef Mon Sep 17 00:00:00 2001 From: Andrew Kyle Purtell Date: Tue, 7 Apr 2009 18:22:59 +0000 Subject: [PATCH] HBASE-1309 HFile rejects key in Memcache with empty value git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@762889 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/org/apache/hadoop/hbase/io/hfile/HFile.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9e33606ee0b..6e0a785c64c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -137,6 +137,7 @@ Release 0.20.0 - Unreleased (Jonathan Gray via Andrew Purtell) HBASE-1205 RegionServers should find new master when a new master comes up (Nitay Joffe via Andrew Purtell) + HBASE-1309 HFile rejects key in Memcache with empty value Release 0.19.0 - 01/21/2009 INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java index 03c9be74cba..c86f293e353 100644 --- a/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -452,7 +452,9 @@ public class HFile { this.out.writeInt(value.length); this.valuelength += valuelength; this.out.write(key); - this.out.write(value); + if (value.length > 0) { + this.out.write(value); + } // Are we the first key in this block? if (this.firstKey == null) this.firstKey = key; this.lastKey = key; @@ -481,8 +483,8 @@ public class HFile { } private void checkValue(final byte [] value) throws IOException { - if (value == null || value.length <= 0) { - throw new IOException("Value cannot be null or empty"); + if (value == null) { + throw new IOException("Value cannot be null"); } }