cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [5/5] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Tue, 10 Nov 2015 13:46:34 GMT
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/1e64a9d0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1e64a9d0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1e64a9d0

Branch: refs/heads/cassandra-3.0
Commit: 1e64a9d0369e07a195c6267d14438337773d9248
Parents: b408f9e ef0e447
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Tue Nov 10 13:45:11 2015 +0000
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Nov 10 13:46:21 2015 +0000

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +-
 .../cassandra/io/sstable/CQLSSTableWriter.java  |  2 ++
 .../io/sstable/CQLSSTableWriterTest.java        | 22 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e64a9d0/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index a1f66fa,5edad20..33adefb
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,51 -1,16 +1,51 @@@
 -2.2.4
 +3.0.1
 +Merged from 2.1:
++ * Reject counter writes in CQLSSTableWriter (CASSANDRA-10258)
 + * Remove superfluous COUNTER_MUTATION stage mapping (CASSANDRA-10605)
 +
 +
 +3.0
 + * Fix AssertionError while flushing memtable due to materialized views
 +   incorrectly inserting empty rows (CASSANDRA-10614)
 + * Store UDA initcond as CQL literal in the schema table, instead of a blob (CASSANDRA-10650)
 + * Don't use -1 for the position of partition key in schema (CASSANDRA-10491)
 + * Fix distinct queries in mixed version cluster (CASSANDRA-10573)
 + * Skip sstable on clustering in names query (CASSANDRA-10571)
 + * Remove value skipping as it breaks read-repair (CASSANDRA-10655)
 + * Fix bootstrapping with MVs (CASSANDRA-10621)
 + * Make sure EACH_QUORUM reads are using NTS (CASSANDRA-10584)
 + * Fix MV replica filtering for non-NetworkTopologyStrategy (CASSANDRA-10634)
 + * (Hadoop) fix CIF describeSplits() not handling 0 size estimates (CASSANDRA-10600)
 + * Fix reading of legacy sstables (CASSANDRA-10590)
 + * Use CQL type names in schema metadata tables (CASSANDRA-10365)
 + * Guard batchlog replay against integer division by zero (CASSANDRA-9223)
 + * Fix bug when adding a column to thrift with the same name than a primary key (CASSANDRA-10608)
 + * Add client address argument to IAuthenticator::newSaslNegotiator (CASSANDRA-8068)
 + * Fix implementation of LegacyLayout.LegacyBoundComparator (CASSANDRA-10602)
 + * Don't use 'names query' read path for counters (CASSANDRA-10572)
 + * Fix backward compatibility for counters (CASSANDRA-10470)
 + * Remove memory_allocator paramter from cassandra.yaml (CASSANDRA-10581,10628)
 + * Execute the metadata reload task of all registered indexes on CFS::reload (CASSANDRA-10604)
 + * Fix thrift cas operations with defined columns (CASSANDRA-10576)
 + * Fix PartitionUpdate.operationCount()for updates with static column operations (CASSANDRA-10606)
 + * Fix thrift get() queries with defined columns (CASSANDRA-10586)
 + * Fix marking of indexes as built and removed (CASSANDRA-10601)
 + * Skip initialization of non-registered 2i instances, remove Index::getIndexName (CASSANDRA-10595)
 + * Fix batches on multiple tables (CASSANDRA-10554)
 + * Ensure compaction options are validated when updating KeyspaceMetadata (CASSANDRA-10569)
 + * Flatten Iterator Transformation Hierarchy (CASSANDRA-9975)
 + * Remove token generator (CASSANDRA-5261)
 + * RolesCache should not be created for any authenticator that does not requireAuthentication
(CASSANDRA-10562)
 + * Fix LogTransaction checking only a single directory for files (CASSANDRA-10421)
 + * Fix handling of range tombstones when reading old format sstables (CASSANDRA-10360)
 + * Aggregate with Initial Condition fails with C* 3.0 (CASSANDRA-10367)
 +Merged from 2.2:
   * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
   * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
   * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)
   * Expose phi values from failure detector via JMX and tweak debug
     and trace logging (CASSANDRA-9526)
 - * Fix RangeNamesQueryPager (CASSANDRA-10509)
 - * Deprecate Pig support (CASSANDRA-10542)
 - * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
  Merged from 2.1:
 - * Reject counter writes in CQLSSTableWriter (CASSANDRA-10258)
-- * Remove superfluous COUNTER_MUTATION stage mapping (CASSANDRA-10605)
 - * Improve json2sstable error reporting on nonexistent columns (CASSANDRA-10401)
   * (cqlsh) fix COPY using wrong variable name for time_format (CASSANDRA-10633)
   * Do not run SizeEstimatesRecorder if a node is not a member of the ring (CASSANDRA-9912)
   * Improve handling of dead nodes in gossip (CASSANDRA-10298)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e64a9d0/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e64a9d0/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index e7cf51c,8a14428..602a108
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@@ -65,81 -66,100 +65,103 @@@ public class CQLSSTableWriterTes
      @Test
      public void testUnsortedWriter() throws Exception
      {
 -        String KS = "cql_keyspace";
 -        String TABLE = "table1";
 -
 -        File tempdir = Files.createTempDir();
 -        File dataDir = new File(tempdir.getAbsolutePath() + File.separator + KS + File.separator
+ TABLE);
 -        assert dataDir.mkdirs();
 -
 -        String schema = "CREATE TABLE cql_keyspace.table1 ("
 -                      + "  k int PRIMARY KEY,"
 -                      + "  v1 text,"
 -                      + "  v2 int"
 -                      + ")";
 -        String insert = "INSERT INTO cql_keyspace.table1 (k, v1, v2) VALUES (?, ?, ?)";
 -        CQLSSTableWriter writer = CQLSSTableWriter.builder()
 -                                                  .inDirectory(dataDir)
 -                                                  .forTable(schema)
 -                                                  .withPartitioner(StorageService.getPartitioner())
 -                                                  .using(insert).build();
 +        try (AutoCloseable switcher = Util.switchPartitioner(ByteOrderedPartitioner.instance))
 +        {
 +            String KS = "cql_keyspace";
 +            String TABLE = "table1";
 +
 +            File tempdir = Files.createTempDir();
 +            File dataDir = new File(tempdir.getAbsolutePath() + File.separator + KS + File.separator
+ TABLE);
 +            assert dataDir.mkdirs();
 +
 +            String schema = "CREATE TABLE cql_keyspace.table1 ("
 +                          + "  k int PRIMARY KEY,"
 +                          + "  v1 text,"
 +                          + "  v2 int"
 +                          + ")";
 +            String insert = "INSERT INTO cql_keyspace.table1 (k, v1, v2) VALUES (?, ?, ?)";
 +            CQLSSTableWriter writer = CQLSSTableWriter.builder()
 +                                                      .inDirectory(dataDir)
 +                                                      .forTable(schema)
 +                                                      .using(insert).build();
  
 -        writer.addRow(0, "test1", 24);
 -        writer.addRow(1, "test2", null);
 -        writer.addRow(2, "test3", 42);
 -        writer.addRow(ImmutableMap.<String, Object>of("k", 3, "v2", 12));
 -        writer.close();
 +            writer.addRow(0, "test1", 24);
 +            writer.addRow(1, "test2", 44);
 +            writer.addRow(2, "test3", 42);
 +            writer.addRow(ImmutableMap.<String, Object>of("k", 3, "v2", 12));
  
 -        SSTableLoader loader = new SSTableLoader(dataDir, new SSTableLoader.Client()
 -        {
 -            private String keyspace;
 +            writer.close();
  
 -            public void init(String keyspace)
 +            SSTableLoader loader = new SSTableLoader(dataDir, new SSTableLoader.Client()
              {
 -                this.keyspace = keyspace;
 -                for (Range<Token> range : StorageService.instance.getLocalRanges("cql_keyspace"))
 -                    addRangeForEndpoint(range, FBUtilities.getBroadcastAddress());
 -                setPartitioner(StorageService.getPartitioner());
 -            }
 +                private String keyspace;
  
 -            public CFMetaData getTableMetadata(String tableName)
 -            {
 -                return Schema.instance.getCFMetaData(keyspace, tableName);
 -            }
 -        }, new OutputHandler.SystemOutput(false, false));
 +                public void init(String keyspace)
 +                {
 +                    this.keyspace = keyspace;
 +                    for (Range<Token> range : StorageService.instance.getLocalRanges("cql_keyspace"))
 +                        addRangeForEndpoint(range, FBUtilities.getBroadcastAddress());
 +                }
  
 -        loader.stream().get();
 +                public CFMetaData getTableMetadata(String cfName)
 +                {
 +                    return Schema.instance.getCFMetaData(keyspace, cfName);
 +                }
 +            }, new OutputHandler.SystemOutput(false, false));
 +
 +            loader.stream().get();
  
 -        UntypedResultSet rs = QueryProcessor.executeInternal("SELECT * FROM cql_keyspace.table1;");
 -        assertEquals(4, rs.size());
 +            UntypedResultSet rs = QueryProcessor.executeInternal("SELECT * FROM cql_keyspace.table1;");
 +            assertEquals(4, rs.size());
  
 -        Iterator<UntypedResultSet.Row> iter = rs.iterator();
 -        UntypedResultSet.Row row;
 +            Iterator<UntypedResultSet.Row> iter = rs.iterator();
 +            UntypedResultSet.Row row;
  
 -        row = iter.next();
 -        assertEquals(0, row.getInt("k"));
 -        assertEquals("test1", row.getString("v1"));
 -        assertEquals(24, row.getInt("v2"));
 +            row = iter.next();
 +            assertEquals(0, row.getInt("k"));
 +            assertEquals("test1", row.getString("v1"));
 +            assertEquals(24, row.getInt("v2"));
  
 -        row = iter.next();
 -        assertEquals(1, row.getInt("k"));
 -        assertEquals("test2", row.getString("v1"));
 -        assertFalse(row.has("v2"));
 +            row = iter.next();
 +            assertEquals(1, row.getInt("k"));
 +            assertEquals("test2", row.getString("v1"));
 +            //assertFalse(row.has("v2"));
 +            assertEquals(44, row.getInt("v2"));
  
 -        row = iter.next();
 -        assertEquals(2, row.getInt("k"));
 -        assertEquals("test3", row.getString("v1"));
 -        assertEquals(42, row.getInt("v2"));
 +            row = iter.next();
 +            assertEquals(2, row.getInt("k"));
 +            assertEquals("test3", row.getString("v1"));
 +            assertEquals(42, row.getInt("v2"));
  
 -        row = iter.next();
 -        assertEquals(3, row.getInt("k"));
 -        assertEquals(null, row.getBytes("v1")); // Using getBytes because we know it won't
NPE
 -        assertEquals(12, row.getInt("v2"));
 +            row = iter.next();
 +            assertEquals(3, row.getInt("k"));
 +            assertEquals(null, row.getBytes("v1")); // Using getBytes because we know it
won't NPE
 +            assertEquals(12, row.getInt("v2"));
 +        }
      }
  
+     @Test(expected = IllegalArgumentException.class)
+     public void testForbidCounterUpdates() throws Exception
+     {
+         String KS = "cql_keyspace";
+         String TABLE = "counter1";
+ 
+         File tempdir = Files.createTempDir();
+         File dataDir = new File(tempdir.getAbsolutePath() + File.separator + KS + File.separator
+ TABLE);
+         assert dataDir.mkdirs();
+ 
+         String schema = "CREATE TABLE cql_keyspace.counter1 (" +
+                         "  my_id int, " +
+                         "  my_counter counter, " +
+                         "  PRIMARY KEY (my_id)" +
+                         ")";
+         String insert = String.format("UPDATE cql_keyspace.counter1 SET my_counter = my_counter
- ? WHERE my_id = ?");
+         CQLSSTableWriter.builder().inDirectory(dataDir)
+                         .forTable(schema)
+                         .withPartitioner(StorageService.instance.getPartitioner())
+                         .using(insert).build();
+     }
+ 
      @Test
      public void testSyncWithinPartition() throws Exception
      {


Mime
View raw message