This is an automated email from the ASF dual-hosted git repository. dcapwell pushed a commit to branch cassandra-2.2 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-2.2 by this push: new 3642d55 In-jvm dtests use -1 as timestamp for all writes that don't specify 'USING TIMESTAMP' 3642d55 is described below commit 3642d55886f3115530266b53a95d53ecd136bf9a Author: Marcus Eriksson <marc...@apache.org> AuthorDate: Fri Sep 4 10:57:47 2020 -0700 In-jvm dtests use -1 as timestamp for all writes that don't specify 'USING TIMESTAMP' patch by Marcus Eriksson; reviewed by David Capwell for CASSANDRA-15934 --- .../org/apache/cassandra/cql3/QueryOptions.java | 2 +- .../cassandra/distributed/test/JVMDTestTest.java | 53 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/cql3/QueryOptions.java b/src/java/org/apache/cassandra/cql3/QueryOptions.java index da705e0..93d6c9b 100644 --- a/src/java/org/apache/cassandra/cql3/QueryOptions.java +++ b/src/java/org/apache/cassandra/cql3/QueryOptions.java @@ -88,7 +88,7 @@ public abstract class QueryOptions public static QueryOptions create(ConsistencyLevel consistency, List<ByteBuffer> values, boolean skipMetadata, int pageSize, PagingState pagingState, ConsistencyLevel serialConsistency, int protocolVersion) { - return new DefaultQueryOptions(consistency, values, skipMetadata, new SpecificOptions(pageSize, pagingState, serialConsistency, -1L), protocolVersion); + return new DefaultQueryOptions(consistency, values, skipMetadata, new SpecificOptions(pageSize, pagingState, serialConsistency, Long.MIN_VALUE), protocolVersion); } public static QueryOptions addColumnSpecifications(QueryOptions options, List<ColumnSpecification> columnSpecs) diff --git a/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java b/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java new file mode 100644 index 0000000..795b4ea --- /dev/null +++ b/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java @@ -0,0 +1,53 @@ +/* + * 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.distributed.test; + +import java.io.IOException; + +import org.junit.Test; + +import org.apache.cassandra.distributed.Cluster; +import org.apache.cassandra.distributed.api.ConsistencyLevel; +import org.apache.cassandra.utils.FBUtilities; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class JVMDTestTest extends TestBaseImpl +{ + @Test + public void insertTimestampTest() throws IOException + { + try (Cluster cluster = init(Cluster.build(1).start())) + { + long now = FBUtilities.timestampMicros(); + cluster.schemaChange("CREATE TABLE "+KEYSPACE+".tbl (id int primary key, i int)"); + cluster.coordinator(1).execute("INSERT INTO "+KEYSPACE+".tbl (id, i) VALUES (1,1)", ConsistencyLevel.ALL); + cluster.coordinator(1).execute("INSERT INTO "+KEYSPACE+".tbl (id, i) VALUES (2,2) USING TIMESTAMP 1000", ConsistencyLevel.ALL); + + Object [][] res = cluster.coordinator(1).execute("SELECT writetime(i) FROM "+KEYSPACE+".tbl WHERE id = 1", ConsistencyLevel.ALL); + assertEquals(1, res.length); + assertTrue("ts="+res[0][0], (long)res[0][0] >= now); + + res = cluster.coordinator(1).execute("SELECT writetime(i) FROM "+KEYSPACE+".tbl WHERE id = 2", ConsistencyLevel.ALL); + assertEquals(1, res.length); + assertEquals(1000, (long) res[0][0]); + } + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org