HBASE-10354. Addendum commit. 10354.add.patch committed

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-10070@1568205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Devaraj Das 2014-02-14 07:34:39 +00:00 committed by Enis Soztutar
parent 998cd1642f
commit d6f603a492
4 changed files with 13 additions and 7 deletions

View File

@ -1232,7 +1232,7 @@ public final class ProtobufUtil {
*/ */
public static ClientProtos.Result toResult(final Result result) { public static ClientProtos.Result toResult(final Result result) {
if (result.getExists() != null) { if (result.getExists() != null) {
return toResult(result.getExists()); return toResult(result.getExists(), result.isStale());
} }
Cell[] cells = result.rawCells(); Cell[] cells = result.rawCells();
@ -1256,8 +1256,12 @@ public final class ProtobufUtil {
* @param existence the client existence to send * @param existence the client existence to send
* @return the converted protocol buffer Result * @return the converted protocol buffer Result
*/ */
public static ClientProtos.Result toResult(final boolean existence) { public static ClientProtos.Result toResult(final boolean existence, boolean stale) {
return existence ? EMPTY_RESULT_PB_EXISTS_TRUE : EMPTY_RESULT_PB_EXISTS_FALSE; 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;
}
} }
/** /**
@ -1268,7 +1272,7 @@ public final class ProtobufUtil {
* @return the converted protocol buffer Result * @return the converted protocol buffer Result
*/ */
public static ClientProtos.Result toResultNoData(final Result 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(); int size = result.size();
if (size == 0) return result.isStale() ? EMPTY_RESULT_PB_STALE : EMPTY_RESULT_PB; if (size == 0) return result.isStale() ? EMPTY_RESULT_PB_STALE : EMPTY_RESULT_PB;
ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder(); ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder();

View File

@ -4725,7 +4725,8 @@ public class HRegion implements HeapSize { // , Writable{
} }
} }
List<Cell> results = get(get, true); 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);
} }
/* /*

View File

@ -2531,7 +2531,7 @@ public class HRegionServer extends HasThread implements
return getRegionByEncodedName(regionName, encodedRegionName); return getRegionByEncodedName(regionName, encodedRegionName);
} }
protected HRegion getRegionByEncodedName(String encodedRegionName) public HRegion getRegionByEncodedName(String encodedRegionName)
throws NotServingRegionException { throws NotServingRegionException {
return getRegionByEncodedName(null, encodedRegionName); return getRegionByEncodedName(null, encodedRegionName);
} }

View File

@ -1606,7 +1606,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
} }
} }
if (existence != null){ if (existence != null){
ClientProtos.Result pbr = ProtobufUtil.toResult(existence); ClientProtos.Result pbr =
ProtobufUtil.toResult(existence, region.getRegionInfo().getReplicaId() != 0);
builder.setResult(pbr); builder.setResult(pbr);
} else if (r != null) { } else if (r != null) {
ClientProtos.Result pbr = ProtobufUtil.toResult(r); ClientProtos.Result pbr = ProtobufUtil.toResult(r);