HBASE-25644 Scan#setSmall blindly sets ReadType as PREAD
Signed-off-by: zhangduo <zhangduo@apache.org> Signed-off-by: Ramkrishna <ramkrishna@apache.org>
This commit is contained in:
parent
190c253c4e
commit
53128fe7c1
|
@ -895,7 +895,9 @@ public class Scan extends Query {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Scan setSmall(boolean small) {
|
public Scan setSmall(boolean small) {
|
||||||
this.small = small;
|
this.small = small;
|
||||||
this.readType = ReadType.PREAD;
|
if (small) {
|
||||||
|
this.readType = ReadType.PREAD;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
@ -292,4 +293,15 @@ public class TestScan {
|
||||||
assertTrue("Make sure copy constructor adds all the fields in the copied object",
|
assertTrue("Make sure copy constructor adds all the fields in the copied object",
|
||||||
EqualsBuilder.reflectionEquals(scan, scanCopy));
|
EqualsBuilder.reflectionEquals(scan, scanCopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testScanReadType() throws Exception {
|
||||||
|
Scan scan = new Scan();
|
||||||
|
assertFalse(scan.isSmall());
|
||||||
|
assertEquals(ReadType.DEFAULT, scan.getReadType());
|
||||||
|
Scan copyScan = new Scan(scan);
|
||||||
|
copyScan.setSmall(scan.isSmall());
|
||||||
|
assertFalse(copyScan.isSmall());
|
||||||
|
assertEquals(ReadType.DEFAULT, copyScan.getReadType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue