You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/10/14 17:05:12 UTC

[1/4] cassandra git commit: Don't allow startup if the node's rack has changed

Repository: cassandra
Updated Branches:
  refs/heads/trunk aa0bc75bf -> 42f7611d8


Don't allow startup if the node's rack has changed

patch by Carl Yeksigian; revieiwed by Paulo Motta for CASSANDRA-10242


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

Branch: refs/heads/trunk
Commit: 711870e3484a7ebec5fe47b2a90bf8f8b3d1e0af
Parents: 626ac94
Author: Carl Yeksigian <ca...@apache.org>
Authored: Mon Oct 12 12:47:16 2015 -0400
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Oct 14 15:35:09 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 +-
 NEWS.txt                                        | 13 ++++++
 conf/cassandra-rackdc.properties                |  3 ++
 conf/cassandra.yaml                             |  3 ++
 .../org/apache/cassandra/db/SystemKeyspace.java | 49 ++++++++++++++------
 5 files changed, 56 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/711870e3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cd2a779..9a82780 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 2.1.12
-  * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
+ * Don't allow startup if the node's rack has changed (CASSANDRA-10242)
+ * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
 
 
 2.1.11

http://git-wip-us.apache.org/repos/asf/cassandra/blob/711870e3/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 4b34778..fadd541 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -13,6 +13,18 @@ restore snapshots created with the previous major version using the
 'sstableloader' tool. You can upgrade the file format of your snapshots
 using the provided 'sstableupgrade' tool.
 
+2.1.12
+======
+
+New features
+------------
+    - Switching racks is no longer an allowed operation on a node which has
+      data. Instead, the node will need to be wiped and bootstrapped. If
+      moving from the SimpleSnitch, make sure the rack containing all current
+      nodes is named "rack1". To override this behavior when manually wiping
+      the node and bootstrapping, use -Dcassandra.ignore_rack=true.
+
+
 2.1.11
 =====
 
@@ -21,6 +33,7 @@ Upgrading
     - Nothing specific to this release, but please see 2.1 if you are upgrading
       from a previous version.
 
+
 2.1.10
 =====
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/711870e3/conf/cassandra-rackdc.properties
----------------------------------------------------------------------
diff --git a/conf/cassandra-rackdc.properties b/conf/cassandra-rackdc.properties
index f0a0d55..f85646e 100644
--- a/conf/cassandra-rackdc.properties
+++ b/conf/cassandra-rackdc.properties
@@ -16,6 +16,9 @@
 
 # These properties are used with GossipingPropertyFileSnitch and will
 # indicate the rack and dc for this node
+#
+# When upgrading from SimpleSnitch, you will need to set your initial machines
+# to have rack=rack1
 dc=DC1
 rack=RAC1
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/711870e3/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 7e266d1..df1aa15 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -654,6 +654,9 @@ cross_node_timeout: false
 # YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS
 # ARE PLACED.
 #
+# IF THE RACK A REPLICA IS PLACED IN CHANGES AFTER THE REPLICA HAS BEEN
+# ADDED TO A RING, THE NODE MUST BE WIPED AND REBOOTSTRAPPED.
+#
 # Out of the box, Cassandra provides
 #  - SimpleSnitch:
 #    Treats Strategy order as proximity. This can improve cache

http://git-wip-us.apache.org/repos/asf/cassandra/blob/711870e3/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 2185c6c..72ee270 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -608,24 +608,45 @@ public class SystemKeyspace
         }
         ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(LOCAL_CF);
 
-        String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
-        UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
-
-        if (result.isEmpty() || !result.one().has("cluster_name"))
         {
-            // this is a brand new node
-            if (!cfs.getSSTables().isEmpty())
-                throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");
+            String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
+            UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
 
-            // no system files.  this is a new node.
-            req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
-            executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
-            return;
+            if (result.isEmpty() || !result.one().has("cluster_name"))
+            {
+                // this is a brand new node
+                if (!cfs.getSSTables().isEmpty())
+                    throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");
+
+                // no system files.  this is a new node.
+                req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
+                executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
+            }
+            else
+            {
+                String savedClusterName = result.one().getString("cluster_name");
+                if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
+                    throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
+            }
         }
 
-        String savedClusterName = result.one().getString("cluster_name");
-        if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
-            throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
+        if (!Boolean.getBoolean("cassandra.ignore_rack"))
+        {
+            String req = "SELECT rack FROM system.%s WHERE key='%s'";
+            UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
+
+            // Look up the Rack (return it if found)
+            if (!result.isEmpty() && result.one().has("rack"))
+            {
+                String storedRack = result.one().getString("rack");
+                String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
+                if (!storedRack.equals(currentRack))
+                {
+                    throw new ConfigurationException("Cannot start node if snitch's rack (" + currentRack + ") differs from previous rack (" + storedRack + "). " +
+                                                     "Please fix the snitch or wipe and rebootstrap this node.");
+                }
+            }
+        }
     }
 
     public static Collection<Token> getSavedTokens()


[3/4] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by al...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/trunk
Commit: f21c888510b0dbbea1a63459476f2dc54093de63
Parents: 6d0c96c 7cab327
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Oct 14 16:02:56 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Oct 14 16:02:56 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        | 20 ++++++++++++++++++++
 conf/cassandra-rackdc.properties                |  4 ++--
 conf/cassandra.yaml                             |  3 +++
 .../org/apache/cassandra/db/SystemKeyspace.java | 14 ++++++++++++++
 .../cassandra/service/CassandraDaemon.java      | 13 +++++++++++++
 6 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f21c8885/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d0b90ef,57c6ff9..1a43cfc
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -12,40 -8,27 +12,41 @@@ Merged from 2.2
   * Avoid NoClassDefFoundError during DataDescriptor initialization on windows (CASSANDRA-10412)
   * Preserve case of quoted Role & User names (CASSANDRA-10394)
   * cqlsh pg-style-strings broken (CASSANDRA-10484)
 - * Make Hadoop CF splits more polite to custom orderered partitioners (CASSANDRA-10400)
 - * Fix the regression when using LIMIT with aggregates (CASSANDRA-10487)
 + * cqlsh prompt includes name of keyspace after failed `use` statement (CASSANDRA-10369)
  Merged from 2.1:
 - * Fix mmap file segment seeking to EOF (CASSANDRA-10478)
++ * Don't allow startup if the node's rack has changed (CASSANDRA-10242)
 + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
   * Allow LOCAL_JMX to be easily overridden (CASSANDRA-10275)
   * Mark nodes as dead even if they've already left (CASSANDRA-10205)
 - * Update internal python driver used by cqlsh (CASSANDRA-10161, CASSANDRA-10507)
  
  
 -2.2.2
 - * cqlsh prompt includes name of keyspace after failed `use` statement (CASSANDRA-10369)
 +3.0.0-rc1
 + * Fix mixed version read request compatibility for compact static tables
 +   (CASSANDRA-10373)
 + * Fix paging of DISTINCT with static and IN (CASSANDRA-10354)
 + * Allow MATERIALIZED VIEW's SELECT statement to restrict primary key
 +   columns (CASSANDRA-9664)
 + * Move crc_check_chance out of compression options (CASSANDRA-9839)
 + * Fix descending iteration past end of BTreeSearchIterator (CASSANDRA-10301)
 + * Transfer hints to a different node on decommission (CASSANDRA-10198)
 + * Check partition keys for CAS operations during stmt validation (CASSANDRA-10338)
 + * Add custom query expressions to SELECT (CASSANDRA-10217)
 + * Fix minor bugs in MV handling (CASSANDRA-10362)
 + * Allow custom indexes with 0,1 or multiple target columns (CASSANDRA-10124)
 + * Improve MV schema representation (CASSANDRA-9921)
 + * Add flag to enable/disable coordinator batchlog for MV writes (CASSANDRA-10230)
 + * Update cqlsh COPY for new internal driver serialization interface (CASSANDRA-10318)
 + * Give index implementations more control over rebuild operations (CASSANDRA-10312)
 + * Update index file format (CASSANDRA-10314)
 + * Add "shadowable" row tombstones to deal with mv timestamp issues (CASSANDRA-10261)
 + * CFS.loadNewSSTables() broken for pre-3.0 sstables
 + * Cache selected index in read command to reduce lookups (CASSANDRA-10215)
 + * Small optimizations of sstable index serialization (CASSANDRA-10232)
 + * Support for both encrypted and unencrypted native transport connections (CASSANDRA-9590)
 +Merged from 2.2:
   * Configurable page size in cqlsh (CASSANDRA-9855)
   * Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
 - * Cancel transaction for sstables we wont redistribute index summary
 -   for (CASSANDRA-10270)
 - * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209) 
 - * Retry snapshot deletion after compaction and gc on Windows (CASSANDRA-10222)
 - * Fix failure to start with space in directory path on Windows (CASSANDRA-10239)
 - * Fix repair hang when snapshot failed (CASSANDRA-10057)
 - * Fall back to 1/4 commitlog volume for commitlog_total_space on small disks
 -   (CASSANDRA-10199)
 + * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
  Merged from 2.1:
   * Bulk Loader API could not tolerate even node failure (CASSANDRA-10347)
   * Avoid misleading pushed notifications when multiple nodes

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f21c8885/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index b422453,a235a1d..c36481e
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -13,108 -13,26 +13,128 @@@ restore snapshots created with the prev
  'sstableloader' tool. You can upgrade the file format of your snapshots
  using the provided 'sstableupgrade' tool.
  
 +3.0
 +===
 +
 +New features
 +------------
 +   - Support for IN restrictions on any partition key component or clustering key
 +     as well as support for EQ and IN multicolumn restrictions has been added to
 +     UPDATE and DELETE statement.
 +   - Support for single-column and multi-colum slice restrictions (>, >=, <= and <)
 +     has been added to DELETE statements
 +   - nodetool rebuild_index accepts the index argument without
 +     the redundant table name
 +   - Materialized Views, which allow for server-side denormalization, is now
 +     available. Materialized views provide an alternative to secondary indexes
 +     for non-primary key queries, and perform much better for indexing high
 +     cardinality columns.
 +     See http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views
 +   - Hinted handoff has been completely rewritten. Hints are now stored in flat
 +     files, with less overhead for storage and more efficient dispatch.
 +     See CASSANDRA-6230 for full details.
 +   - Option to not purge unrepaired tombstones. To avoid users having data resurrected
 +     if repair has not been run within gc_grace_seconds, an option has been added to
 +     only allow tombstones from repaired sstables to be purged. To enable, set the
 +     compaction option 'only_purge_repaired_tombstones':true but keep in mind that if
 +     you do not run repair for a long time, you will keep all tombstones around which
 +     can cause other problems.
 +   - Enabled warning on GC taking longer than 1000ms. See
 +     cassandra.yaml:gc_warn_threshold_in_ms
 +
 +Upgrading
 +---------
 +   - Upgrade to 3.0 is supported from Cassandra 2.1 versions greater or equal to 2.1.9,
 +     or Cassandra 2.2 versions greater or equal to 2.2.1. Upgrade from Cassandra 2.0 and
 +     older versions is not supported.
 +   - The 'memtable_allocation_type: offheap_objects' option has been removed. It should
 +     be re-introduced in a future release and you can follow CASSANDRA-9472 to know more.
 +   - The native protocol versions 1 and 2 are not supported anymore.
 +   - Max mutation size is now configurable via max_mutation_size_in_kb setting in
 +     cassandra.yaml; the default is half the size commitlog_segment_size_in_mb * 1024.
 +   - 3.0 requires Java 8u40 or later.
 +   - The default JVM GC has been changed to G1GC.
 +   - New transaction log files have been introduced to replace the compactions_in_progress
 +     system table, temporary file markers (tmp and tmplink) and sstable ancerstors.
 +     Therefore, compaction metadata no longer contains ancestors. Transaction log files
 +     list sstable descriptors involved in compactions and other operations such as flushing
 +     and streaming. Use the sstableutil tool to list any sstable files currently involved
 +     in operations not yet completed, which previously would have been marked as temporary.
 +     A transaction log file contains one sstable per line, with the prefix "add:" or "remove:".
 +     They also contain a special line "commit", only inserted at the end when the transaction
 +     is committed. On startup we use these files to cleanup any partial transactions that were
 +     in progress when the process exited. If the commit line is found, we keep new sstables
 +     (those with the "add" prefix) and delete the old sstables (those with the "remove" prefix),
 +     vice-versa if the commit line is missing. Should you lose or delete these log files,
 +     both old and new sstable files will be kept as live files, which will result in duplicated
 +     sstables. These files are protected by incremental checksums so you should not manually
 +     edit them. When restoring a full backup or moving sstable files, you should clean-up
 +     any left over transactions and their temporary files first. You can use this command:
 +      ===> sstableutil -c ks table
 +     See CASSANDRA-7066 for full details.
 +   - New write stages have been added for batchlog and materialized view mutations
 +     you can set their size in cassandra.yaml
 +   - User defined functions are now executed in a sandbox.
 +     To use UDFs and UDAs, you have to enable them in cassandra.yaml.
 +   - New SSTable version 'la' with improved bloom-filter false-positive handling
 +     compared to previous version 'ka' used in 2.2 and 2.1. Running sstableupgrade
 +     is not necessary but recommended.
 +   - Before upgrading to 3.0, make sure that your cluster is in complete agreement
 +     (schema versions outputted by `nodetool describecluster` are all the same).
 +   - Schema metadata is now stored in the new `system_schema` keyspace, and
 +     legacy `system.schema_*` tables are now gone; see CASSANDRA-6717 for details.
 +   - Pig's CassandraStorage has been removed. Use CqlNativeStorage instead.
 +   - Hadoop BulkOutputFormat and BulkRecordWriter have been removed; use
 +     CqlBulkOutputFormat and CqlBulkRecordWriter instead.
 +   - Hadoop ColumnFamilyInputFormat and ColumnFamilyOutputFormat have been removed;
 +     use CqlInputFormat and CqlOutputFormat instead.
 +   - Hadoop ColumnFamilyRecordReader and ColumnFamilyRecordWriter have been removed;
 +     use CqlRecordReader and CqlRecordWriter instead.
 +   - hinted_handoff_enabled in cassandra.yaml no longer supports a list of data centers.
 +     To specify a list of excluded data centers when hinted_handoff_enabled is set to true,
 +     use hinted_handoff_disabled_datacenters, see CASSANDRA-9035 for details.
 +   - The `sstable_compression` and `chunk_length_kb` compression options have been deprecated.
 +     The new options are `class` and `chunk_length_in_kb`. Disabling compression should now
 +     be done by setting the new option `enabled` to `false`.
 +   - The compression option `crc_check_chance` became a top-level table option, but is currently
 +     enforced only against tables with enabled compression.
 +   - Only map syntax is now allowed for caching options. ALL/NONE/KEYS_ONLY/ROWS_ONLY syntax
 +     has been deprecated since 2.1.0 and is being removed in 3.0.0.
 +   - The 'index_interval' option for 'CREATE TABLE' statements, which has been deprecated
 +     since 2.1 and replaced with the 'min_index_interval' and 'max_index_interval' options,
 +     has now been removed.
 +   - Batchlog entries are now stored in a new table - system.batches.
 +     The old one has been deprecated.
 +   - JMX methods set/getCompactionStrategyClass have been removed, use
 +     set/getCompactionParameters or set/getCompactionParametersJson instead.
 +   - SizeTieredCompactionStrategy parameter cold_reads_to_omit has been removed.
 +   - The secondary index API has been comprehensively reworked. This will be a breaking
 +     change for any custom index implementations, which should now look to implement
 +     the new org.apache.cassandra.index.Index interface. New syntax has been added to create
 +     and query row-based indexes, which are not explicitly linked to a single column in the
 +     base table.
 +
 +
+ 2.2.4
+ =====
+ 
+ Operations
+ ----------
+     - Switching racks is no longer an allowed operation on a node which has
+       data. Instead, the node will need to be wiped and bootstrapped. If
+       moving from the SimpleSnitch, make sure the rack containing all current
+       nodes is named "rack1".
+ 
+ 
+ 2.2.3
+ =====
+ 
+ Upgrading
+ ---------
+     - Nothing specific to this release, but please see 2.2 if you are upgrading
+       from a previous version.
+ 
+ 
  2.2.2
  =====
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f21c8885/conf/cassandra.yaml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f21c8885/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SystemKeyspace.java
index 6112869,62bf59e..651353d
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@@ -1069,11 -881,25 +1069,25 @@@ public final class SystemKeyspac
          return hostId;
      }
  
+     /**
+      * Gets the stored rack for the local node, or null if none have been set yet.
+      */
+     public static String getRack()
+     {
+         String req = "SELECT rack FROM system.%s WHERE key='%s'";
+         UntypedResultSet result = executeInternal(String.format(req, LOCAL, LOCAL));
+ 
+         // Look up the Rack (return it if found)
+         if (!result.isEmpty() && result.one().has("rack"))
+             return result.one().getString("rack");
+ 
+         return null;
+     }
  
 -    public static PaxosState loadPaxosState(ByteBuffer key, CFMetaData metadata)
 +    public static PaxosState loadPaxosState(DecoratedKey key, CFMetaData metadata)
      {
          String req = "SELECT * FROM system.%s WHERE row_key = ? AND cf_id = ?";
 -        UntypedResultSet results = executeInternal(String.format(req, PAXOS), key, metadata.cfId);
 +        UntypedResultSet results = executeInternal(String.format(req, PAXOS), key.getKey(), metadata.cfId);
          if (results.isEmpty())
              return new PaxosState(key, metadata);
          UntypedResultSet.Row row = results.one();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f21c8885/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------


[4/4] cassandra git commit: Merge branch 'cassandra-3.0' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-3.0' into trunk


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

Branch: refs/heads/trunk
Commit: 42f7611d8b25bff6d1bdcefc6b66eae4c575cb54
Parents: aa0bc75 f21c888
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Oct 14 16:05:02 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Oct 14 16:05:02 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        | 20 ++++++++++++++++++++
 conf/cassandra-rackdc.properties                |  4 ++--
 conf/cassandra.yaml                             |  3 +++
 .../org/apache/cassandra/db/SystemKeyspace.java | 14 ++++++++++++++
 .../cassandra/service/CassandraDaemon.java      | 13 +++++++++++++
 6 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/42f7611d/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42f7611d/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------


[2/4] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by al...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/trunk
Commit: 7cab3272455bdd16b639c510416ae339a8613414
Parents: 751e4f9 711870e
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Oct 14 15:54:25 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Oct 14 15:54:25 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 NEWS.txt                                             | 12 ++++++++++++
 conf/cassandra-rackdc.properties                     |  4 ++--
 conf/cassandra.yaml                                  |  3 +++
 src/java/org/apache/cassandra/db/SystemKeyspace.java | 15 +++++++++++++++
 .../apache/cassandra/service/CassandraDaemon.java    | 13 +++++++++++++
 6 files changed, 46 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 6aa16bc,9a82780..57c6ff9
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,5 -1,5 +1,6 @@@
 -2.1.12
 +2.2.4
 +Merged from 2.1:
+  * Don't allow startup if the node's rack has changed (CASSANDRA-10242)
   * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
  
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index f9fbe43,fadd541..a235a1d
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -13,160 -13,27 +13,172 @@@ restore snapshots created with the prev
  'sstableloader' tool. You can upgrade the file format of your snapshots
  using the provided 'sstableupgrade' tool.
  
 -2.1.12
 -======
++2.2.4
++=====
+ 
 -New features
 -------------
++Operations
++----------
+     - Switching racks is no longer an allowed operation on a node which has
+       data. Instead, the node will need to be wiped and bootstrapped. If
+       moving from the SimpleSnitch, make sure the rack containing all current
 -      nodes is named "rack1". To override this behavior when manually wiping
 -      the node and bootstrapping, use -Dcassandra.ignore_rack=true.
++      nodes is named "rack1".
+ 
+ 
 -2.1.11
 +2.2.3
  =====
  
  Upgrading
  ---------
 -    - Nothing specific to this release, but please see 2.1 if you are upgrading
 +    - Nothing specific to this release, but please see 2.2 if you are upgrading
        from a previous version.
  
+ 
 +2.2.2
 +=====
 +
 +Upgrading
 +---------
 +    - Version 1 and 2 of the native protocol are now deprecated and support
 +      will be removed in Cassandra 3.0. You are encouraged to upgrade to a
 +      client driver using version 3 of the native protocol.
 +
 +Changed Defaults
 +----------------
 +   - commitlog_total_space_in_mb will use the smaller of 8192, and 1/4
 +     of the total space of the commitlog volume. (Before: always used
 +     8192)
 +   - Incremental repair is on by default since 2.2.0, run full repairs by
 +     providing the '-full' parameter to nodetool repair.
 +   - Parallel repairs are the default since 2.2.0, run sequential repairs
 +     by providing the '-seq' parameter to nodetool repair.
 +   - The following INFO logs were reduced to DEBUG level and will now show
 +     on debug.log instead of system.log:
 +      - Memtable flushing actions
 +      - Commit log replayed files
 +      - Compacted sstables
 +      - SStable opening (SSTableReader)
 +
 +New features
 +------------
 +   - Custom QueryHandlers can retrieve the column specifications for the bound
 +     variables from QueryOptions by using the hasColumnSpecifications()
 +     and getColumnSpecifications() methods.
 +   - A new default assynchronous log appender debug.log was created in addition
 +     to  the system.log appender in order to provide more detailed log debugging.
 +     In order to disable debug logging, you must comment-out the ASYNCDEBUGLOG
 +     appender on conf/logback.xml. See CASSANDRA-10241 for more information.
 +
 +
 +2.2.1
 +=====
 +
 +Upgrading
 +---------
 +    - Nothing specific to this release, but please see 2.2 if you are upgrading
 +      from a previous version.
 +
 +New features
 +------------
 +   - COUNT(*) and COUNT(1) can be selected with other columns or functions
 +
 +
 +2.2
 +===
 +
 +New features
 +------------
 +   - The LIMIT clause applies now only to the number of rows returned to the user,
 +     not to the number of row queried. By consequence, queries using aggregates will not
 +     be impacted by the LIMIT clause anymore.
 +   - Very large batches will now be rejected (defaults to 50kb). This
 +     can be customized by modifying batch_size_fail_threshold_in_kb.
 +   - Selecting columns,scalar functions, UDT fields, writetime or ttl together
 +     with aggregated is now possible. The value returned for the columns,
 +     scalar functions, UDT fields, writetime and ttl will be the ones for
 +     the first row matching the query.
 +   - Windows is now a supported platform. Powershell execution for startup scripts
 +     is highly recommended and can be enabled via an administrator command-prompt
 +     with: 'powershell set-executionpolicy unrestricted'
 +   - It is now possible to do major compactions when using leveled compaction.
 +     Doing that will take all sstables and compact them out in levels. The
 +     levels will be non overlapping so doing this will still not be something
 +     you want to do very often since it might cause more compactions for a while.
 +     It is also possible to split output when doing a major compaction with
 +     STCS - files will be split in sizes 50%, 25%, 12.5% etc of the total size.
 +     This might be a bit better than old major compactions which created one big
 +     file on disk.
 +   - A new tool has been added bin/sstableverify that checks for errors/bitrot
 +     in all sstables.  Unlike scrub, this is a non-invasive tool.
 +   - Authentication & Authorization APIs have been updated to introduce
 +     roles. Roles and Permissions granted to them are inherited, supporting
 +     role based access control. The role concept supercedes that of users
 +     and CQL constructs such as CREATE USER are deprecated but retained for
 +     compatibility. The requirement to explicitly create Roles in Cassandra
 +     even when auth is handled by an external system has been removed, so
 +     authentication & authorization can be delegated to such systems in their
 +     entirety.
 +   - In addition to the above, Roles are also first class resources and can be the
 +     subject of permissions. Users (roles) can now be granted permissions on other
 +     roles, including CREATE, ALTER, DROP & AUTHORIZE, which removesthe need for
 +     superuser privileges in order to perform user/role management operations.
 +   - Creators of database resources (Keyspaces, Tables, Roles) are now automatically
 +     granted all permissions on them (if the IAuthorizer implementation supports
 +     this).
 +   - SSTable file name is changed. Now you don't have Keyspace/CF name
 +     in file name. Also, secondary index has its own directory under parent's
 +     directory.
 +   - Support for user-defined functions and user-defined aggregates have
 +     been added to CQL.
 +     ************************************************************************
 +     IMPORTANT NOTE: user-defined functions can be used to execute
 +     arbitrary and possibly evil code in Cassandra 2.2, and are
 +     therefore disabled by default.  To enable UDFs edit
 +     cassandra.yaml and set enable_user_defined_functions to true.
 +
 +     CASSANDRA-9402 will add a security manager for UDFs in Cassandra
 +     3.0.  This will inherently be backwards-incompatible with any 2.2
 +     UDF that perform insecure operations such as opening a socket or
 +     writing to the filesystem.
 +     ************************************************************************
 +   - Row-cache is now fully off-heap.
 +   - jemalloc is now automatically preloaded and used on Linux and OS-X if
 +     installed.
 +   - Please ensure on Unix platforms that there is no libjnadispath.so
 +     installed which is accessible by Cassandra. Old versions of
 +     libjna packages (< 4.0.0) will cause problems - e.g. Debian Wheezy
 +     contains libjna versin 3.2.x.
 +   - The node now keeps up when streaming is failed during bootstrapping. You can
 +     use new `nodetool bootstrap resume` command to continue streaming after resolving
 +     an issue.
 +   - Protocol version 4 specifies that bind variables do not require having a
 +     value when executing a statement. Bind variables without a value are
 +     called 'unset'. The 'unset' bind variable is serialized as the int
 +     value '-2' without following bytes.
 +     In an EXECUTE or BATCH request an unset bind value does not modify the value and
 +     does not create a tombstone, an unset bind ttl is treated as 'unlimited',
 +     an unset bind timestamp is treated as 'now', an unset bind counter operation
 +     does not change the counter value.
 +     Unset tuple field, UDT field and map key are not allowed.
 +     In a QUERY request an unset limit is treated as 'unlimited'.
 +     Unset WHERE clauses with unset partition column, clustering column
 +     or index column are not allowed.
 +   - New `ByteType` (cql tinyint). 1-byte signed integer
 +   - New `ShortType` (cql smallint). 2-byte signed integer
 +   - New `SimpleDateType` (cql date). 4-byte unsigned integer
 +   - New `TimeType` (cql time). 8-byte long
 +   - The toDate(timeuuid), toTimestamp(timeuuid) and toUnixTimestamp(timeuuid) functions have been added to allow
 +     to convert from timeuuid into date type, timestamp type and bigint raw value.
 +     The functions unixTimestampOf(timeuuid) and dateOf(timeuuid) have been deprecated.
 +   - The toDate(timestamp) and toUnixTimestamp(timestamp) functions have been added to allow
 +     to convert from timestamp into date type and bigint raw value.
 +   - The toTimestamp(date) and toUnixTimestamp(date) functions have been added to allow
 +     to convert from date into timestamp type and bigint raw value.
 +   - SizeTieredCompactionStrategy parameter cold_reads_to_omit has been removed.
 +   - The default JVM flag -XX:+PerfDisableSharedMem will cause the following tools JVM
 +     to stop working: jps, jstack, jinfo, jmc, jcmd as well as 3rd party tools like Jolokia.
 +     If you wish to use these tools you can comment this flag out in cassandra-env.{sh,ps1}
 +
 +
  2.1.10
  =====
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/conf/cassandra-rackdc.properties
----------------------------------------------------------------------
diff --cc conf/cassandra-rackdc.properties
index f0a0d55,f85646e..2ea6043
--- a/conf/cassandra-rackdc.properties
+++ b/conf/cassandra-rackdc.properties
@@@ -16,8 -16,11 +16,8 @@@
  
  # These properties are used with GossipingPropertyFileSnitch and will
  # indicate the rack and dc for this node
 -#
 -# When upgrading from SimpleSnitch, you will need to set your initial machines
 -# to have rack=rack1
--dc=DC1
--rack=RAC1
++dc=dc1
++rack=rack1
  
  # Add a suffix to a datacenter name. Used by the Ec2Snitch and Ec2MultiRegionSnitch
  # to append a string to the EC2 region name.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/conf/cassandra.yaml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SystemKeyspace.java
index 308edcd,72ee270..62bf59e
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@@ -881,6 -777,126 +881,21 @@@ public final class SystemKeyspac
          return hostId;
      }
  
+     /**
 -     * @param cfName The name of the ColumnFamily responsible for part of the schema (keyspace, ColumnFamily, columns)
 -     * @return CFS responsible to hold low-level serialized schema
 -     */
 -    public static ColumnFamilyStore schemaCFS(String cfName)
 -    {
 -        return Keyspace.open(Keyspace.SYSTEM_KS).getColumnFamilyStore(cfName);
 -    }
 -
 -    public static List<Row> serializedSchema()
 -    {
 -        List<Row> schema = new ArrayList<>();
 -
 -        for (String cf : allSchemaCfs)
 -            schema.addAll(serializedSchema(cf));
 -
 -        return schema;
 -    }
 -
 -    /**
 -     * @param schemaCfName The name of the ColumnFamily responsible for part of the schema (keyspace, ColumnFamily, columns)
 -     * @return low-level schema representation (each row represents individual Keyspace or ColumnFamily)
++     * Gets the stored rack for the local node, or null if none have been set yet.
+      */
 -    public static List<Row> serializedSchema(String schemaCfName)
 -    {
 -        Token minToken = StorageService.getPartitioner().getMinimumToken();
 -
 -        return schemaCFS(schemaCfName).getRangeSlice(new Range<RowPosition>(minToken.minKeyBound(), minToken.maxKeyBound()),
 -                                                     null,
 -                                                     new IdentityQueryFilter(),
 -                                                     Integer.MAX_VALUE,
 -                                                     System.currentTimeMillis());
 -    }
 -
 -    public static Collection<Mutation> serializeSchema()
++    public static String getRack()
+     {
 -        Map<DecoratedKey, Mutation> mutationMap = new HashMap<>();
++        String req = "SELECT rack FROM system.%s WHERE key='%s'";
++        UntypedResultSet result = executeInternal(String.format(req, LOCAL, LOCAL));
+ 
 -        for (String cf : allSchemaCfs)
 -            serializeSchema(mutationMap, cf);
++        // Look up the Rack (return it if found)
++        if (!result.isEmpty() && result.one().has("rack"))
++            return result.one().getString("rack");
+ 
 -        return mutationMap.values();
 -    }
 -
 -    private static void serializeSchema(Map<DecoratedKey, Mutation> mutationMap, String schemaCfName)
 -    {
 -        for (Row schemaRow : serializedSchema(schemaCfName))
 -        {
 -            if (Schema.ignoredSchemaRow(schemaRow))
 -                continue;
 -
 -            Mutation mutation = mutationMap.get(schemaRow.key);
 -            if (mutation == null)
 -            {
 -                mutation = new Mutation(Keyspace.SYSTEM_KS, schemaRow.key.getKey());
 -                mutationMap.put(schemaRow.key, mutation);
 -            }
 -
 -            mutation.add(schemaRow.cf);
 -        }
 -    }
 -
 -    public static Map<DecoratedKey, ColumnFamily> getSchema(String schemaCfName, Set<String> keyspaces)
 -    {
 -        Map<DecoratedKey, ColumnFamily> schema = new HashMap<>();
 -
 -        for (String keyspace : keyspaces)
 -        {
 -            Row schemaEntity = readSchemaRow(schemaCfName, keyspace);
 -            if (schemaEntity.cf != null)
 -                schema.put(schemaEntity.key, schemaEntity.cf);
 -        }
 -
 -        return schema;
 -    }
 -
 -    public static ByteBuffer getSchemaKSKey(String ksName)
 -    {
 -        return AsciiType.instance.fromString(ksName);
 -    }
 -
 -    /**
 -     * Fetches a subset of schema (table data, columns metadata or triggers) for the keyspace.
 -     *
 -     * @param schemaCfName the schema table to get the data from (schema_keyspaces, schema_columnfamilies, schema_columns or schema_triggers)
 -     * @param ksName the keyspace of the tables we are interested in
 -     * @return a Row containing the schema data of a particular type for the keyspace
 -     */
 -    public static Row readSchemaRow(String schemaCfName, String ksName)
 -    {
 -        DecoratedKey key = StorageService.getPartitioner().decorateKey(getSchemaKSKey(ksName));
 -
 -        ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(schemaCfName);
 -        ColumnFamily result = schemaCFS.getColumnFamily(QueryFilter.getIdentityFilter(key, schemaCfName, System.currentTimeMillis()));
 -
 -        return new Row(key, result);
 -    }
 -
 -    /**
 -     * Fetches a subset of schema (table data, columns metadata or triggers) for the keyspace+table pair.
 -     *
 -     * @param schemaCfName the schema table to get the data from (schema_columnfamilies, schema_columns or schema_triggers)
 -     * @param ksName the keyspace of the table we are interested in
 -     * @param cfName the table we are interested in
 -     * @return a Row containing the schema data of a particular type for the table
 -     */
 -    public static Row readSchemaRow(String schemaCfName, String ksName, String cfName)
 -    {
 -        DecoratedKey key = StorageService.getPartitioner().decorateKey(getSchemaKSKey(ksName));
 -        ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(schemaCfName);
 -        Composite prefix = schemaCFS.getComparator().make(cfName);
 -        ColumnFamily cf = schemaCFS.getColumnFamily(key,
 -                                                    prefix,
 -                                                    prefix.end(),
 -                                                    false,
 -                                                    Integer.MAX_VALUE,
 -                                                    System.currentTimeMillis());
 -        return new Row(key, cf);
++        return null;
+     }
+ 
      public static PaxosState loadPaxosState(ByteBuffer key, CFMetaData metadata)
      {
          String req = "SELECT * FROM system.%s WHERE row_key = ? AND cf_id = ?";

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7cab3272/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java
index 2a23550,17553f3..9e38e06
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@@ -231,6 -319,6 +231,19 @@@ public class CassandraDaemo
          }
  
          Keyspace.setInitialized();
++
++        String storedRack = SystemKeyspace.getRack();
++        if (storedRack != null)
++        {
++            String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
++            if (!storedRack.equals(currentRack))
++            {
++                logger.error("Cannot start node if snitch's rack differs from previous rack. " +
++                             "Please fix the snitch or wipe and rebootstrap this node.");
++                System.exit(100);
++            }
++        }
++
          // initialize keyspaces
          for (String keyspaceName : Schema.instance.getKeyspaces())
          {