hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r989203 - in /hbase/branches/0.20: CHANGES.txt src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java
Date Wed, 25 Aug 2010 16:25:02 GMT
Author: jdcryans
Date: Wed Aug 25 16:25:01 2010
New Revision: 989203

URL: http://svn.apache.org/viewvc?rev=989203&view=rev
Log:
   HBASE-2897  [stargate] RowResultGenerator should handle 
               NoSuchColumnFamilyException (Andrew Purtell via J-D)

Modified:
    hbase/branches/0.20/CHANGES.txt
    hbase/branches/0.20/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java
    hbase/branches/0.20/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java

Modified: hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/CHANGES.txt?rev=989203&r1=989202&r2=989203&view=diff
==============================================================================
--- hbase/branches/0.20/CHANGES.txt (original)
+++ hbase/branches/0.20/CHANGES.txt Wed Aug 25 16:25:01 2010
@@ -3,6 +3,8 @@ Release 0.20.7 - Unreleased
   BUG FIXES
    HBASE-2909  SoftValueSortedMap is broken, can generate NPEs
    HBASE-2927  BaseScanner gets stale HRegionInfo in some race cases
+   HBASE-2897  [stargate] RowResultGenerator should handle 
+               NoSuchColumnFamilyException (Andrew Purtell via J-D)
 
   IMPROVEMENTS
 

Modified: hbase/branches/0.20/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java?rev=989203&r1=989202&r2=989203&view=diff
==============================================================================
--- hbase/branches/0.20/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java
(original)
+++ hbase/branches/0.20/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResultGenerator.java
Wed Aug 25 16:25:01 2010
@@ -24,6 +24,9 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Get;
@@ -31,8 +34,12 @@ import org.apache.hadoop.hbase.client.HT
 import org.apache.hadoop.hbase.client.HTablePool;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
+import org.apache.hadoop.util.StringUtils;
 
 public class RowResultGenerator extends ResultGenerator {
+  private static final Log LOG = LogFactory.getLog(RowResultGenerator.class);
+
   private Iterator<KeyValue> valuesI;
   private KeyValue cache;
 
@@ -67,6 +74,14 @@ public class RowResultGenerator extends 
       if (result != null && !result.isEmpty()) {
         valuesI = result.list().iterator();
       }
+    } catch (NoSuchColumnFamilyException e) {
+      // Warn here because Stargate will return 404 in the case if multiple
+      // column families were specified but one did not exist -- currently
+      // HBase will fail the whole Get.
+      // Specifying multiple columns in a URI should be uncommon usage but
+      // help to avoid confusion by leaving a record of what happened here in
+      // the log.
+      LOG.warn(StringUtils.stringifyException(e));
     } finally {
       pool.putTable(table);
     }

Modified: hbase/branches/0.20/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java?rev=989203&r1=989202&r2=989203&view=diff
==============================================================================
--- hbase/branches/0.20/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java
(original)
+++ hbase/branches/0.20/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/TestRowResource.java
Wed Aug 25 16:25:01 2010
@@ -312,6 +312,17 @@ public class TestRowResource extends Min
     checkValueXML(TABLE, encodedKey, COLUMN_2, VALUE_2);
   }
 
+  public void testNoSuchCF() throws IOException, JAXBException {
+    final String goodPath = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
+    final String badPath = "/" + TABLE + "/" + ROW_1 + "/BAD";
+    Response response = client.post(goodPath, MIMETYPE_BINARY,
+      Bytes.toBytes(VALUE_1));
+    assertEquals(response.getCode(), 200);
+    assertEquals(client.get(goodPath, MIMETYPE_BINARY).getCode(), 200);
+    assertEquals(client.get(badPath, MIMETYPE_BINARY).getCode(), 404);
+    assertEquals(client.get(goodPath, MIMETYPE_BINARY).getCode(), 200);
+  }
+
   public void testMultiCellGetPutXML() throws IOException, JAXBException {
     String path = "/" + TABLE + "/fakerow";  // deliberate nonexistent row
 



Mime
View raw message