HBASE-11353 Wrong Write Request Count
This commit is contained in:
parent
5136c70554
commit
0e647de3ee
|
@ -2003,7 +2003,6 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
checkReadOnly();
|
||||
checkResources();
|
||||
startRegionOperation(Operation.DELETE);
|
||||
this.writeRequestsCount.increment();
|
||||
try {
|
||||
delete.getRow();
|
||||
// All edits for the given row (across all column families) must happen atomically.
|
||||
|
@ -2110,7 +2109,6 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
// will be extremely rare; we'll deal with it when it happens.
|
||||
checkResources();
|
||||
startRegionOperation(Operation.PUT);
|
||||
this.writeRequestsCount.increment();
|
||||
try {
|
||||
// All edits for the given row (across all column families) must happen atomically.
|
||||
doBatchMutate(put);
|
||||
|
|
|
@ -4983,6 +4983,32 @@ public class TestHRegion {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteRequestsCounter() throws IOException {
|
||||
byte[] fam = Bytes.toBytes("info");
|
||||
byte[][] families = { fam };
|
||||
this.region = initHRegion(tableName, method, CONF, families);
|
||||
|
||||
Assert.assertEquals(0L, region.getWriteRequestsCount());
|
||||
|
||||
Put put = new Put(row);
|
||||
put.add(fam, fam, fam);
|
||||
|
||||
Assert.assertEquals(0L, region.getWriteRequestsCount());
|
||||
region.put(put);
|
||||
Assert.assertEquals(1L, region.getWriteRequestsCount());
|
||||
region.put(put);
|
||||
Assert.assertEquals(2L, region.getWriteRequestsCount());
|
||||
region.put(put);
|
||||
Assert.assertEquals(3L, region.getWriteRequestsCount());
|
||||
|
||||
region.delete(new Delete(row));
|
||||
Assert.assertEquals(4L, region.getWriteRequestsCount());
|
||||
|
||||
HRegion.closeHRegion(this.region);
|
||||
this.region = null;
|
||||
}
|
||||
|
||||
private static HRegion initHRegion(byte[] tableName, String callingMethod,
|
||||
byte[]... families) throws IOException {
|
||||
return initHRegion(tableName, callingMethod, HBaseConfiguration.create(),
|
||||
|
|
Loading…
Reference in New Issue