an MBean attribute for displaying a flush counter

This changeset adds a new attribute to the ColumnFamilyStore MBean which
displays the number of times the memtable has been "switched". This
attribute (along with the newly added count and size attributes),
should prove useful in tuning thresholds.

patch by Eric Evans; reviewed by jbellis for #75

for your changes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@764841 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2009-04-14 15:47:44 +00:00
parent a332fad07d
commit 31e3033afd
2 changed files with 21 additions and 0 deletions

View File

@ -68,6 +68,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
private String table_;
public String columnFamily_;
private volatile Integer memtableSwitchCount = 0;
/* This is used to generate the next index for a SSTable */
private AtomicInteger fileIndexGenerator_ = new AtomicInteger(0);
@ -395,6 +397,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
memtable_.set( new Memtable(table_, columnFamily_) );
if(!key.equals(Memtable.flushKey_))
memtable_.get().put(key, columnFamily, cLogCtx);
if (memtableSwitchCount == Integer.MAX_VALUE)
{
memtableSwitchCount = 0;
}
memtableSwitchCount++;
}
/*
@ -1380,4 +1388,9 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
{
return memtable_.get().getCurrentSize();
}
public int getMemtableSwitchCount()
{
return memtableSwitchCount;
}
}

View File

@ -40,4 +40,12 @@ public interface ColumnFamilyStoreMBean
* @return The number of columns.
*/
public int getMemtableColumnsCount();
/**
* Returns the number of times that a flush has resulted in the
* memtable being switched out.
*
* @return the number of memtable switches
*/
public int getMemtableSwitchCount();
}