You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2015/04/15 17:23:35 UTC
[1/6] cassandra git commit: CQLSSTableWriter causes
ArrayIndexOutOfBoundsException
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 730d4d4c4 -> 7b5021324
CQLSSTableWriter causes ArrayIndexOutOfBoundsException
patch by carlyeks; reviewed by blerer for CASSANDRA-8978
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b4c1ef92
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b4c1ef92
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b4c1ef92
Branch: refs/heads/cassandra-2.1
Commit: b4c1ef92e103d58dcddbae9a9d3885e870676844
Parents: 84b2846
Author: Carl Yeksigian <ca...@apache.org>
Authored: Wed Apr 15 10:05:32 2015 -0500
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Apr 15 10:08:12 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../io/sstable/AbstractSSTableSimpleWriter.java | 9 +++++++
.../cassandra/io/sstable/CQLSSTableWriter.java | 26 +++++++++++++++++++-
.../io/sstable/SSTableSimpleUnsortedWriter.java | 10 ++++++--
.../io/sstable/CQLSSTableWriterTest.java | 12 +++++----
5 files changed, 50 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b4c1ef92/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 460b07c..a492c74 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.15:
+ * Fix ArrayIndexOutOfBoundsException in CQLSSTableWriter (CASSANDRA-8978)
* Add shutdown gossip state to prevent timeouts during rolling restarts (CASSANDRA-8336)
* Fix running with java.net.preferIPv6Addresses=true (CASSANDRA-9137)
* Fix failed bootstrap/replace attempts being persisted in system.peers (CASSANDRA-9180)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b4c1ef92/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java b/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
index af1c43c..d089770 100644
--- a/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
@@ -187,6 +187,15 @@ public abstract class AbstractSSTableSimpleWriter implements Closeable
return currentKey;
}
+ /**
+ * Package protected for use by AbstractCQLSSTableWriter.
+ * Not meant to be exposed publicly.
+ */
+ boolean shouldStartNewRow() throws IOException
+ {
+ return currentKey == null;
+ }
+
protected abstract void writeRow(DecoratedKey key, ColumnFamily columnFamily) throws IOException;
protected abstract ColumnFamily getColumnFamily() throws IOException;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b4c1ef92/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
index fb4c186..84b2863 100644
--- a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
@@ -218,7 +218,7 @@ public class CQLSSTableWriter implements Closeable
{
for (ByteBuffer key: keys)
{
- if (writer.currentKey() == null || !key.equals(writer.currentKey().key))
+ if (writer.shouldStartNewRow() || !key.equals(writer.currentKey().key))
writer.newRow(key);
insert.addUpdateForKey(writer.currentColumnFamily(), key, clusteringPrefix, params, false);
}
@@ -532,6 +532,8 @@ public class CQLSSTableWriter implements Closeable
*/
private static class BufferedWriter extends SSTableSimpleUnsortedWriter
{
+ private boolean needsSync = false;
+
public BufferedWriter(File directory, CFMetaData metadata, IPartitioner partitioner, long bufferSizeInMB)
{
super(directory, metadata, partitioner, bufferSizeInMB);
@@ -560,6 +562,28 @@ public class CQLSSTableWriter implements Closeable
};
}
+ @Override
+ protected void replaceColumnFamily() throws IOException
+ {
+ needsSync = true;
+ }
+
+ @Override
+ /**
+ * If we have marked that the column family is being replaced, when we start the next row,
+ * we should sync out the previous partition and create a new row based on the current value.
+ */
+ boolean shouldStartNewRow() throws IOException
+ {
+ if (needsSync)
+ {
+ needsSync = false;
+ super.sync();
+ return true;
+ }
+ return super.shouldStartNewRow();
+ }
+
protected void addColumn(Column column) throws IOException
{
throw new UnsupportedOperationException();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b4c1ef92/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
index 5bddea3..955214d 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@ -119,7 +119,7 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
// We don't want to sync in writeRow() only as this might blow up the bufferSize for wide rows.
if (currentSize > bufferSize)
- sync();
+ replaceColumnFamily();
}
protected ColumnFamily getColumnFamily() throws IOException
@@ -159,7 +159,13 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
}
}
- private void sync() throws IOException
+ // This is overridden by CQLSSTableWriter to hold off replacing column family until the next iteration through
+ protected void replaceColumnFamily() throws IOException
+ {
+ sync();
+ }
+
+ protected void sync() throws IOException
{
if (buffer.isEmpty())
return;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b4c1ef92/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index 0922502..94fe309 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -138,10 +138,12 @@ public class CQLSSTableWriterTest
// > 1MB and validate that this created more than 1 sstable.
File tempdir = Files.createTempDir();
String schema = "CREATE TABLE ks.test ("
- + " k int PRIMARY KEY,"
- + " v blob"
+ + " k int,"
+ + " c int,"
+ + " v blob,"
+ + " PRIMARY KEY (k,c)"
+ ")";
- String insert = "INSERT INTO ks.test (k, v) VALUES (?, ?)";
+ String insert = "INSERT INTO ks.test (k, c, v) VALUES (?, ?, ?)";
CQLSSTableWriter writer = CQLSSTableWriter.builder()
.inDirectory(tempdir)
.forTable(schema)
@@ -152,8 +154,8 @@ public class CQLSSTableWriterTest
ByteBuffer val = ByteBuffer.allocate(1024 * 1050);
- writer.addRow(0, val);
- writer.addRow(1, val);
+ writer.addRow(0, 0, val);
+ writer.addRow(0, 1, val);
writer.close();
FilenameFilter filterDataFiles = new FilenameFilter()
[2/6] cassandra git commit: change list to arraylist
Posted by sl...@apache.org.
change list to arraylist
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/543a8990
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/543a8990
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/543a8990
Branch: refs/heads/cassandra-2.1
Commit: 543a89909be849c4ff1ca38d435a246d87be2c50
Parents: b4c1ef9
Author: Brandon Williams <br...@apache.org>
Authored: Wed Apr 15 10:11:52 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Wed Apr 15 10:12:20 2015 -0500
----------------------------------------------------------------------
src/java/org/apache/cassandra/gms/Gossiper.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/543a8990/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 85d79c0..c7c4af8 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -71,8 +71,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
static final ApplicationState[] STATES = ApplicationState.values();
static final List<String> DEAD_STATES = Arrays.asList(VersionedValue.REMOVING_TOKEN, VersionedValue.REMOVED_TOKEN,
VersionedValue.STATUS_LEFT, VersionedValue.HIBERNATE);
- static List<String> SILENT_SHUTDOWN_STATES = DEAD_STATES;
+ static ArrayList<String> SILENT_SHUTDOWN_STATES;
static {
+ SILENT_SHUTDOWN_STATES.addAll(DEAD_STATES);
SILENT_SHUTDOWN_STATES.add(VersionedValue.STATUS_BOOTSTRAPPING);
}
[3/6] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/75c5f0d1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/75c5f0d1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/75c5f0d1
Branch: refs/heads/cassandra-2.1
Commit: 75c5f0d11d1809c5754c74c00872d7be77c94f51
Parents: f7884c5 b4c1ef9
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Apr 15 10:13:38 2015 -0500
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Apr 15 10:13:38 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../io/sstable/AbstractSSTableSimpleWriter.java | 9 +++++++
.../cassandra/io/sstable/CQLSSTableWriter.java | 26 +++++++++++++++++++-
.../io/sstable/SSTableSimpleUnsortedWriter.java | 10 ++++++--
.../io/sstable/CQLSSTableWriterTest.java | 12 +++++----
5 files changed, 50 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/75c5f0d1/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index f17d7e3,a492c74..8872f62
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,82 -1,5 +1,83 @@@
-2.0.15:
+2.1.5
+ * Don't check other keyspaces for schema changes when an user-defined
+ type is altered (CASSANDRA-9187)
+ * Allow takeColumnFamilySnapshot to take a list of tables (CASSANDRA-8348)
+ * Limit major sstable operations to their canonical representation (CASSANDRA-8669)
+ * cqlsh: Add tests for INSERT and UPDATE tab completion (CASSANDRA-9125)
+ * cqlsh: quote column names when needed in COPY FROM inserts (CASSANDRA-9080)
+ * Add generate-idea-files target to build.xml (CASSANDRA-9123)
+ * Do not load read meter for offline operations (CASSANDRA-9082)
+ * cqlsh: Make CompositeType data readable (CASSANDRA-8919)
+ * cqlsh: Fix display of triggers (CASSANDRA-9081)
+ * Fix NullPointerException when deleting or setting an element by index on
+ a null list collection (CASSANDRA-9077)
+ * Buffer bloom filter serialization (CASSANDRA-9066)
+ * Fix anti-compaction target bloom filter size (CASSANDRA-9060)
+ * Make FROZEN and TUPLE unreserved keywords in CQL (CASSANDRA-9047)
+ * Prevent AssertionError from SizeEstimatesRecorder (CASSANDRA-9034)
+ * Avoid overwriting index summaries for sstables with an older format that
+ does not support downsampling; rebuild summaries on startup when this
+ is detected (CASSANDRA-8993)
+ * Fix potential data loss in CompressedSequentialWriter (CASSANDRA-8949)
+ * Make PasswordAuthenticator number of hashing rounds configurable (CASSANDRA-8085)
+ * Fix AssertionError when binding nested collections in DELETE (CASSANDRA-8900)
+ * Check for overlap with non-early sstables in LCS (CASSANDRA-8739)
+ * Only calculate max purgable timestamp if we have to (CASSANDRA-8914)
+ * (cqlsh) Greatly improve performance of COPY FROM (CASSANDRA-8225)
+ * IndexSummary effectiveIndexInterval is now a guideline, not a rule (CASSANDRA-8993)
+ * Use correct bounds for page cache eviction of compressed files (CASSANDRA-8746)
+ * SSTableScanner enforces its bounds (CASSANDRA-8946)
+ * Cleanup cell equality (CASSANDRA-8947)
+ * Introduce intra-cluster message coalescing (CASSANDRA-8692)
+ * DatabaseDescriptor throws NPE when rpc_interface is used (CASSANDRA-8839)
+ * Don't check if an sstable is live for offline compactions (CASSANDRA-8841)
+ * Don't set clientMode in SSTableLoader (CASSANDRA-8238)
+ * Fix SSTableRewriter with disabled early open (CASSANDRA-8535)
+ * Allow invalidating permissions and cache time (CASSANDRA-8722)
+ * Log warning when queries that will require ALLOW FILTERING in Cassandra 3.0
+ are executed (CASSANDRA-8418)
+ * Fix cassandra-stress so it respects the CL passed in user mode (CASSANDRA-8948)
+ * Fix rare NPE in ColumnDefinition#hasIndexOption() (CASSANDRA-8786)
+ * cassandra-stress reports per-operation statistics, plus misc (CASSANDRA-8769)
+ * Add SimpleDate (cql date) and Time (cql time) types (CASSANDRA-7523)
+ * Use long for key count in cfstats (CASSANDRA-8913)
+ * Make SSTableRewriter.abort() more robust to failure (CASSANDRA-8832)
+ * Remove cold_reads_to_omit from STCS (CASSANDRA-8860)
+ * Make EstimatedHistogram#percentile() use ceil instead of floor (CASSANDRA-8883)
+ * Fix top partitions reporting wrong cardinality (CASSANDRA-8834)
+ * Fix rare NPE in KeyCacheSerializer (CASSANDRA-8067)
+ * Pick sstables for validation as late as possible inc repairs (CASSANDRA-8366)
+ * Fix commitlog getPendingTasks to not increment (CASSANDRA-8856)
+ * Fix parallelism adjustment in range and secondary index queries
+ when the first fetch does not satisfy the limit (CASSANDRA-8856)
+ * Check if the filtered sstables is non-empty in STCS (CASSANDRA-8843)
+ * Upgrade java-driver used for cassandra-stress (CASSANDRA-8842)
+ * Fix CommitLog.forceRecycleAllSegments() memory access error (CASSANDRA-8812)
+ * Improve assertions in Memory (CASSANDRA-8792)
+ * Fix SSTableRewriter cleanup (CASSANDRA-8802)
+ * Introduce SafeMemory for CompressionMetadata.Writer (CASSANDRA-8758)
+ * 'nodetool info' prints exception against older node (CASSANDRA-8796)
+ * Ensure SSTableReader.last corresponds exactly with the file end (CASSANDRA-8750)
+ * Make SSTableWriter.openEarly more robust and obvious (CASSANDRA-8747)
+ * Enforce SSTableReader.first/last (CASSANDRA-8744)
+ * Cleanup SegmentedFile API (CASSANDRA-8749)
+ * Avoid overlap with early compaction replacement (CASSANDRA-8683)
+ * Safer Resource Management++ (CASSANDRA-8707)
+ * Write partition size estimates into a system table (CASSANDRA-7688)
+ * cqlsh: Fix keys() and full() collection indexes in DESCRIBE output
+ (CASSANDRA-8154)
+ * Show progress of streaming in nodetool netstats (CASSANDRA-8886)
+ * IndexSummaryBuilder utilises offheap memory, and shares data between
+ each IndexSummary opened from it (CASSANDRA-8757)
+ * markCompacting only succeeds if the exact SSTableReader instances being
+ marked are in the live set (CASSANDRA-8689)
+ * cassandra-stress support for varint (CASSANDRA-8882)
+ * Fix Adler32 digest for compressed sstables (CASSANDRA-8778)
+ * Add nodetool statushandoff/statusbackup (CASSANDRA-8912)
+ * Use stdout for progress and stats in sstableloader (CASSANDRA-8982)
+ * Correctly identify 2i datadir from older versions (CASSANDRA-9116)
+Merged from 2.0:
+ * Fix ArrayIndexOutOfBoundsException in CQLSSTableWriter (CASSANDRA-8978)
* Add shutdown gossip state to prevent timeouts during rolling restarts (CASSANDRA-8336)
* Fix running with java.net.preferIPv6Addresses=true (CASSANDRA-9137)
* Fix failed bootstrap/replace attempts being persisted in system.peers (CASSANDRA-9180)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/75c5f0d1/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/75c5f0d1/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
index 6a4ea04,84b2863..b211a90
--- a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
@@@ -217,9 -216,9 +217,9 @@@ public class CQLSSTableWriter implement
try
{
- for (ByteBuffer key: keys)
+ for (ByteBuffer key : keys)
{
- if (writer.currentKey() == null || !key.equals(writer.currentKey().getKey()))
- if (writer.shouldStartNewRow() || !key.equals(writer.currentKey().key))
++ if (writer.shouldStartNewRow() || !key.equals(writer.currentKey().getKey()))
writer.newRow(key);
insert.addUpdateForKey(writer.currentColumnFamily(), key, clusteringPrefix, params, false);
}
@@@ -560,7 -562,29 +562,29 @@@
};
}
+ @Override
+ protected void replaceColumnFamily() throws IOException
+ {
+ needsSync = true;
+ }
+
- @Override
+ /**
+ * If we have marked that the column family is being replaced, when we start the next row,
+ * we should sync out the previous partition and create a new row based on the current value.
+ */
++ @Override
+ boolean shouldStartNewRow() throws IOException
+ {
+ if (needsSync)
+ {
+ needsSync = false;
+ super.sync();
+ return true;
+ }
+ return super.shouldStartNewRow();
+ }
+
- protected void addColumn(Column column) throws IOException
+ protected void addColumn(Cell cell) throws IOException
{
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/75c5f0d1/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/75c5f0d1/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
[6/6] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7b502132
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7b502132
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7b502132
Branch: refs/heads/cassandra-2.1
Commit: 7b5021324541fecb16b294e0f81e2d5aa9c92906
Parents: 0c99b94 8e1bdf3
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Apr 15 10:21:59 2015 -0500
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Apr 15 10:21:59 2015 -0500
----------------------------------------------------------------------
.../io/sstable/CQLSSTableWriterLongTest.java | 106 +++++++++++++++++++
1 file changed, 106 insertions(+)
----------------------------------------------------------------------
[4/6] cassandra git commit: Add test for #8978
Posted by sl...@apache.org.
Add test for #8978
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8e1bdf3e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8e1bdf3e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8e1bdf3e
Branch: refs/heads/cassandra-2.1
Commit: 8e1bdf3e8eedc33045ca577b0e5a69446429353c
Parents: 543a899
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Apr 15 10:14:19 2015 -0500
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Apr 15 10:19:30 2015 -0500
----------------------------------------------------------------------
.../io/sstable/CQLSSTableWriterLongTest.java | 106 +++++++++++++++++++
1 file changed, 106 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e1bdf3e/test/long/org/apache/cassandra/io/sstable/CQLSSTableWriterLongTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/io/sstable/CQLSSTableWriterLongTest.java b/test/long/org/apache/cassandra/io/sstable/CQLSSTableWriterLongTest.java
new file mode 100644
index 0000000..77d319d
--- /dev/null
+++ b/test/long/org/apache/cassandra/io/sstable/CQLSSTableWriterLongTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.io.sstable;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import com.google.common.io.Files;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.Config;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.service.StorageService;
+
+public class CQLSSTableWriterLongTest
+{
+ @BeforeClass
+ public static void setup() throws Exception
+ {
+ StorageService.instance.initServer();
+ }
+
+ @AfterClass
+ public static void tearDown()
+ {
+ Config.setClientMode(false);
+ }
+
+ @Test
+ public void testWideRow() throws Exception
+ {
+ String KS = "cql_keyspace";
+ String TABLE = "table1";
+ int size = 30000;
+
+ File tempdir = Files.createTempDir();
+ File dataDir = new File(tempdir.getAbsolutePath() + File.separator + KS + File.separator + TABLE);
+ assert dataDir.mkdirs();
+
+ StringBuilder schemaColumns = new StringBuilder();
+ StringBuilder queryColumns = new StringBuilder();
+ StringBuilder queryValues = new StringBuilder();
+ for (int i = 0; i < size; i++)
+ {
+ schemaColumns.append("v");
+ schemaColumns.append(i);
+ schemaColumns.append(" int,");
+
+ queryColumns.append(", v");
+ queryColumns.append(i);
+
+ queryValues.append(", ?");
+ }
+ String schema = "CREATE TABLE cql_keyspace.table1 ("
+ + " k int,"
+ + " c int,"
+ + schemaColumns.toString()
+ + " PRIMARY KEY (k, c)"
+ + ")";
+ String insert = "INSERT INTO cql_keyspace.table1 (k, c" + queryColumns.toString() + ") VALUES (?, ?" + queryValues.toString() + ")";
+
+ CQLSSTableWriter writer = CQLSSTableWriter.builder()
+ .inDirectory(dataDir)
+ .forTable(schema)
+ .withPartitioner(StorageService.instance.getPartitioner())
+ .using(insert)
+ .withBufferSizeInMB(1)
+ .build();
+
+ long high = 100;
+ Random r = new Random(0);
+ for (int i = 0; i < high; i++)
+ {
+ List<Object> values = new ArrayList<>(size + 2);
+ values.add(0);
+ values.add(r.nextInt());
+ for (int j = 0; j < size; j++)
+ {
+ values.add(i);
+ }
+ writer.addRow(values);
+ }
+ writer.close();
+ }
+}
[5/6] cassandra git commit: Merge branch 'cassandra-2.1' of
http://git-wip-us.apache.org/repos/asf/cassandra into cassandra-2.1
Posted by sl...@apache.org.
Merge branch 'cassandra-2.1' of http://git-wip-us.apache.org/repos/asf/cassandra into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0c99b949
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0c99b949
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0c99b949
Branch: refs/heads/cassandra-2.1
Commit: 0c99b9493613b313cf122fe1576a0aee07a1707b
Parents: 75c5f0d 730d4d4
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Apr 15 10:21:41 2015 -0500
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Apr 15 10:21:41 2015 -0500
----------------------------------------------------------------------
src/java/org/apache/cassandra/gms/Gossiper.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------