You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by dd...@apache.org on 2014/02/14 08:34:40 UTC

svn commit: r1568205 - in /hbase/branches/hbase-10070: hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ hbase-server/src/main/java/org/apache/hadoop/hbase/client/ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/

Author: ddas
Date: Fri Feb 14 07:34:39 2014
New Revision: 1568205

URL: http://svn.apache.org/r1568205
Log:
HBASE-10354. Addendum commit. 10354.add.patch committed

Modified:
    hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
    hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/client/CoprocessorHConnection.java
    hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java?rev=1568205&r1=1568204&r2=1568205&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java (original)
+++ hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java Fri Feb 14 07:34:39 2014
@@ -1231,7 +1231,7 @@ public final class ProtobufUtil {
    */
   public static ClientProtos.Result toResult(final Result result) {
     if (result.getExists() != null) {
-      return toResult(result.getExists());
+      return toResult(result.getExists(), result.isStale());
     }
 
     Cell[] cells = result.rawCells();
@@ -1255,8 +1255,12 @@ public final class ProtobufUtil {
    * @param existence the client existence to send
    * @return the converted protocol buffer Result
    */
-  public static ClientProtos.Result toResult(final boolean existence) {
-    return existence ? EMPTY_RESULT_PB_EXISTS_TRUE : EMPTY_RESULT_PB_EXISTS_FALSE;
+  public static ClientProtos.Result toResult(final boolean existence, boolean stale) {
+    if (stale){
+      return existence ? EMPTY_RESULT_PB_EXISTS_TRUE_STALE : EMPTY_RESULT_PB_EXISTS_FALSE_STALE;
+    } else {
+      return existence ? EMPTY_RESULT_PB_EXISTS_TRUE : EMPTY_RESULT_PB_EXISTS_FALSE;
+    }
   }
 
   /**
@@ -1267,7 +1271,7 @@ public final class ProtobufUtil {
    * @return the converted protocol buffer Result
    */
   public static ClientProtos.Result toResultNoData(final Result result) {
-    if (result.getExists() != null) return toResult(result.getExists());
+    if (result.getExists() != null) return toResult(result.getExists(), result.isStale());
     int size = result.size();
     if (size == 0) return result.isStale() ? EMPTY_RESULT_PB_STALE : EMPTY_RESULT_PB;
     ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder();

Modified: hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/client/CoprocessorHConnection.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/client/CoprocessorHConnection.java?rev=1568205&r1=1568204&r2=1568205&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/client/CoprocessorHConnection.java (original)
+++ hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/client/CoprocessorHConnection.java Fri Feb 14 07:34:39 2014
@@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.Coprocess
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
@@ -313,6 +314,11 @@ public class CoprocessorHConnection impl
   }
 
   @Override
+  public RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry) throws IOException {
+    return delegate.locateRegion(tableName, row, useCache, retry);
+  }
+
+  @Override
   public List<HRegionLocation> locateRegions(byte[] tableName) throws IOException {
     return delegate.locateRegions(tableName);
   }

Modified: hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1568205&r1=1568204&r2=1568205&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri Feb 14 07:34:39 2014
@@ -4635,7 +4635,8 @@ public class HRegion implements HeapSize
       }
     }
     List<Cell> results = get(get, true);
-    return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null);
+    boolean stale = this.getRegionInfo().getReplicaId() != 0;
+    return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);
   }
 
   /*

Modified: hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1568205&r1=1568204&r2=1568205&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Fri Feb 14 07:34:39 2014
@@ -2643,7 +2643,7 @@ public class HRegionServer implements Cl
     return getRegionByEncodedName(regionName, encodedRegionName);
   }
 
-  protected HRegion getRegionByEncodedName(String encodedRegionName)
+  public HRegion getRegionByEncodedName(String encodedRegionName)
       throws NotServingRegionException {
     return getRegionByEncodedName(null, encodedRegionName);
   }
@@ -2844,7 +2844,8 @@ public class HRegionServer implements Cl
         }
       }
       if (existence != null){
-        ClientProtos.Result pbr = ProtobufUtil.toResult(existence);
+        ClientProtos.Result pbr =
+            ProtobufUtil.toResult(existence, region.getRegionInfo().getReplicaId() != 0);
         builder.setResult(pbr);
       } else  if (r != null) {
         ClientProtos.Result pbr = ProtobufUtil.toResult(r);