Skip to content

Commit

Permalink
Handling obsoleteVersionException separately in JMX; no longer re-thr…
Browse files Browse the repository at this point in the history
…owing obsoleteVersionException.
  • Loading branch information
Alex Feinberg committed Oct 21, 2009
1 parent c3ef94a commit 3c3d49d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/java/voldemort/store/stats/StatTrackingStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import voldemort.annotations.jmx.JmxOperation;
import voldemort.store.DelegatingStore;
import voldemort.store.Store;
import voldemort.versioning.ObsoleteVersionException;
import voldemort.versioning.Version;
import voldemort.versioning.Versioned;

Expand Down Expand Up @@ -87,6 +88,9 @@ public void put(K key, Versioned<V> value) throws VoldemortException {
long start = System.nanoTime();
try {
super.put(key, value);
} catch (ObsoleteVersionException e) {
// Don't rethrow this, as not to log it. Merely track it in JMX
stats.recordTime(Tracked.OBSOLETE, System.nanoTime() - start);
} catch(VoldemortException e) {
stats.recordTime(Tracked.EXCEPTION, System.nanoTime() - start);
throw e;
Expand Down Expand Up @@ -159,6 +163,12 @@ public float getDeleteThroughput() {
return stats.getThroughput(Tracked.DELETE);
}

@JmxGetter(name = "numberOfObsoleteVersions",
description = "Number of ObsoleteVersionExceptions since the last reset.")
public long getNumberOfObsoleteVersions() {
return stats.getCount(Tracked.OBSOLETE);
}

@JmxGetter(name = "numberOfExceptions", description = "The number of exceptions since the last reset.")
public long getNumberOfExceptions() {
return stats.getCount(Tracked.EXCEPTION);
Expand Down
3 changes: 2 additions & 1 deletion src/java/voldemort/store/stats/Tracked.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ public enum Tracked {
GET_ALL("getAll"),
PUT("put"),
DELETE("delete"),
EXCEPTION("exception");
EXCEPTION("exception"),
OBSOLETE("obsolete");

private final String name;

Expand Down

0 comments on commit 3c3d49d

Please sign in to comment.