hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r983493 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java src/main/java/org/apache/hadoop/hbase/rest/client/Client.java src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
Date Sun, 08 Aug 2010 23:29:54 GMT
Author: apurtell
Date: Sun Aug  8 23:29:53 2010
New Revision: 983493

URL: http://svn.apache.org/viewvc?rev=983493&view=rev
Log:
HBASE-2897 RowResultGenerator should handle NoSuchColumnFamilyException

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=983493&r1=983492&r2=983493&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Aug  8 23:29:53 2010
@@ -471,6 +471,7 @@ Release 0.21.0 - Unreleased
    HBASE-2901  HBASE-2461 broke build
    HBASE-2823  Entire Row Deletes not stored in Row+Col Bloom
                (Alexander Georgiev via Stack)
+   HBASE-2897  RowResultGenerator should handle NoSuchColumnFamilyException
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java?rev=983493&r1=983492&r2=983493&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java Sun Aug
 8 23:29:53 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,11 @@ 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;
 
 public class RowResultGenerator extends ResultGenerator {
+  private static final Log LOG = LogFactory.getLog(RowResultGenerator.class);
+
   private Iterator<KeyValue> valuesI;
   private KeyValue cache;
 
@@ -67,6 +73,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/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java?rev=983493&r1=983492&r2=983493&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java Sun Aug  8 23:29:53
2010
@@ -143,7 +143,7 @@ public class Client {
     int code = httpClient.executeMethod(method);
     long endTime = System.currentTimeMillis();
     if (LOG.isDebugEnabled()) {
-      LOG.debug(method.getName() + " " + uri + ": " + code + " " +
+      LOG.debug(method.getName() + " " + uri + " " + code + " " +
         method.getStatusText() + " in " + (endTime - startTime) + " ms");
     }
     return code;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java?rev=983493&r1=983492&r2=983493&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java Sun Aug  8
23:29:53 2010
@@ -312,6 +312,17 @@ public class TestRowResource extends HBa
     checkValueXML(TABLE, encodedKey, COLUMN_2, VALUE_2);
   }
 
+  public void testNoSuchCF() throws IOException, JAXBException {
+    final String goodPath = "/" + TABLE + "/" + ROW_1 + "/" + CFA;
+    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);
+  }
+
   void doTestMultiCellGetPutXML() throws IOException, JAXBException {
     String path = "/" + TABLE + "/fakerow";  // deliberate nonexistent row
 



Mime
View raw message