Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Jonathan Ellis 2014-06-12 15:05:58 -05:00
commit bafde3d66c
3 changed files with 43 additions and 18 deletions

View File

@ -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 -----------------------------------------------------------------------------

View File

@ -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"
}

View File

@ -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