diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java index b2c012d..d8ddfa7 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -72,7 +72,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.RegionActi import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.CompareType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; -import org.apache.hadoop.hbase.util.ReflectionUtils; import org.apache.hadoop.hbase.util.Threads; /** @@ -117,7 +116,7 @@ public class HTable implements Table { private int writeRpcTimeout; // timeout for each write rpc request private final boolean cleanupPoolOnClose; // shutdown the pool in close() private final boolean cleanupConnectionOnClose; // close the connection in close() - private Consistency defaultConsistency = Consistency.STRONG; + private static final Consistency DEFAULT_CONSISTENCY = Consistency.STRONG; private HRegionLocator locator; /** The Async process for batch */ @@ -339,6 +338,10 @@ public class HTable implements Table { throw new IllegalArgumentException("Small scan should not be used with batching"); } + if (scan.getConsistency() == null) { + scan.setConsistency(DEFAULT_CONSISTENCY); + } + if (scan.getCaching() <= 0) { scan.setCaching(scannerCaching); } @@ -412,13 +415,9 @@ public class HTable implements Table { } private Result get(Get get, final boolean checkExistenceOnly) throws IOException { - // if we are changing settings to the get, clone it. - if (get.isCheckExistenceOnly() != checkExistenceOnly || get.getConsistency() == null) { - get = ReflectionUtils.newInstance(get.getClass(), get); - get.setCheckExistenceOnly(checkExistenceOnly); - if (get.getConsistency() == null){ - get.setConsistency(defaultConsistency); - } + get.setCheckExistenceOnly(checkExistenceOnly); + if (get.getConsistency() == null) { + get.setConsistency(DEFAULT_CONSISTENCY); } if (get.getConsistency() == Consistency.STRONG) {