[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
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/e817c83b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e817c83b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e817c83b Branch: refs/heads/cassandra-3.11 Commit: e817c83bc06b7b23aa94c8cd1099103b129801a5 Parents: a7cb009 4b52a68 Author: Jason BrownAuthored: Tue Aug 29 08:28:09 2017 -0700 Committer: Jason Brown Committed: Tue Aug 29 08:28:28 2017 -0700 -- src/java/org/apache/cassandra/gms/Gossiper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e817c83b/src/java/org/apache/cassandra/gms/Gossiper.java -- - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[4/8] cassandra git commit: Merge branch cassandra-2.2 into cassandra-3.0
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2445cfb/src/java/org/apache/cassandra/db/filter/DataLimits.java -- diff --cc src/java/org/apache/cassandra/db/filter/DataLimits.java index 94f43dc,000..48ec06a mode 100644,00..100644 --- a/src/java/org/apache/cassandra/db/filter/DataLimits.java +++ b/src/java/org/apache/cassandra/db/filter/DataLimits.java @@@ -1,814 -1,0 +1,827 @@@ +/* + * 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.db.filter; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.rows.*; +import org.apache.cassandra.db.partitions.*; +import org.apache.cassandra.db.transform.BasePartitions; +import org.apache.cassandra.db.transform.BaseRows; +import org.apache.cassandra.db.transform.StoppingTransformation; +import org.apache.cassandra.db.transform.Transformation; +import org.apache.cassandra.io.util.DataInputPlus; +import org.apache.cassandra.io.util.DataOutputPlus; +import org.apache.cassandra.utils.ByteBufferUtil; + +/** + * Object in charge of tracking if we have fetch enough data for a given query. + * + * The reason this is not just a simple integer is that Thrift and CQL3 count + * stuffs in different ways. This is what abstract those differences. + */ +public abstract class DataLimits +{ +public static final Serializer serializer = new Serializer(); + +public static final int NO_LIMIT = Integer.MAX_VALUE; + +public static final DataLimits NONE = new CQLLimits(NO_LIMIT) +{ +@Override - public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec) ++public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData) +{ +return false; +} + +@Override - public UnfilteredPartitionIterator filter(UnfilteredPartitionIterator iter, int nowInSec) ++public UnfilteredPartitionIterator filter(UnfilteredPartitionIterator iter, ++ int nowInSec, ++ boolean countPartitionsWithOnlyStaticData) +{ +return iter; +} + +@Override - public UnfilteredRowIterator filter(UnfilteredRowIterator iter, int nowInSec) ++public UnfilteredRowIterator filter(UnfilteredRowIterator iter, ++int nowInSec, ++boolean countPartitionsWithOnlyStaticData) +{ +return iter; +} +}; + +// We currently deal with distinct queries by querying full partitions but limiting the result at 1 row per +// partition (see SelectStatement.makeFilter). So an "unbounded" distinct is still actually doing some filtering. +public static final DataLimits DISTINCT_NONE = new CQLLimits(NO_LIMIT, 1, true); + +public enum Kind { CQL_LIMIT, CQL_PAGING_LIMIT, THRIFT_LIMIT, SUPER_COLUMN_COUNTING_LIMIT } + +public static DataLimits cqlLimits(int cqlRowLimit) +{ +return new CQLLimits(cqlRowLimit); +} + +public static DataLimits cqlLimits(int cqlRowLimit, int perPartitionLimit) +{ +return new CQLLimits(cqlRowLimit, perPartitionLimit); +} + +public static DataLimits distinctLimits(int cqlRowLimit) +{ +return CQLLimits.distinct(cqlRowLimit); +} + +public static DataLimits thriftLimits(int partitionLimit, int cellPerPartitionLimit) +{ +return new ThriftLimits(partitionLimit, cellPerPartitionLimit); +} + +public static DataLimits superColumnCountingLimits(int partitionLimit, int cellPerPartitionLimit) +{ +return new SuperColumnCountingLimits(partitionLimit, cellPerPartitionLimit); +} + +public abstract Kind kind(); + +public abstract boolean isUnlimited(); +public abstract boolean isDistinct(); + +public abstract DataLimits forPaging(int pageSize); +public abstract
[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
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/b7c3dc52 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b7c3dc52 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b7c3dc52 Branch: refs/heads/cassandra-3.9 Commit: b7c3dc521263c650d27b499e77327362e5f7f1f2 Parents: a5cbb02 04ef62c Author: Stefania AlborghettiAuthored: Fri Jul 29 15:22:47 2016 +0800 Committer: Stefania Alborghetti Committed: Fri Jul 29 15:22:47 2016 +0800 -- --
[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3079ae60/src/java/org/apache/cassandra/schema/SchemaKeyspace.java -- diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java index 6e9d44b,000..e3756ec mode 100644,00..100644 --- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java +++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java @@@ -1,1410 -1,0 +1,1400 @@@ +/* + * 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.schema; + +import java.nio.ByteBuffer; +import java.nio.charset.CharacterCodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.MapDifference; +import com.google.common.collect.Maps; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.cassandra.config.*; +import org.apache.cassandra.config.ColumnDefinition.ClusteringOrder; +import org.apache.cassandra.cql3.*; +import org.apache.cassandra.cql3.functions.*; +import org.apache.cassandra.cql3.statements.SelectStatement; +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.marshal.*; +import org.apache.cassandra.db.partitions.*; +import org.apache.cassandra.db.rows.*; +import org.apache.cassandra.db.view.View; +import org.apache.cassandra.exceptions.ConfigurationException; +import org.apache.cassandra.exceptions.InvalidRequestException; +import org.apache.cassandra.transport.Server; +import org.apache.cassandra.utils.ByteBufferUtil; +import org.apache.cassandra.utils.FBUtilities; +import org.apache.cassandra.utils.Pair; + +import static java.lang.String.format; + +import static java.util.stream.Collectors.toList; +import static org.apache.cassandra.cql3.QueryProcessor.executeInternal; +import static org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal; +import static org.apache.cassandra.schema.CQLTypeParser.parse; + +/** + * system_schema.* tables and methods for manipulating them. + */ +public final class SchemaKeyspace +{ +private SchemaKeyspace() +{ +} + +private static final Logger logger = LoggerFactory.getLogger(SchemaKeyspace.class); + +private static final boolean FLUSH_SCHEMA_TABLES = Boolean.valueOf(System.getProperty("cassandra.test.flush_local_schema_changes", "true")); + +public static final String NAME = "system_schema"; + +public static final String KEYSPACES = "keyspaces"; +public static final String TABLES = "tables"; +public static final String COLUMNS = "columns"; +public static final String DROPPED_COLUMNS = "dropped_columns"; +public static final String TRIGGERS = "triggers"; +public static final String VIEWS = "views"; +public static final String TYPES = "types"; +public static final String FUNCTIONS = "functions"; +public static final String AGGREGATES = "aggregates"; +public static final String INDEXES = "indexes"; + +public static final List ALL = +ImmutableList.of(KEYSPACES, TABLES, COLUMNS, DROPPED_COLUMNS, TRIGGERS, VIEWS, TYPES, FUNCTIONS, AGGREGATES, INDEXES); + +private static final CFMetaData Keyspaces = +compile(KEYSPACES, +"keyspace definitions", +"CREATE TABLE %s (" ++ "keyspace_name text," ++ "durable_writes boolean," ++ "replication frozen
[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
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/f807b8c6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f807b8c6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f807b8c6 Branch: refs/heads/cassandra-3.0 Commit: f807b8c6ed1af297d29314399b9f250a966581f4 Parents: 7159a75 728f94e Author: Joshua McKenzieAuthored: Mon Oct 19 15:11:43 2015 -0400 Committer: Joshua McKenzie Committed: Mon Oct 19 15:11:43 2015 -0400 -- bin/cassandra.ps1 | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) --
[4/8] cassandra git commit: Merge branch cassandra-2.2 into cassandra-3.0
http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa60cde3/src/java/org/apache/cassandra/service/DigestResolver.java -- diff --cc src/java/org/apache/cassandra/service/DigestResolver.java index 572df6f,000..62b4538 mode 100644,00..100644 --- a/src/java/org/apache/cassandra/service/DigestResolver.java +++ b/src/java/org/apache/cassandra/service/DigestResolver.java @@@ -1,98 -1,0 +1,98 @@@ +/* + * 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.service; + +import java.nio.ByteBuffer; +import java.util.concurrent.TimeUnit; + +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.partitions.PartitionIterator; +import org.apache.cassandra.db.partitions.UnfilteredPartitionIterators; +import org.apache.cassandra.net.MessageIn; + +public class DigestResolver extends ResponseResolver +{ +private volatile ReadResponse dataResponse; + +public DigestResolver(Keyspace keyspace, ReadCommand command, ConsistencyLevel consistency, int maxResponseCount) +{ +super(keyspace, command, consistency, maxResponseCount); +} + +@Override +public void preprocess(MessageIn message) +{ +super.preprocess(message); +if (dataResponse == null && !message.payload.isDigestResponse()) +dataResponse = message.payload; +} + +/** + * Special case of resolve() so that CL.ONE reads never throw DigestMismatchException in the foreground + */ +public PartitionIterator getData() +{ +assert isDataPresent(); +return UnfilteredPartitionIterators.filter(dataResponse.makeIterator(command.metadata(), command), command.nowInSec()); +} + +/* + * This method handles two different scenarios: + * + * a) we're handling the initial read of data from the closest replica + digests + *from the rest. In this case we check the digests against each other, + *throw an exception if there is a mismatch, otherwise return the data row. + * + * b) we're checking additional digests that arrived after the minimum to handle + *the requested ConsistencyLevel, i.e. asynchronous read repair check + */ +public PartitionIterator resolve() throws DigestMismatchException +{ +if (responses.size() == 1) +return getData(); + - if (logger.isDebugEnabled()) - logger.debug("resolving {} responses", responses.size()); ++if (logger.isTraceEnabled()) ++logger.trace("resolving {} responses", responses.size()); + +long start = System.nanoTime(); + +// validate digests against each other; throw immediately on mismatch. +ByteBuffer digest = null; +for (MessageIn message : responses) +{ +ReadResponse response = message.payload; + +ByteBuffer newDigest = response.digest(command.metadata(), command); +if (digest == null) +digest = newDigest; +else if (!digest.equals(newDigest)) +// rely on the fact that only single partition queries use digests +throw new DigestMismatchException(((SinglePartitionReadCommand)command).partitionKey(), digest, newDigest); +} + - if (logger.isDebugEnabled()) - logger.debug("resolve: {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); ++if (logger.isTraceEnabled()) ++logger.trace("resolve: {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); + +return UnfilteredPartitionIterators.filter(dataResponse.makeIterator(command.metadata(), command), command.nowInSec()); +} + +public boolean isDataPresent() +{ +return dataResponse != null; +} +} http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa60cde3/src/java/org/apache/cassandra/service/GCInspector.java --
[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
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/53359607 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/53359607 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/53359607 Branch: refs/heads/trunk Commit: 53359607640b064db91ff772e3c0e487eb03f7c4 Parents: a7895cf 99c6ad6 Author: Marcus ErikssonAuthored: Mon Sep 7 08:01:29 2015 +0200 Committer: Marcus Eriksson Committed: Mon Sep 7 08:01:29 2015 +0200 -- src/java/org/apache/cassandra/tools/SSTableExpiredBlockers.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/53359607/src/java/org/apache/cassandra/tools/SSTableExpiredBlockers.java --
[4/8] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
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/7eed4b66 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7eed4b66 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7eed4b66 Branch: refs/heads/cassandra-3.0 Commit: 7eed4b6644f20597d58aa3562a201b527afae9a5 Parents: 0d7b232 fce8478 Author: Jonathan Ellis jbel...@apache.org Authored: Tue Aug 18 20:16:09 2015 -0500 Committer: Jonathan Ellis jbel...@apache.org Committed: Tue Aug 18 20:16:09 2015 -0500 -- --