You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2014/06/05 22:40:29 UTC
[1/2] git commit: Use $CASSANDRA_HOME for default paths instead of
/var
Repository: cassandra
Updated Branches:
refs/heads/trunk 8a91a1a59 -> c84408109
Use $CASSANDRA_HOME for default paths instead of /var
Patch by Tyler Hobbs; reviewed by Brandon Williams and Joshua McKenzie
for CASSANDRA-7136
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/60be7423
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/60be7423
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/60be7423
Branch: refs/heads/trunk
Commit: 60be74230e48bb7f3aba132e247d054a8b8b8a0d
Parents: 4722fe7
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Thu Jun 5 15:38:41 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Thu Jun 5 15:38:41 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 10 ++++
bin/cassandra | 1 +
bin/cassandra.bat | 1 +
bin/cassandra.ps1 | 4 ++
conf/cassandra.yaml | 11 ++--
conf/logback.xml | 4 +-
debian/control | 2 +-
debian/patches/001cassandra_yaml_dirs.dpatch | 36 ++++++++++++
debian/patches/00list | 1 +
debian/rules | 6 +-
.../cassandra/config/DatabaseDescriptor.java | 60 ++++++++++++--------
12 files changed, 104 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3cea1e7..fd593e7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@
* Reduce run time for CQL tests (CASSANDRA-7327)
* Fix heap size calculation on Windows (CASSANDRA-7352)
* RefCount native frames from netty (CASSANDRA-7245)
+ * Use tarball dir instead of /var for default paths (CASSANDRA-7136)
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/60be7423/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index c1b2b44..4eed9de 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -18,6 +18,16 @@ using the provided 'sstableupgrade' tool.
New features
------------
+ - Default data and log locations have changed. If not set in
+ cassandra.yaml, the data file directory, commitlog directory,
+ and saved caches directory will default to $CASSANDRA_HOME/data/data,
+ $CASSANDRA_HOME/data/commitlog, and $CASSANDRA_HOME/data/saved_caches,
+ respectively. The log directory now defaults to $CASSANDRA_HOME/logs.
+ If not set, $CASSANDRA_HOME, defaults to the top-level directory of
+ the installation.
+ Note that this should only affect source checkouts and tarballs.
+ Deb and RPM packages will continue to use /var/lib/cassandra and
+ /var/log/cassandra in cassandra.yaml.
- SSTable data directory name is slightly changed. Each directory will
have hex string appended after CF name, e.g.
ks/cf-5be396077b811e3a3ab9dc4b9ac088d/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/bin/cassandra
----------------------------------------------------------------------
diff --git a/bin/cassandra b/bin/cassandra
index f34ca8c..797d36b 100755
--- a/bin/cassandra
+++ b/bin/cassandra
@@ -134,6 +134,7 @@ launch_service()
props="$3"
class="$4"
cassandra_parms="-Dlogback.configurationFile=logback.xml"
+ cassandra_parms="$cassandra_parms -Dcassandra.logdir=$CASSANDRA_HOME/logs -Dcassandra.storagedir=$CASSANDRA_HOME/data"
if [ "x$pidpath" != "x" ]; then
cassandra_parms="$cassandra_parms -Dcassandra-pidfile=$pidpath"
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/bin/cassandra.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra.bat b/bin/cassandra.bat
index 172ca8e..629e58b 100644
--- a/bin/cassandra.bat
+++ b/bin/cassandra.bat
@@ -86,6 +86,7 @@ goto :eof
REM Include the build\classes\main directory so it works in development
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\thrift"
set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes
+set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.logdir=%CASSANDRA_HOME%\logs" "-Dcassandra.storagedir=%CASSANDRA_HOME%\data"
if /i "%ARG%" == "INSTALL" goto doInstallOperation
if /i "%ARG%" == "UNINSTALL" goto doInstallOperation
goto runDaemon
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/bin/cassandra.ps1
----------------------------------------------------------------------
diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1
index 19d831a..ac8d89c 100644
--- a/bin/cassandra.ps1
+++ b/bin/cassandra.ps1
@@ -77,6 +77,10 @@ Function Main
SetCassandraEnvironment
$pidfile = "$env:CASSANDRA_HOME/$pidfile"
+ $logdir = "$env:CASSANDRA_HOME/logs"
+ $storagedir = "$env:CASSANDRA_HOME/data"
+ $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra.logdir=$logdir -Dcassandra.storagedir=$storagedir"
+
# Other command line params
if ($H)
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 561c7ff..e6c34e0 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -93,12 +93,14 @@ partitioner: org.apache.cassandra.dht.Murmur3Partitioner
# Directories where Cassandra should store data on disk. Cassandra
# will spread data evenly across them, subject to the granularity of
# the configured compaction strategy.
-data_file_directories:
- - /var/lib/cassandra/data
+# If not set, the default directory is $CASSANDRA_HOME/data/data.
+# data_file_directories:
+# - /var/lib/cassandra/data
# commit log. when running on magnetic HDD, this should be a
# separate spindle than the data directories.
-commitlog_directory: /var/lib/cassandra/commitlog
+# If not set, the default directory is $CASSANDRA_HOME/data/commitlog.
+# commitlog_directory: /var/lib/cassandra/commitlog
# policy for data disk failures:
# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
@@ -200,7 +202,8 @@ counter_cache_save_period: 7200
# memory_allocator: NativeAllocator
# saved caches
-saved_caches_directory: /var/lib/cassandra/saved_caches
+# If not set, the default directory is $CASSANDRA_HOME/data/saved_caches.
+# saved_caches_directory: /var/lib/cassandra/saved_caches
# commitlog_sync may be either "periodic" or "batch."
# When in batch mode, Cassandra won't ack writes until the commit log
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/conf/logback.xml
----------------------------------------------------------------------
diff --git a/conf/logback.xml b/conf/logback.xml
index 61e5a13..e170d41 100644
--- a/conf/logback.xml
+++ b/conf/logback.xml
@@ -20,9 +20,9 @@
<configuration scan="true">
<jmxConfigurator />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>/var/log/cassandra/system.log</file>
+ <file>${cassandra.logdir}/system.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>/var/log/cassandra/system.log.%i.zip</fileNamePattern>
+ <fileNamePattern>${cassandra.logdir}/system.log.%i.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>20</maxIndex>
</rollingPolicy>
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index cc0c49b..f1167c3 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: misc
Priority: extra
Maintainer: Eric Evans <ee...@apache.org>
Uploaders: Sylvain Lebresne <sl...@apache.org>
-Build-Depends: debhelper (>= 5), openjdk-7-jdk | java7-jdk, ant (>= 1.7), ant-optional (>= 1.7), python-support
+Build-Depends: debhelper (>= 5), openjdk-7-jdk | java7-jdk, ant (>= 1.7), ant-optional (>= 1.7), python-support, dpatch
Homepage: http://cassandra.apache.org
Vcs-Git: http://git-wip-us.apache.org/repos/asf/cassandra.git
Vcs-Browser: https://git-wip-us.apache.org/repos/asf?p=cassandra.git
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/debian/patches/001cassandra_yaml_dirs.dpatch
----------------------------------------------------------------------
diff --git a/debian/patches/001cassandra_yaml_dirs.dpatch b/debian/patches/001cassandra_yaml_dirs.dpatch
new file mode 100644
index 0000000..3d545e5
--- /dev/null
+++ b/debian/patches/001cassandra_yaml_dirs.dpatch
@@ -0,0 +1,36 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 001cassandra_yaml_dirs.dpatch by Tyler Hobbs <ty...@datastax.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra.yaml cassandra/conf/cassandra.yaml
+--- cassandra~/conf/cassandra.yaml 2014-06-05 13:36:22.000000000 -0500
++++ cassandra/conf/cassandra.yaml 2014-06-05 13:39:20.569034040 -0500
+@@ -94,13 +94,13 @@
+ # will spread data evenly across them, subject to the granularity of
+ # the configured compaction strategy.
+ # If not set, the default directory is $CASSANDRA_HOME/data/data.
+-# data_file_directories:
+-# - /var/lib/cassandra/data
++data_file_directories:
++ - /var/lib/cassandra/data
+
+ # commit log. when running on magnetic HDD, this should be a
+ # separate spindle than the data directories.
+ # If not set, the default directory is $CASSANDRA_HOME/data/commitlog.
+-# commitlog_directory: /var/lib/cassandra/commitlog
++commitlog_directory: /var/lib/cassandra/commitlog
+
+ # policy for data disk failures:
+ # stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
+@@ -203,7 +203,7 @@
+
+ # saved caches
+ # If not set, the default directory is $CASSANDRA_HOME/data/saved_caches.
+-# saved_caches_directory: /var/lib/cassandra/saved_caches
++saved_caches_directory: /var/lib/cassandra/saved_caches
+
+ # commitlog_sync may be either "periodic" or "batch."
+ # When in batch mode, Cassandra won't ack writes until the commit log
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/debian/patches/00list
----------------------------------------------------------------------
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644
index 0000000..508c180
--- /dev/null
+++ b/debian/patches/00list
@@ -0,0 +1 @@
+001cassandra_yaml_dirs.dpatch
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 717bbf2..602cfde 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,6 +3,8 @@
# Uncomment to enable verbose mode.
#export DH_VERBOSE=1
+include /usr/share/dpatch/dpatch.make
+
ANT = /usr/bin/ant
VERSION = $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')
@@ -10,7 +12,7 @@ test:
dh_testdir
$(ANT) test
-clean:
+clean: unpatch
dh_testdir
dh_testroot
$(ANT) realclean
@@ -22,7 +24,7 @@ clean:
dh_clean
build: build-stamp
-build-stamp:
+build-stamp: patch-stamp
dh_testdir
printf "version=%s" $(VERSION) > build.properties
http://git-wip-us.apache.org/repos/asf/cassandra/blob/60be7423/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 5b227ae..3cc53de 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -452,35 +452,47 @@ public class DatabaseDescriptor
throw new ConfigurationException("in_memory_compaction_limit_in_mb must be a positive integer");
}
- if (conf.concurrent_compactors == null)
- conf.concurrent_compactors = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length)));
-
- if (conf.concurrent_compactors <= 0)
- throw new ConfigurationException("concurrent_compactors should be strictly greater than 0");
-
- /* data file and commit log directories. they get created later, when they're needed. */
- if (conf.commitlog_directory != null && conf.data_file_directories != null && conf.saved_caches_directory != null)
+ // if data dirs, commitlog dir, or saved caches dir are set in cassandra.yaml, use that. Otherwise,
+ // use -Dcassandra.storagedir (set in cassandra-env.sh) as the parent dir for data/, commitlog/, and saved_caches/
+ if (conf.commitlog_directory == null)
{
- for (String datadir : conf.data_file_directories)
- {
- if (datadir.equals(conf.commitlog_directory))
- throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories");
- if (datadir.equals(conf.saved_caches_directory))
- throw new ConfigurationException("saved_caches_directory must not be the same as any data_file_directories");
- }
-
- if (conf.commitlog_directory.equals(conf.saved_caches_directory))
- throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory");
+ conf.commitlog_directory = System.getProperty("cassandra.storagedir", null);
+ if (conf.commitlog_directory == null)
+ throw new ConfigurationException("commitlog_directory is missing and -Dcassandra.storagedir is not set");
+ conf.commitlog_directory += File.separator + "commitlog";
}
- else
+ if (conf.saved_caches_directory == null)
{
- if (conf.commitlog_directory == null)
- throw new ConfigurationException("commitlog_directory missing");
- if (conf.data_file_directories == null)
- throw new ConfigurationException("data_file_directories missing; at least one data directory must be specified");
+ conf.saved_caches_directory = System.getProperty("cassandra.storagedir", null);
if (conf.saved_caches_directory == null)
- throw new ConfigurationException("saved_caches_directory missing");
+ throw new ConfigurationException("saved_caches_directory is missing and -Dcassandra.storagedir is not set");
+ conf.saved_caches_directory += File.separator + "saved_caches";
}
+ if (conf.data_file_directories == null)
+ {
+ String defaultDataDir = System.getProperty("cassandra.storagedir", null);
+ if (defaultDataDir == null)
+ throw new ConfigurationException("data_file_directories is not missing and -Dcassandra.storagedir is not set");
+ conf.data_file_directories = new String[]{ defaultDataDir + File.separator + "data" };
+ }
+
+ /* data file and commit log directories. they get created later, when they're needed. */
+ for (String datadir : conf.data_file_directories)
+ {
+ if (datadir.equals(conf.commitlog_directory))
+ throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories");
+ if (datadir.equals(conf.saved_caches_directory))
+ throw new ConfigurationException("saved_caches_directory must not be the same as any data_file_directories");
+ }
+
+ if (conf.commitlog_directory.equals(conf.saved_caches_directory))
+ throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory");
+
+ if (conf.concurrent_compactors == null)
+ conf.concurrent_compactors = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length)));
+
+ if (conf.concurrent_compactors <= 0)
+ throw new ConfigurationException("concurrent_compactors should be strictly greater than 0");
if (conf.initial_token != null)
for (String token : tokensFromString(conf.initial_token))
[2/2] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by ty...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c8440810
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c8440810
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c8440810
Branch: refs/heads/trunk
Commit: c8440810903cd20da2493ca4bee5b329e32e6f06
Parents: 8a91a1a 60be742
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Thu Jun 5 15:40:10 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Thu Jun 5 15:40:10 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 10 ++++
bin/cassandra | 1 +
bin/cassandra.bat | 1 +
bin/cassandra.ps1 | 4 ++
conf/cassandra.yaml | 11 ++--
conf/logback.xml | 4 +-
debian/control | 2 +-
debian/patches/001cassandra_yaml_dirs.dpatch | 36 ++++++++++++
debian/patches/00list | 1 +
debian/rules | 6 +-
.../cassandra/config/DatabaseDescriptor.java | 60 ++++++++++++--------
12 files changed, 104 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c8440810/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c8440810/NEWS.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c8440810/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------