[1/4] cassandra git commit: stableloader will fail if there are collections in the schema tables

2015-12-15 Thread jake
Repository: cassandra
Updated Branches:
  refs/heads/trunk 1c62850c9 -> 7139f959d


stableloader will fail if there are collections in the schema tables

Fix and new testcase

Patch by tjake; reviewed by Aleksey Yeschenko for CASSANDRA-10700


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

Branch: refs/heads/trunk
Commit: 994250c8d38b3b4299f2e33ebe405ff601b5ae85
Parents: cee35e4
Author: T Jake Luciani 
Authored: Mon Dec 14 11:40:53 2015 -0500
Committer: T Jake Luciani 
Committed: Tue Dec 15 14:15:12 2015 -0500

--
 CHANGES.txt |   4 +
 .../org/apache/cassandra/tools/BulkLoader.java  |  31 +++-
 .../apache/cassandra/tools/BulkLoaderTest.java  | 172 +++
 3 files changed, 202 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 7f1d66b..8e58703 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,12 @@
 2.1.13
+<<< HEAD
  * Allow CREATE TABLE WITH ID (CASSANDRA-9179)
  * Make Stress compiles within eclipse (CASSANDRA-10807)
  * Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
  * Allow cancellation of index summary redistribution (CASSANDRA-8805)
+===
+ * sstableloader will fail if there are collections in the schema tables 
(CASSANDRA-10700)
+>>> 5377183... stableloader will fail if there are collections in the 
schema tables
  * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
  * Fix Stress profile parsing on Windows (CASSANDRA-10808)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/src/java/org/apache/cassandra/tools/BulkLoader.java
--
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java 
b/src/java/org/apache/cassandra/tools/BulkLoader.java
index f4b30cb..96e826d 100644
--- a/src/java/org/apache/cassandra/tools/BulkLoader.java
+++ b/src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -24,9 +24,10 @@ import java.util.*;
 import com.google.common.base.Joiner;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
 
 import org.apache.commons.cli.*;
+import org.apache.commons.lang3.StringUtils;
+
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TTransport;
@@ -310,10 +311,11 @@ public class BulkLoader
 }
 }
 
-String cfQuery = String.format("SELECT * FROM %s.%s WHERE 
keyspace_name = '%s'",
- Keyspace.SYSTEM_KS,
- 
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
- keyspace);
+String cfQuery = String.format("SELECT %s FROM %s.%s WHERE 
keyspace_name = '%s'",
+   
StringUtils.join(getCFColumnsWithoutCollections(), ","),
+   Keyspace.SYSTEM_KS,
+   
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+   keyspace);
 CqlResult cfRes = 
client.execute_cql3_query(ByteBufferUtil.bytes(cfQuery), Compression.NONE, 
ConsistencyLevel.ONE);
 
 
@@ -340,6 +342,25 @@ public class BulkLoader
 }
 }
 
+//Remove dropped_columns since we can't parse collections in v2 which 
is used by thrift
+//See CASSANDRA-10700
+List getCFColumnsWithoutCollections()
+{
+
+Iterator allColumns = 
CFMetaData.SchemaColumnFamiliesCf.allColumnsInSelectOrder();
+List selectedColumns = new ArrayList<>();
+
+while (allColumns.hasNext())
+{
+ColumnDefinition def = allColumns.next();
+
+if (!def.type.isCollection())
+
selectedColumns.add(UTF8Type.instance.getString(def.name.bytes));
+}
+
+return selectedColumns;
+}
+
 @Override
 public StreamConnectionFactory getConnectionFactory()
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/test/unit/org/apache/cassandra/tools/BulkLoaderTest.java
--
diff --git a/test/unit/org/apache/cassandra/tools/BulkLoaderTest.java 
b/test/unit/o

[1/3] cassandra git commit: stableloader will fail if there are collections in the schema tables

2015-12-15 Thread jake
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 db40ef839 -> 942e5e599


stableloader will fail if there are collections in the schema tables

Fix and new testcase

Patch by tjake; reviewed by Aleksey Yeschenko for CASSANDRA-10700


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

Branch: refs/heads/cassandra-3.0
Commit: 994250c8d38b3b4299f2e33ebe405ff601b5ae85
Parents: cee35e4
Author: T Jake Luciani 
Authored: Mon Dec 14 11:40:53 2015 -0500
Committer: T Jake Luciani 
Committed: Tue Dec 15 14:15:12 2015 -0500

--
 CHANGES.txt |   4 +
 .../org/apache/cassandra/tools/BulkLoader.java  |  31 +++-
 .../apache/cassandra/tools/BulkLoaderTest.java  | 172 +++
 3 files changed, 202 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 7f1d66b..8e58703 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,12 @@
 2.1.13
+<<< HEAD
  * Allow CREATE TABLE WITH ID (CASSANDRA-9179)
  * Make Stress compiles within eclipse (CASSANDRA-10807)
  * Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
  * Allow cancellation of index summary redistribution (CASSANDRA-8805)
+===
+ * sstableloader will fail if there are collections in the schema tables 
(CASSANDRA-10700)
+>>> 5377183... stableloader will fail if there are collections in the 
schema tables
  * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
  * Fix Stress profile parsing on Windows (CASSANDRA-10808)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/src/java/org/apache/cassandra/tools/BulkLoader.java
--
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java 
b/src/java/org/apache/cassandra/tools/BulkLoader.java
index f4b30cb..96e826d 100644
--- a/src/java/org/apache/cassandra/tools/BulkLoader.java
+++ b/src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -24,9 +24,10 @@ import java.util.*;
 import com.google.common.base.Joiner;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
 
 import org.apache.commons.cli.*;
+import org.apache.commons.lang3.StringUtils;
+
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TTransport;
@@ -310,10 +311,11 @@ public class BulkLoader
 }
 }
 
-String cfQuery = String.format("SELECT * FROM %s.%s WHERE 
keyspace_name = '%s'",
- Keyspace.SYSTEM_KS,
- 
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
- keyspace);
+String cfQuery = String.format("SELECT %s FROM %s.%s WHERE 
keyspace_name = '%s'",
+   
StringUtils.join(getCFColumnsWithoutCollections(), ","),
+   Keyspace.SYSTEM_KS,
+   
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+   keyspace);
 CqlResult cfRes = 
client.execute_cql3_query(ByteBufferUtil.bytes(cfQuery), Compression.NONE, 
ConsistencyLevel.ONE);
 
 
@@ -340,6 +342,25 @@ public class BulkLoader
 }
 }
 
+//Remove dropped_columns since we can't parse collections in v2 which 
is used by thrift
+//See CASSANDRA-10700
+List getCFColumnsWithoutCollections()
+{
+
+Iterator allColumns = 
CFMetaData.SchemaColumnFamiliesCf.allColumnsInSelectOrder();
+List selectedColumns = new ArrayList<>();
+
+while (allColumns.hasNext())
+{
+ColumnDefinition def = allColumns.next();
+
+if (!def.type.isCollection())
+
selectedColumns.add(UTF8Type.instance.getString(def.name.bytes));
+}
+
+return selectedColumns;
+}
+
 @Override
 public StreamConnectionFactory getConnectionFactory()
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/test/unit/org/apache/cassandra/tools/BulkLoaderTest.java
--
diff --git a/test/unit/org/apache/cassandra/tools/BulkLoaderTest.jav

[1/2] cassandra git commit: stableloader will fail if there are collections in the schema tables

2015-12-15 Thread jake
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 85c724183 -> de55c39cd


stableloader will fail if there are collections in the schema tables

Fix and new testcase

Patch by tjake; reviewed by Aleksey Yeschenko for CASSANDRA-10700


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

Branch: refs/heads/cassandra-2.2
Commit: 994250c8d38b3b4299f2e33ebe405ff601b5ae85
Parents: cee35e4
Author: T Jake Luciani 
Authored: Mon Dec 14 11:40:53 2015 -0500
Committer: T Jake Luciani 
Committed: Tue Dec 15 14:15:12 2015 -0500

--
 CHANGES.txt |   4 +
 .../org/apache/cassandra/tools/BulkLoader.java  |  31 +++-
 .../apache/cassandra/tools/BulkLoaderTest.java  | 172 +++
 3 files changed, 202 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 7f1d66b..8e58703 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,12 @@
 2.1.13
+<<< HEAD
  * Allow CREATE TABLE WITH ID (CASSANDRA-9179)
  * Make Stress compiles within eclipse (CASSANDRA-10807)
  * Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
  * Allow cancellation of index summary redistribution (CASSANDRA-8805)
+===
+ * sstableloader will fail if there are collections in the schema tables 
(CASSANDRA-10700)
+>>> 5377183... stableloader will fail if there are collections in the 
schema tables
  * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
  * Fix Stress profile parsing on Windows (CASSANDRA-10808)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/src/java/org/apache/cassandra/tools/BulkLoader.java
--
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java 
b/src/java/org/apache/cassandra/tools/BulkLoader.java
index f4b30cb..96e826d 100644
--- a/src/java/org/apache/cassandra/tools/BulkLoader.java
+++ b/src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -24,9 +24,10 @@ import java.util.*;
 import com.google.common.base.Joiner;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
 
 import org.apache.commons.cli.*;
+import org.apache.commons.lang3.StringUtils;
+
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TTransport;
@@ -310,10 +311,11 @@ public class BulkLoader
 }
 }
 
-String cfQuery = String.format("SELECT * FROM %s.%s WHERE 
keyspace_name = '%s'",
- Keyspace.SYSTEM_KS,
- 
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
- keyspace);
+String cfQuery = String.format("SELECT %s FROM %s.%s WHERE 
keyspace_name = '%s'",
+   
StringUtils.join(getCFColumnsWithoutCollections(), ","),
+   Keyspace.SYSTEM_KS,
+   
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+   keyspace);
 CqlResult cfRes = 
client.execute_cql3_query(ByteBufferUtil.bytes(cfQuery), Compression.NONE, 
ConsistencyLevel.ONE);
 
 
@@ -340,6 +342,25 @@ public class BulkLoader
 }
 }
 
+//Remove dropped_columns since we can't parse collections in v2 which 
is used by thrift
+//See CASSANDRA-10700
+List getCFColumnsWithoutCollections()
+{
+
+Iterator allColumns = 
CFMetaData.SchemaColumnFamiliesCf.allColumnsInSelectOrder();
+List selectedColumns = new ArrayList<>();
+
+while (allColumns.hasNext())
+{
+ColumnDefinition def = allColumns.next();
+
+if (!def.type.isCollection())
+
selectedColumns.add(UTF8Type.instance.getString(def.name.bytes));
+}
+
+return selectedColumns;
+}
+
 @Override
 public StreamConnectionFactory getConnectionFactory()
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/test/unit/org/apache/cassandra/tools/BulkLoaderTest.java
--
diff --git a/test/unit/org/apache/cassandra/tools/BulkLoaderTest.jav

cassandra git commit: stableloader will fail if there are collections in the schema tables

2015-12-15 Thread jake
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 cee35e42d -> 994250c8d


stableloader will fail if there are collections in the schema tables

Fix and new testcase

Patch by tjake; reviewed by Aleksey Yeschenko for CASSANDRA-10700


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

Branch: refs/heads/cassandra-2.1
Commit: 994250c8d38b3b4299f2e33ebe405ff601b5ae85
Parents: cee35e4
Author: T Jake Luciani 
Authored: Mon Dec 14 11:40:53 2015 -0500
Committer: T Jake Luciani 
Committed: Tue Dec 15 14:15:12 2015 -0500

--
 CHANGES.txt |   4 +
 .../org/apache/cassandra/tools/BulkLoader.java  |  31 +++-
 .../apache/cassandra/tools/BulkLoaderTest.java  | 172 +++
 3 files changed, 202 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 7f1d66b..8e58703 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,12 @@
 2.1.13
+<<< HEAD
  * Allow CREATE TABLE WITH ID (CASSANDRA-9179)
  * Make Stress compiles within eclipse (CASSANDRA-10807)
  * Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
  * Allow cancellation of index summary redistribution (CASSANDRA-8805)
+===
+ * sstableloader will fail if there are collections in the schema tables 
(CASSANDRA-10700)
+>>> 5377183... stableloader will fail if there are collections in the 
schema tables
  * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
  * Fix Stress profile parsing on Windows (CASSANDRA-10808)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/src/java/org/apache/cassandra/tools/BulkLoader.java
--
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java 
b/src/java/org/apache/cassandra/tools/BulkLoader.java
index f4b30cb..96e826d 100644
--- a/src/java/org/apache/cassandra/tools/BulkLoader.java
+++ b/src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -24,9 +24,10 @@ import java.util.*;
 import com.google.common.base.Joiner;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
 
 import org.apache.commons.cli.*;
+import org.apache.commons.lang3.StringUtils;
+
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TTransport;
@@ -310,10 +311,11 @@ public class BulkLoader
 }
 }
 
-String cfQuery = String.format("SELECT * FROM %s.%s WHERE 
keyspace_name = '%s'",
- Keyspace.SYSTEM_KS,
- 
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
- keyspace);
+String cfQuery = String.format("SELECT %s FROM %s.%s WHERE 
keyspace_name = '%s'",
+   
StringUtils.join(getCFColumnsWithoutCollections(), ","),
+   Keyspace.SYSTEM_KS,
+   
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+   keyspace);
 CqlResult cfRes = 
client.execute_cql3_query(ByteBufferUtil.bytes(cfQuery), Compression.NONE, 
ConsistencyLevel.ONE);
 
 
@@ -340,6 +342,25 @@ public class BulkLoader
 }
 }
 
+//Remove dropped_columns since we can't parse collections in v2 which 
is used by thrift
+//See CASSANDRA-10700
+List getCFColumnsWithoutCollections()
+{
+
+Iterator allColumns = 
CFMetaData.SchemaColumnFamiliesCf.allColumnsInSelectOrder();
+List selectedColumns = new ArrayList<>();
+
+while (allColumns.hasNext())
+{
+ColumnDefinition def = allColumns.next();
+
+if (!def.type.isCollection())
+
selectedColumns.add(UTF8Type.instance.getString(def.name.bytes));
+}
+
+return selectedColumns;
+}
+
 @Override
 public StreamConnectionFactory getConnectionFactory()
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/994250c8/test/unit/org/apache/cassandra/tools/BulkLoaderTest.java
--
diff --git a/test/unit/org/apache/cassandra/tools/BulkLoaderTest.jav