cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: Modify system tcp keepalive settings in Windows install scripts patch by Josh McKenzie; tested by Philip Thompson for CASSANDRA-7348
Date Thu, 12 Jun 2014 20:06:03 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 61b13b0e6 -> b9153f4ae
  refs/heads/trunk 542e71c26 -> bafde3d66


Modify system tcp keepalive settings in Windows install scripts
patch by Josh McKenzie; tested by Philip Thompson for CASSANDRA-7348


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b9153f4a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b9153f4a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b9153f4a

Branch: refs/heads/cassandra-2.1
Commit: b9153f4ae5aa5ba8989d9ea8ef0eee693a3a548b
Parents: 61b13b0
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Jun 12 15:05:04 2014 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Jun 12 15:05:04 2014 -0500

----------------------------------------------------------------------
 bin/cassandra.bat      |  3 +--
 bin/cassandra.ps1      | 44 +++++++++++++++++++++++++++++++++++---------
 conf/cassandra-env.ps1 | 14 +++++++-------
 3 files changed, 43 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b9153f4a/bin/cassandra.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra.bat b/bin/cassandra.bat
index 629e58b..e4e07aa 100644
--- a/bin/cassandra.bat
+++ b/bin/cassandra.bat
@@ -35,8 +35,7 @@ goto runLegacy
 REM -----------------------------------------------------------------------------
 :runPowerShell
 echo Detected powershell execution permissions.  Running with enhanced startup scripts.
-echo starting ps1: %CASSANDRA_HOME%/bin/cassandra.ps1
-powershell /file %CASSANDRA_HOME%/bin/cassandra.ps1 %*
+powershell /file %CASSANDRA_HOME%\bin\cassandra.ps1 %*
 goto finally
 
 REM -----------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b9153f4a/bin/cassandra.ps1
----------------------------------------------------------------------
diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1
index ac8d89c..b470b2c 100644
--- a/bin/cassandra.ps1
+++ b/bin/cassandra.ps1
@@ -66,7 +66,7 @@ Function Main
 {
     ValidateArguments
 
-    . "$env:CASSANDRA_HOME/bin/source-conf.ps1"
+    . "$env:CASSANDRA_HOME\bin\source-conf.ps1"
     $conf = Find-Conf
     if ($verbose)
     {
@@ -75,7 +75,7 @@ Function Main
     . $conf
 
     SetCassandraEnvironment
-    $pidfile = "$env:CASSANDRA_HOME/$pidfile"
+    $pidfile = "$env:CASSANDRA_HOME\$pidfile"
 
     $logdir = "$env:CASSANDRA_HOME/logs"
     $storagedir = "$env:CASSANDRA_HOME/data"
@@ -93,7 +93,7 @@ Function Main
     if ($p)
     {
         $pidfile = "$p"
-        $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra-pidfile=$pidfile"
+        $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + ' -Dcassandra-pidfile="' + "$pidfile"
+ '"'
     }
 
     if ($install -or $uninstall)
@@ -110,32 +110,55 @@ Function Main
 #-----------------------------------------------------------------------------
 Function HandleInstallation
 {
-    $SERVICE_JVM = "cassandra"
-    $PATH_PRUNSRV = "$env:CASSANDRA_HOME/bin/daemon/"
+    $SERVICE_JVM = """cassandra"""
+    $PATH_PRUNSRV = "$env:CASSANDRA_HOME\bin\daemon"
     $PR_LOGPATH = $serverPath
 
+    if (-Not (Test-Path $PATH_PRUNSRV\prunsrv.exe))
+    {
+        Write-Warning "Cannot find $PATH_PRUNSRV\prunsrv.exe.  Please download package from
http://www.apache.org/dist/commons/daemon/binaries/windows/ to install as a service."
+        Break
+    }
+
+    If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]
"Administrator"))
+    {
+        Write-Warning "Cannot perform installation without admin credentials.  Please re-run
as administrator."
+        Break
+    }
     if (!$env:PRUNSRV)
     {
-        $env:PRUNSRV="$PATH_PRUNSRV/prunsrv"
+        $env:PRUNSRV="$PATH_PRUNSRV\prunsrv"
     }
 
+    $regPath = "HKLM:\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\"
+
     echo "Attempting to delete existing $SERVICE_JVM service..."
     Start-Sleep -s 2
     $proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//DS//$SERVICE_JVM" -PassThru
-WindowStyle Hidden
 
+    echo "Reverting to default TCP keepalive settings (2 hour timeout)"
+    Remove-ItemProperty -Path $regPath -Name KeepAliveTime -EA SilentlyContinue
+
     # Quit out if this is uninstall only
     if ($uninstall)
     {
         return
     }
 
-    echo "Installing [$SERVICE_JVM]. If you get registry warnings, re-run as an Administrator"
+    echo "Installing [$SERVICE_JVM]."
     Start-Sleep -s 2
     $proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//IS//$SERVICE_JVM" -PassThru
-WindowStyle Hidden
 
-    echo "Setting the parameters for [$SERVICE_JVM]"
+    echo "Setting launch parameters for [$SERVICE_JVM]"
     Start-Sleep -s 2
 
+    # Change delim from " -" to ";-" in JVM_OPTS for prunsrv
+    $env:JVM_OPTS = $env:JVM_OPTS -replace " -", ";-"
+    $env:JVM_OPTS = $env:JVM_OPTS -replace " -", ";-"
+
+    # Strip off leading ; if it's there
+    $env:JVM_OPTS = $env:JVM_OPTS.TrimStart(";")
+
     # Broken multi-line for convenience - glued back together in a bit
     $args = @"
 //US//$SERVICE_JVM
@@ -144,11 +167,14 @@ Function HandleInstallation
  --StartMode=jvm --StartClass=$env:CASSANDRA_MAIN --StartMethod=main
  --StopMode=jvm --StopClass=$env:CASSANDRA_MAIN  --StopMethod=stop
  ++JvmOptions=$env:JVM_OPTS ++JvmOptions=-DCassandra
- --PidFile $pidfile
+ --PidFile "$pidfile"
 "@
     $args = $args -replace [Environment]::NewLine, ""
     $proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList $args -PassThru -WindowStyle
Hidden
 
+    echo "Setting KeepAliveTimer to 5 minutes for TCP keepalive"
+    Set-ItemProperty -Path $regPath -Name KeepAliveTime -Value 300000
+
     echo "Installation of [$SERVICE_JVM] is complete"
 }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b9153f4a/conf/cassandra-env.ps1
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1
index 3f64737..e897ee9 100644
--- a/conf/cassandra-env.ps1
+++ b/conf/cassandra-env.ps1
@@ -39,15 +39,15 @@ Function SetCassandraMain()
 #-----------------------------------------------------------------------------
 Function BuildClassPath
 {
-    $cp = "$env:CASSANDRA_HOME/conf"
-    foreach ($file in Get-ChildItem "$env:CASSANDRA_HOME/lib/*.jar")
+    $cp = "$env:CASSANDRA_HOME\conf"
+    foreach ($file in Get-ChildItem "$env:CASSANDRA_HOME\lib\*.jar")
     {
         $file = $file -replace "\\", "/"
-        $cp = $cp + ";" + "$file"
+        $cp = $cp + ";" + """$file"""
     }
 
     # Add build/classes/main so it works in development
-    $cp = $cp + ";" + "$env:CASSANDRA_HOME/build/classes/main;$env:CASSANDRA_HOME/build/classes/thrift"
+    $cp = $cp + ";" + "$env:CASSANDRA_HOME\build\classes\main;$env:CASSANDRA_HOME\build\classes\thrift"
     $env:CLASSPATH=$cp
 }
 
@@ -174,7 +174,7 @@ Function SetCassandraEnvironment
     echo "Setting up Cassandra environment"
     if (Test-Path Env:\JAVA_HOME)
     {
-        $env:JAVA_BIN = "$env:JAVA_HOME/bin/java.exe"
+        $env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe"
     }
     elseif (Get-Command "java.exe")
     {
@@ -186,7 +186,7 @@ Function SetCassandraEnvironment
         exit
     }
     SetCassandraHome
-    $env:CASSANDRA_CONF = "$env:CASSANDRA_HOME/conf"
+    $env:CASSANDRA_CONF = "$env:CASSANDRA_HOME\conf"
     $env:CASSANDRA_PARAMS="-Dcassandra -Dlogback.configurationFile=logback.xml"
     SetCassandraMain
     BuildClassPath
@@ -215,7 +215,7 @@ Function SetCassandraEnvironment
     if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
         (($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq
1)))
     {
-        $env:JVM_OPTS = "$env:JVM_OPTS -javaagent:$env:CASSANDRA_HOME/lib/jamm-0.2.6.jar"
+        $env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.2.6.jar"""
     }
 
     # enable assertions.  disabling this in production will give a modest


Mime
View raw message