You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/10/23 19:36:29 UTC
svn commit: r1026653 - in
/cassandra/trunk/src/java/org/apache/cassandra/config: CFMetaData.java
DatabaseDescriptor.java
Author: jbellis
Date: Sat Oct 23 17:36:29 2010
New Revision: 1026653
URL: http://svn.apache.org/viewvc?rev=1026653&view=rev
Log:
avoid initializing DatabaseDescriptor during CFMetadata construction. patch by Stu Hood; reviewed by jbellis for CASSANDRA-1655
Modified:
cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Modified: cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1026653&r1=1026652&r2=1026653&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Sat Oct 23 17:36:29 2010
@@ -60,8 +60,8 @@ public final class CFMetaData
public final static int DEFAULT_MIN_COMPACTION_THRESHOLD = 4;
public final static int DEFAULT_MAX_COMPACTION_THRESHOLD = 32;
public final static int DEFAULT_MEMTABLE_LIFETIME_IN_MINS = 60;
- public final static int DEFAULT_MEMTABLE_THROUGHPUT_IN_MB = DatabaseDescriptor.sizeMemtableThroughput();
- public final static double DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS = DatabaseDescriptor.sizeMemtableOperations(DEFAULT_MEMTABLE_THROUGHPUT_IN_MB);
+ public final static int DEFAULT_MEMTABLE_THROUGHPUT_IN_MB = sizeMemtableThroughput();
+ public final static double DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS = sizeMemtableOperations(DEFAULT_MEMTABLE_THROUGHPUT_IN_MB);
private static final int MIN_CF_ID = 1000;
@@ -100,6 +100,22 @@ public final class CFMetaData
}
/**
+ * @return A calculated memtable throughput size for this machine.
+ */
+ public static int sizeMemtableThroughput()
+ {
+ return (int) (Runtime.getRuntime().maxMemory() / (1048576 * 16));
+ }
+
+ /**
+ * @return A calculated memtable operation count for this machine.
+ */
+ public static double sizeMemtableOperations(int mem_throughput)
+ {
+ return 0.3 * mem_throughput / 64.0;
+ }
+
+ /**
* @return The (ksname,cfname) pair for the given id, or null if it has been dropped.
*/
public static Pair<String,String> getCF(Integer cfId)
Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1026653&r1=1026652&r2=1026653&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Sat Oct 23 17:36:29 2010
@@ -561,12 +561,12 @@ public class DatabaseDescriptor
if (cf.memtable_throughput_in_mb == null)
{
- cf.memtable_throughput_in_mb = sizeMemtableThroughput();
+ cf.memtable_throughput_in_mb = CFMetaData.sizeMemtableThroughput();
logger.info("memtable_throughput_in_mb not configured for " + cf.name + ", using " + cf.memtable_throughput_in_mb);
}
if (cf.memtable_operations_in_millions == null)
{
- cf.memtable_operations_in_millions = sizeMemtableOperations(cf.memtable_throughput_in_mb);
+ cf.memtable_operations_in_millions = CFMetaData.sizeMemtableOperations(cf.memtable_throughput_in_mb);
logger.info("memtable_operations_in_millions not configured for " + cf.name + ", using " + cf.memtable_operations_in_millions);
}
@@ -1099,13 +1099,4 @@ public class DatabaseDescriptor
{
return conf.dynamic_snitch_badness_threshold;
}
-
- public static int sizeMemtableThroughput() {
- return (int) (Runtime.getRuntime().maxMemory() / (1048576 * 16));
- }
-
- public static double sizeMemtableOperations(int mem_throughput) {
- return 0.3 * mem_throughput / 64.0;
- }
-
}