mirror of https://github.com/apache/cassandra
merge from 0.4 branch
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@828797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7518f7ce9f
commit
296f15804c
|
|
@ -21,6 +21,7 @@
|
|||
* Fix using non-utf8-aware comparison as a sanity check.
|
||||
(CASSANDRA-493)
|
||||
* Improve default garbage collector options (CASSANDRA-504)
|
||||
* Add "nodeprobe flush" (CASSANDRA-505)
|
||||
|
||||
|
||||
0.4.1
|
||||
|
|
|
|||
|
|
@ -613,7 +613,13 @@ public final class StorageService implements IEndPointStateChangeSubscriber, Sto
|
|||
logger_.debug("Cleared out all snapshot directories");
|
||||
}
|
||||
|
||||
public void forceTableFlushBinary(String tableName) throws IOException
|
||||
/**
|
||||
* Flush all memtables for a table and column families.
|
||||
* @param tableName
|
||||
* @param columnFamilies
|
||||
* @throws IOException
|
||||
*/
|
||||
public void forceTableFlush(String tableName, String... columnFamilies) throws IOException
|
||||
{
|
||||
if (DatabaseDescriptor.getTable(tableName) == null)
|
||||
{
|
||||
|
|
@ -621,16 +627,33 @@ public final class StorageService implements IEndPointStateChangeSubscriber, Sto
|
|||
}
|
||||
|
||||
Table table = Table.open(tableName);
|
||||
Set<String> columnFamilies = table.getColumnFamilies();
|
||||
Set<String> positiveColumnFamilies = table.getColumnFamilies();
|
||||
|
||||
// no columnFamilies means flush'em all.
|
||||
if (columnFamilies == null || columnFamilies.length == 0)
|
||||
{
|
||||
columnFamilies = positiveColumnFamilies.toArray(new String[positiveColumnFamilies.size()]);
|
||||
}
|
||||
|
||||
for (String columnFamily : columnFamilies)
|
||||
{
|
||||
ColumnFamilyStore cfStore = table.getColumnFamilyStore(columnFamily);
|
||||
logger_.debug("Forcing flush on keyspace " + tableName + " on CF " + columnFamily);
|
||||
cfStore.forceFlushBinary();
|
||||
|
||||
if (positiveColumnFamilies.contains(columnFamily))
|
||||
{
|
||||
ColumnFamilyStore cfStore = table.getColumnFamilyStore(columnFamily);
|
||||
logger_.debug("Forcing binary flush on keyspace " + tableName + ", CF " + columnFamily);
|
||||
cfStore.forceFlushBinary();
|
||||
logger_.debug("Forcing flush on keyspace " + tableName + ", CF " + columnFamily);
|
||||
cfStore.forceFlush();
|
||||
}
|
||||
else
|
||||
{
|
||||
// this means there was a cf passed in that is not recognized in the keyspace. report it and continue.
|
||||
logger_.warn(String.format("Invalid column family specified: %s. Proceeding with others.", columnFamily));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* End of MBean interface methods */
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -105,11 +105,13 @@ public interface StorageServiceMBean
|
|||
public void clearSnapshot() throws IOException;
|
||||
|
||||
/**
|
||||
* Flush all binary memtables for a table
|
||||
* Flush all memtables for the given column families, or all columnfamilies for the given table
|
||||
* if none are explicitly listed.
|
||||
* @param tableName
|
||||
* @param columnFamilies
|
||||
* @throws IOException
|
||||
*/
|
||||
public void forceTableFlushBinary(String tableName) throws IOException;
|
||||
public void forceTableFlush(String tableName, String... columnFamilies) throws IOException;
|
||||
|
||||
/** set the logging level at runtime */
|
||||
public void setLog4jLevel(String classQualifier, String level);
|
||||
|
|
|
|||
|
|
@ -183,9 +183,9 @@ public class NodeProbe
|
|||
ssProxy.forceTableCompaction();
|
||||
}
|
||||
|
||||
public void forceTableFlushBinary(String tableName) throws IOException
|
||||
public void forceTableFlush(String tableName, String... columnFamilies) throws IOException
|
||||
{
|
||||
ssProxy.forceTableFlushBinary(tableName);
|
||||
ssProxy.forceTableFlush(tableName, columnFamilies);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -474,7 +474,7 @@ public class NodeProbe
|
|||
{
|
||||
HelpFormatter hf = new HelpFormatter();
|
||||
String header = String.format(
|
||||
"%nAvailable commands: ring, info, cleanup, compact, cfstats, snapshot [name], clearsnapshot, tpstats, flush_binary, " +
|
||||
"%nAvailable commands: ring, info, cleanup, compact, cfstats, snapshot [name], clearsnapshot, tpstats, flush, " +
|
||||
" getcompactionthreshold, setcompactionthreshold [minthreshold] ([maxthreshold])");
|
||||
String usage = String.format("java %s -host <arg> <command>%n", NodeProbe.class.getName());
|
||||
hf.printHelp(usage, "", options, header);
|
||||
|
|
@ -550,7 +550,7 @@ public class NodeProbe
|
|||
{
|
||||
probe.printThreadPoolStats(System.out);
|
||||
}
|
||||
else if (cmdName.equals("flush_binary"))
|
||||
else if (cmdName.equals("flush"))
|
||||
{
|
||||
if (probe.getArgs().length < 2)
|
||||
{
|
||||
|
|
@ -558,7 +558,13 @@ public class NodeProbe
|
|||
NodeProbe.printUsage();
|
||||
System.exit(1);
|
||||
}
|
||||
probe.forceTableFlushBinary(probe.getArgs()[1]);
|
||||
|
||||
String[] columnFamilies = new String[probe.getArgs().length - 2];
|
||||
for (int i = 0; i < columnFamilies.length; i++)
|
||||
{
|
||||
columnFamilies[i] = probe.getArgs()[i + 2];
|
||||
}
|
||||
probe.forceTableFlush(probe.getArgs()[1], columnFamilies);
|
||||
}
|
||||
else if (cmdName.equals("getcompactionthreshold"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue