hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject svn commit: r1543514 - /hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
Date Tue, 19 Nov 2013 17:35:50 GMT
Author: nkeywal
Date: Tue Nov 19 17:35:50 2013
New Revision: 1543514

URL: http://svn.apache.org/r1543514
Log:
HBASE-9989 Add a test on get in TestClientNoCluster

Modified:
    hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java

Modified: hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java?rev=1543514&r1=1543513&r2=1543514&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
(original)
+++ hbase/trunk/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
Tue Nov 19 17:35:50 2013
@@ -437,10 +437,21 @@ public class TestClientNoCluster extends
     throws ServiceException {
       boolean metaRegion = isMetaRegion(request.getRegion().getValue().toByteArray(),
         request.getRegion().getType());
-      if (!metaRegion) throw new UnsupportedOperationException();
+      if (!metaRegion) {
+        return doGetResponse(request);
+      }
       return doMetaGetResponse(meta, request);
     }
 
+    private GetResponse doGetResponse(GetRequest request) {
+      ClientProtos.Result.Builder resultBuilder = ClientProtos.Result.newBuilder();
+      ByteString row = request.getGet().getRow();
+      resultBuilder.addCell(getStartCode(row));
+      GetResponse.Builder builder = GetResponse.newBuilder();
+      builder.setResult(resultBuilder.build());
+      return builder.build();
+    }
+
     @Override
     public MutateResponse mutate(RpcController controller,
         MutateRequest request) throws ServiceException {
@@ -693,19 +704,25 @@ public class TestClientNoCluster extends
     long startTime = System.currentTimeMillis();
     final int printInterval = 100000;
     Random rd = new Random(id);
+    boolean get = c.getBoolean("hbase.test.do.gets", false);
     try {
       Stopwatch stopWatch = new Stopwatch();
       stopWatch.start();
       for (int i = 0; i < namespaceSpan; i++) {
         byte [] b = format(rd.nextLong());
-        Put p = new Put(b);
-        p.add(HConstants.CATALOG_FAMILY, b, b);
+        if (get){
+          Get g = new Get(b);
+          table.get(g);
+        } else {
+          Put p = new Put(b);
+          p.add(HConstants.CATALOG_FAMILY, b, b);
+          table.put(p);
+        }
         if (i % printInterval == 0) {
           LOG.info("Put " + printInterval + "/" + stopWatch.elapsedMillis());
           stopWatch.reset();
           stopWatch.start();
         }
-        table.put(p);
       }
       LOG.info("Finished a cycle putting " + namespaceSpan + " in " +
           (System.currentTimeMillis() - startTime) + "ms");



Mime
View raw message