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 2014/06/05 17:23:33 UTC
[2/3] git commit: Fix heap size calculation on Windows patch by Josh
McKenzie; reviewed by Philip Thompson for CASSANDRA-7352
Fix heap size calculation on Windows
patch by Josh McKenzie; reviewed by Philip Thompson for CASSANDRA-7352
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b29d882d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b29d882d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b29d882d
Branch: refs/heads/trunk
Commit: b29d882df82c1b0aa2c1878c0ba704ac814c69d3
Parents: 78e91c4
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jun 5 10:23:15 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jun 5 10:23:15 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
conf/cassandra-env.ps1 | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b29d882d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 41ee6e5..eed2c09 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,7 @@
* Don't fail streams on failure detector downs (CASSANDRA-3569)
* Add optional keyspace to DROP INDEX statement (CASSANDRA-7314)
* Reduce run time for CQL tests (CASSANDRA-7327)
+ * Fix heap size calculation on Windows (CASSANDRA-7352)
Merged from 2.0:
* Add per-CF range read request latency metrics (CASSANDRA-7338)
* Fix NPE in StreamTransferTask.createMessageForRetry() (CASSANDRA-7323)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b29d882d/conf/cassandra-env.ps1
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1
index b3f773f..3f64737 100644
--- a/conf/cassandra-env.ps1
+++ b/conf/cassandra-env.ps1
@@ -67,7 +67,7 @@ Function CalculateHeapSizes
$memObject = Get-WMIObject -class win32_physicalmemory
$memory = ($memObject | Measure-Object Capacity -Sum).sum
- $memoryMB = $memory / (1024*1024)
+ $memoryMB = [Math]::Truncate($memory / (1024*1024))
$cpu = gwmi Win32_ComputerSystem | Select-Object NumberOfLogicalProcessors
$systemCores = $cpu.NumberOfLogicalProcessors
@@ -77,8 +77,8 @@ Function CalculateHeapSizes
# calculate 1/2 ram and cap to 1024MB
# calculate 1/4 ram and cap to 8192MB
# pick the max
- $halfMem = $memoryMB / 2
- $quarterMem = $halfMem / 2
+ $halfMem = [Math]::Truncate($memoryMB / 2)
+ $quarterMem = [Math]::Truncate($halfMem / 2)
if ($halfMem -gt 1024)
{
@@ -103,7 +103,7 @@ Function CalculateHeapSizes
# Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4
$maxYGPerCore = 100
$maxYGTotal = $maxYGPerCore * $systemCores
- $desiredYG = $maxHeapMB / 4
+ $desiredYG = [Math]::Truncate($maxHeapMB / 4)
if ($desiredYG -gt $maxYGTotal)
{