Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ public void incrMetaCacheHit() {
metaCacheHits.inc();
}

public long getMetaCacheHits() {
return metaCacheHits.getCount();
}

/** Increment the number of meta cache misses. */
public void incrMetaCacheMiss() {
metaCacheMisses.inc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public void testPreserveMetaCacheOnException() throws Exception {

Exception exp;
boolean success;
long initialMetaCacheHits = metrics.getMetaCacheHits();
for (int i = 0; i < 50; i++) {
exp = null;
success = false;
Expand All @@ -253,6 +254,11 @@ public void testPreserveMetaCacheOnException() throws Exception {
table.increment(increment);
table.delete(delete);
table.mutateRow(mutations);
// The value of the metaCacheHits counter is incremented by 6 in each round of the loop,
// for 0th iteration there will be 5 hits + 1 cache miss.
assertEquals(initialMetaCacheHits + 6 * i + 5, metrics.getMetaCacheHits());
// We will get a cache miss only on the first request, so the value will always be 1.
assertEquals(1, metrics.getMetaCacheMisses());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Init getMetaCacheMisses too before asserting similar to initialMetaCacheHits? Thanks for the quick review addressal :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind taking a look on the newest commit and seeing if this is what you were expecting in your free time ? REALLY thanks for your patience ! :)

} catch (IOException ex) {
// Only keep track of the last exception that updated the meta cache
if (ClientExceptionsUtil.isMetaClearingException(ex) || success) {
Expand Down