You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/11/04 15:42:28 UTC

[1/4] git commit: Fix default timestamp in QueryOptions

Repository: cassandra
Updated Branches:
  refs/heads/trunk 071b8e391 -> ee85a31f6


Fix default timestamp in QueryOptions

patch by beobal; reviewed by slebresne for CASSANDRA-8246


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

Branch: refs/heads/trunk
Commit: e95e569c248f5f08702ca06a338f5f92975d3077
Parents: a8072ae
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Tue Nov 4 09:47:28 2014 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Nov 4 09:48:24 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/cql3/QueryOptions.java |  2 +-
 .../cassandra/cql3/NonNativeTimestampTest.java  | 86 ++++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e95e569c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b1a8439..8dd2613 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.2
+ * Fix default timestamp in QueryOptions (CASSANDRA-8246)
  * Set socket timeout when reading remote version (CASSANDRA-8188)
  * Refactor how we track live size (CASSANDRA-7852)
  * Make sure unfinished compaction files are removed (CASSANDRA-8124)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e95e569c/src/java/org/apache/cassandra/cql3/QueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryOptions.java b/src/java/org/apache/cassandra/cql3/QueryOptions.java
index 5431a42..b2569e7 100644
--- a/src/java/org/apache/cassandra/cql3/QueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/QueryOptions.java
@@ -242,7 +242,7 @@ public abstract class QueryOptions
     // Options that are likely to not be present in most queries
     static class SpecificOptions
     {
-        private static final SpecificOptions DEFAULT = new SpecificOptions(-1, null, null, -1L);
+        private static final SpecificOptions DEFAULT = new SpecificOptions(-1, null, null, Long.MIN_VALUE);
 
         private final int pageSize;
         private final PagingState state;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e95e569c/test/unit/org/apache/cassandra/cql3/NonNativeTimestampTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/NonNativeTimestampTest.java b/test/unit/org/apache/cassandra/cql3/NonNativeTimestampTest.java
new file mode 100644
index 0000000..8e3fbed
--- /dev/null
+++ b/test/unit/org/apache/cassandra/cql3/NonNativeTimestampTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.cql3;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.Schema;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.exceptions.RequestExecutionException;
+import org.apache.cassandra.exceptions.RequestValidationException;
+import org.apache.cassandra.service.EmbeddedCassandraService;
+import org.apache.cassandra.service.QueryState;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class NonNativeTimestampTest extends SchemaLoader
+{
+    @BeforeClass
+    public static void setup() throws Exception
+    {
+        Schema.instance.clear();
+        EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
+        cassandra.start();
+    }
+
+    @Test
+    public void setServerTimestampForNonCqlNativeStatements() throws RequestValidationException, RequestExecutionException, CharacterCodingException, UnsupportedEncodingException
+    {
+        String createKsCQL = "CREATE KEYSPACE non_native_ts_test" +
+                             " WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
+        String createTableCQL = "CREATE TABLE non_native_ts_test.table_0 (k int PRIMARY KEY, v int)";
+        String insertCQL = "INSERT INTO non_native_ts_test.table_0 (k, v) values (1, ?)";
+        String selectCQL = "SELECT v, writetime(v) AS wt FROM non_native_ts_test.table_0 WHERE k = 1";
+
+        QueryProcessor.instance.process(createKsCQL,
+                                        QueryState.forInternalCalls(),
+                                        QueryOptions.forInternalCalls(Collections.<ByteBuffer>emptyList()));
+        QueryProcessor.instance.process(createTableCQL,
+                                        QueryState.forInternalCalls(),
+                                        QueryOptions.forInternalCalls(Collections.<ByteBuffer>emptyList()));
+        QueryProcessor.instance.process(insertCQL,
+                                        QueryState.forInternalCalls(),
+                                        QueryOptions.forInternalCalls(ConsistencyLevel.ONE,
+                                                                      Arrays.asList(ByteBufferUtil.bytes(2))));
+        UntypedResultSet.Row row = QueryProcessor.instance.executeInternal(selectCQL).one();
+        assertEquals(2, row.getInt("v"));
+        long timestamp1 = row.getLong("wt");
+        assertFalse(timestamp1 == -1l);
+
+        // per CASSANDRA-8246 the two updates will have the same (incorrect)
+        // timestamp, so reconcilliation is by value and the "older" update wins
+        QueryProcessor.instance.process(insertCQL,
+                                        QueryState.forInternalCalls(),
+                                        QueryOptions.forInternalCalls(ConsistencyLevel.ONE,
+                                                                      Arrays.asList(ByteBufferUtil.bytes(1))));
+        row = QueryProcessor.executeInternal(selectCQL).one();
+        assertEquals(1, row.getInt("v"));
+        assertTrue(row.getLong("wt") > timestamp1);
+    }
+}


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

Posted by ja...@apache.org.
Merge branch 'cassandra-2.1' into trunk


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

Branch: refs/heads/trunk
Commit: ee85a31f6fe489b15a9e33d604329d6e7732416a
Parents: 071b8e3 0bc1ea3
Author: T Jake Luciani <ja...@apache.org>
Authored: Tue Nov 4 09:41:55 2014 -0500
Committer: T Jake Luciani <ja...@apache.org>
Committed: Tue Nov 4 09:41:55 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 build.xml                                       | 16 +++-
 .../org/apache/cassandra/cql3/QueryOptions.java |  2 +-
 .../cassandra/cql3/NonNativeTimestampTest.java  | 86 ++++++++++++++++++++
 4 files changed, 100 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ee85a31f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 52df09b,8dd2613..08f5cd0
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,37 -1,5 +1,38 @@@
 +3.0
 + * Mark sstables as repaired after full repair (CASSANDRA-7586) 
 + * Extend Descriptor to include a format value and refactor reader/writer apis (CASSANDRA-7443)
 + * Integrate JMH for microbenchmarks (CASSANDRA-8151)
 + * Keep sstable levels when bootstrapping (CASSANDRA-7460)
 + * Add Sigar library and perform basic OS settings check on startup (CASSANDRA-7838)
 + * Support for aggregation functions (CASSANDRA-4914)
 + * Remove cassandra-cli (CASSANDRA-7920)
 + * Accept dollar quoted strings in CQL (CASSANDRA-7769)
 + * Make assassinate a first class command (CASSANDRA-7935)
 + * Support IN clause on any clustering column (CASSANDRA-4762)
 + * Improve compaction logging (CASSANDRA-7818)
 + * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917)
 + * Do anticompaction in groups (CASSANDRA-6851)
 + * Support pure user-defined functions (CASSANDRA-7395, 7526, 7562, 7740, 7781, 7929,
 +   7924, 7812, 8063)
 + * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416)
 + * Move sstable RandomAccessReader to nio2, which allows using the
 +   FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050)
 + * Remove CQL2 (CASSANDRA-5918)
 + * Add Thrift get_multi_slice call (CASSANDRA-6757)
 + * Optimize fetching multiple cells by name (CASSANDRA-6933)
 + * Allow compilation in java 8 (CASSANDRA-7028)
 + * Make incremental repair default (CASSANDRA-7250)
 + * Enable code coverage thru JaCoCo (CASSANDRA-7226)
 + * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369) 
 + * Shorten SSTable path (CASSANDRA-6962)
 + * Use unsafe mutations for most unit tests (CASSANDRA-6969)
 + * Fix race condition during calculation of pending ranges (CASSANDRA-7390)
 + * Fail on very large batch sizes (CASSANDRA-8011)
 + * improve concurrency of repair (CASSANDRA-6455)
 +
 +
  2.1.2
+  * Fix default timestamp in QueryOptions (CASSANDRA-8246)
   * Set socket timeout when reading remote version (CASSANDRA-8188)
   * Refactor how we track live size (CASSANDRA-7852)
   * Make sure unfinished compaction files are removed (CASSANDRA-8124)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ee85a31f/build.xml
----------------------------------------------------------------------


[3/4] git commit: Attach existing sources to "Referenced libraries" in Eclipse

Posted by ja...@apache.org.
Attach existing sources to "Referenced libraries" in Eclipse

Patch by Mikhail Stepura; reviewed by tjake for CASSANDRA-8240


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

Branch: refs/heads/trunk
Commit: 0bc1ea385e739c4fdcb3d372b7863570d5b83f10
Parents: a6c58f8
Author: Mikhail Stepura <mi...@apache.org>
Authored: Sat Nov 1 10:19:50 2014 -0700
Committer: T Jake Luciani <ja...@apache.org>
Committed: Tue Nov 4 09:34:05 2014 -0500

----------------------------------------------------------------------
 build.xml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0bc1ea38/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 29e4121..e94ded8 100644
--- a/build.xml
+++ b/build.xml
@@ -1522,13 +1522,22 @@
   	 </fileset>
   	</path>
   	<property name="eclipse-project-libs" refid="eclipse-project-libs-path"/>
-  	<script language="javascript"> <![CDATA[
+  	<script language="javascript" classpathref="cassandra.classpath"> <![CDATA[
   		var File = java.io.File;
+  		var FilenameUtils = Packages.org.apache.commons.io.FilenameUtils;
   		jars = project.getProperty("eclipse-project-libs").split(project.getProperty("path.separator"));
   		
   		cp = "";
   	    for (i=0; i< jars.length; i++) {
-  	       cp += ' <classpathentry kind="lib" path="'+jars[i]+'"/>\n';
+  	       srcjar = FilenameUtils.getBaseName(jars[i]) + '-sources.jar';
+  		   srcdir = FilenameUtils.concat(project.getProperty("build.dir.lib"), 'sources');
+  		   srcfile = new File(FilenameUtils.concat(srcdir, srcjar));
+  		
+  		   cp += ' <classpathentry kind="lib" path="' + jars[i] + '"';
+  		   if (srcfile.exists()) {
+  		      cp += ' sourcepath="' + srcfile.getAbsolutePath() + '"';
+  		   }
+  		   cp += '/>\n';
   		}
   		
   		cp += '</classpath>';


[2/4] git commit: Don't compile Thrift sources in Eclipse, use classes for an ant build

Posted by ja...@apache.org.
Don't compile Thrift sources in Eclipse, use classes for an ant build

patch by Mikhail Stepura; reviewed by tjake for CASSANDRA-8250


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

Branch: refs/heads/trunk
Commit: a6c58f8b2f77c25cd29660422f85512707988560
Parents: e95e569
Author: Mikhail Stepura <mi...@apache.org>
Authored: Mon Nov 3 18:46:51 2014 -0800
Committer: T Jake Luciani <ja...@apache.org>
Committed: Tue Nov 4 09:23:18 2014 -0500

----------------------------------------------------------------------
 build.xml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a6c58f8b/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 9562a37..29e4121 100644
--- a/build.xml
+++ b/build.xml
@@ -1499,14 +1499,13 @@
   <classpathentry kind="src" path="src/java"/>
   <classpathentry kind="src" path="src/resources"/>
   <classpathentry kind="src" path="src/gen-java"/>
-  <classpathentry kind="src" path="interface/thrift/gen-java"/>
   <classpathentry kind="src" path="test/unit"/>
   <classpathentry kind="src" path="test/long"/>
   <classpathentry kind="src" path="test/pig"/>
   <classpathentry kind="src" path="tools/stress/src"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
   <classpathentry kind="output" path="build/classes/main"/>
-  <classpathentry kind="lib" path="build/classes/thrift"/>
+  <classpathentry kind="lib" path="build/classes/thrift" sourcepath="interface/thrift/gen-java/"/>
   <classpathentry kind="lib" path="build/test/classes"/>
   <classpathentry kind="lib" path="test/conf"/>
 ]]>