HBASE-17816 HRegion#mutateRowWithLocks should update writeRequestCount metric (Weizhan Zeng)
This commit is contained in:
parent
af604f0c0c
commit
48b2502a5f
|
@ -6966,6 +6966,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
@Override
|
||||
public void mutateRowsWithLocks(Collection<Mutation> mutations,
|
||||
Collection<byte[]> rowsToLock, long nonceGroup, long nonce) throws IOException {
|
||||
writeRequestsCount.add(mutations.size());
|
||||
MultiRowMutationProcessor proc = new MultiRowMutationProcessor(mutations, rowsToLock);
|
||||
processRowsWithLocks(proc, -1, nonceGroup, nonce);
|
||||
}
|
||||
|
|
|
@ -6391,4 +6391,28 @@ public class TestHRegion {
|
|||
this.region = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMutateRow_WriteRequestCount() throws Exception {
|
||||
byte[] row1 = Bytes.toBytes("row1");
|
||||
byte[] fam1 = Bytes.toBytes("fam1");
|
||||
byte[] qf1 = Bytes.toBytes("qualifier");
|
||||
byte[] val1 = Bytes.toBytes("value1");
|
||||
|
||||
RowMutations rm = new RowMutations(row1);
|
||||
Put put = new Put(row1);
|
||||
put.addColumn(fam1, qf1, val1);
|
||||
rm.add(put);
|
||||
|
||||
this.region = initHRegion(tableName, method, CONF, fam1);
|
||||
try {
|
||||
long wrcBeforeMutate = this.region.writeRequestsCount.longValue();
|
||||
this.region.mutateRow(rm);
|
||||
long wrcAfterMutate = this.region.writeRequestsCount.longValue();
|
||||
Assert.assertEquals(wrcBeforeMutate + rm.getMutations().size(), wrcAfterMutate);
|
||||
} finally {
|
||||
HBaseTestingUtility.closeRegionAndWAL(this.region);
|
||||
this.region = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue