[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Merge branch 'cassandra-3.0' into cassandra-3.11 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e047b1d0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e047b1d0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e047b1d0 Branch: refs/heads/cassandra-3.11 Commit: e047b1d059ffc251afc6a6f871b044871c827f92 Parents: f3cf1c0 a04d627 Author: Michael ShulerAuthored: Tue Oct 10 17:15:17 2017 -0500 Committer: Michael Shuler Committed: Tue Oct 10 17:15:17 2017 -0500 -- -- - 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-3.0' into cassandra-3.11
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3e3d56ec/test/unit/org/apache/cassandra/cql3/GcCompactionTest.java -- diff --cc test/unit/org/apache/cassandra/cql3/GcCompactionTest.java index a31b9a1,000..84a20de mode 100644,00..100644 --- a/test/unit/org/apache/cassandra/cql3/GcCompactionTest.java +++ b/test/unit/org/apache/cassandra/cql3/GcCompactionTest.java @@@ -1,389 -1,0 +1,390 @@@ +/* + * 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 static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.function.Function; + +import com.google.common.collect.Iterables; +import org.junit.Test; + +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.compaction.CompactionManager; +import org.apache.cassandra.db.rows.*; +import org.apache.cassandra.io.sstable.ISSTableScanner; +import org.apache.cassandra.io.sstable.format.SSTableReader; +import org.apache.cassandra.utils.FBUtilities; + +public class GcCompactionTest extends CQLTester +{ +static final int KEY_COUNT = 10; +static final int CLUSTERING_COUNT = 20; + +// Test needs synchronous table drop to avoid flushes causing flaky failures + +@Override +protected String createTable(String query) +{ +return super.createTable(KEYSPACE_PER_TEST, query); +} + +@Override +protected UntypedResultSet execute(String query, Object... values) throws Throwable +{ +return executeFormattedQuery(formatQuery(KEYSPACE_PER_TEST, query), values); +} + +@Override +public ColumnFamilyStore getCurrentColumnFamilyStore() +{ +return super.getCurrentColumnFamilyStore(KEYSPACE_PER_TEST); +} + +public void flush() +{ +flush(KEYSPACE_PER_TEST); +} + +@Test +public void testGcCompactionPartitions() throws Throwable +{ +runCompactionTest("CREATE TABLE %s(" + + " key int," + + " column int," + + " data int," + + " extra text," + + " PRIMARY KEY((key, column), data)" + + ") WITH compaction = { 'class' : 'SizeTieredCompactionStrategy', 'provide_overlapping_tombstones' : 'row' };" + ); + +} + +@Test +public void testGcCompactionRows() throws Throwable +{ +runCompactionTest("CREATE TABLE %s(" + + " key int," + + " column int," + + " data int," + + " extra text," + + " PRIMARY KEY(key, column)" + + ") WITH compaction = { 'class' : 'SizeTieredCompactionStrategy', 'provide_overlapping_tombstones' : 'row' };" + ); + +} + +@Test +public void testGcCompactionRanges() throws Throwable +{ + +runCompactionTest("CREATE TABLE %s(" + + " key int," + + " column int," + + " col2 int," + + " data int," + + " extra text," + + " PRIMARY KEY(key, column, data)" + + ") WITH compaction = { 'class' : 'SizeTieredCompactionStrategy', 'provide_overlapping_tombstones' : 'row' };" + ); +} + +private void runCompactionTest(String tableDef) throws Throwable +{ +createTable(tableDef); + +for (int i = 0; i < KEY_COUNT; ++i) +for (int j = 0; j < CLUSTERING_COUNT; ++j) +execute("INSERT INTO %s (key, column, data, extra) VALUES (?, ?, ?, ?)", i, j, i+j, "" + i + ":" + j); + +Set readers = new HashSet<>(); +ColumnFamilyStore cfs = getCurrentColumnFamilyStore(); + +flush(); +
[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Merge branch 'cassandra-3.0' into cassandra-3.11 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85028978 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85028978 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85028978 Branch: refs/heads/cassandra-3.11 Commit: 85028978a1ebcf7ec6c1194d6629e8db9bcbcab2 Parents: e624c66 f4014bb Author: Paulo MottaAuthored: Tue Sep 5 02:30:53 2017 -0500 Committer: Paulo Motta Committed: Tue Sep 5 02:30:53 2017 -0500 -- CHANGES.txt | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/85028978/CHANGES.txt -- diff --cc CHANGES.txt index 9218d90,870351c..17c4a43 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,16 -1,8 +1,17 @@@ -3.0.15 +3.11.1 + * Add a compaction option to TWCS to ignore sstables overlapping checks (CASSANDRA-13418) + * BTree.Builder memory leak (CASSANDRA-13754) + * Revert CASSANDRA-10368 of supporting non-pk column filtering due to correctness (CASSANDRA-13798) + * Fix cassandra-stress hang issues when an error during cluster connection happens (CASSANDRA-12938) + * Better bootstrap failure message when blocked by (potential) range movement (CASSANDRA-13744) + * "ignore" option is ignored in sstableloader (CASSANDRA-13721) + * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652) + * Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512) + * Properly evict pstmts from prepared statements cache (CASSANDRA-13641) +Merged from 3.0: + * Fix MV timestamp issues (CASSANDRA-11500) - * Better tolerate improperly formatted bcrypt hashes (CASSANDRA-13626) + * Better tolerate improperly formatted bcrypt hashes (CASSANDRA-13626) * Fix race condition in read command serialization (CASSANDRA-13363) - * Enable segement creation before recovering commitlogs (CASSANDRA-13587) * Fix AssertionError in short read protection (CASSANDRA-13747) * Don't skip corrupted sstables on startup (CASSANDRA-13620) * Fix the merging of cells with different user type versions (CASSANDRA-13776) - 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-3.0' into cassandra-3.11
http://git-wip-us.apache.org/repos/asf/cassandra/blob/47a2839b/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java -- diff --cc test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java index a6ce08b,000..e9051b4 mode 100644,00..100644 --- a/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java +++ b/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java @@@ -1,2552 -1,0 +1,2566 @@@ +/* + * 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.index.sasi; + +import java.io.FileWriter; +import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.cassandra.SchemaLoader; +import org.apache.cassandra.config.CFMetaData; +import org.apache.cassandra.config.ColumnDefinition; +import org.apache.cassandra.index.Index; +import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.cql3.*; +import org.apache.cassandra.cql3.Term; +import org.apache.cassandra.cql3.statements.IndexTarget; +import org.apache.cassandra.cql3.statements.SelectStatement; +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.filter.ColumnFilter; +import org.apache.cassandra.db.filter.DataLimits; +import org.apache.cassandra.db.filter.RowFilter; +import org.apache.cassandra.db.lifecycle.SSTableSet; +import org.apache.cassandra.db.marshal.*; +import org.apache.cassandra.db.partitions.PartitionUpdate; +import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator; +import org.apache.cassandra.db.rows.*; +import org.apache.cassandra.dht.IPartitioner; +import org.apache.cassandra.dht.Murmur3Partitioner; +import org.apache.cassandra.dht.Range; +import org.apache.cassandra.exceptions.ConfigurationException; +import org.apache.cassandra.exceptions.InvalidRequestException; +import org.apache.cassandra.index.sasi.conf.ColumnIndex; +import org.apache.cassandra.index.sasi.disk.OnDiskIndexBuilder; +import org.apache.cassandra.index.sasi.exceptions.TimeQuotaExceededException; +import org.apache.cassandra.index.sasi.memory.IndexMemtable; +import org.apache.cassandra.index.sasi.plan.QueryController; +import org.apache.cassandra.index.sasi.plan.QueryPlan; +import org.apache.cassandra.io.sstable.SSTable; +import org.apache.cassandra.schema.IndexMetadata; +import org.apache.cassandra.schema.KeyspaceMetadata; +import org.apache.cassandra.schema.KeyspaceParams; +import org.apache.cassandra.schema.Tables; +import org.apache.cassandra.serializers.MarshalException; +import org.apache.cassandra.serializers.TypeSerializer; +import org.apache.cassandra.service.MigrationManager; +import org.apache.cassandra.service.QueryState; +import org.apache.cassandra.thrift.CqlRow; +import org.apache.cassandra.transport.messages.ResultMessage; +import org.apache.cassandra.utils.ByteBufferUtil; +import org.apache.cassandra.utils.FBUtilities; +import org.apache.cassandra.utils.Pair; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.Uninterruptibles; + +import junit.framework.Assert; + +import org.junit.*; + +public class SASIIndexTest +{ +private static final IPartitioner PARTITIONER; + +static { +System.setProperty("cassandra.config", "cassandra-murmur.yaml"); +PARTITIONER = Murmur3Partitioner.instance; +} + +private static final String KS_NAME = "sasi"; +private static final String CF_NAME = "test_cf"; +private static final String CLUSTERING_CF_NAME_1 = "clustering_test_cf_1"; +private static final String CLUSTERING_CF_NAME_2 = "clustering_test_cf_2"; +private static final String STATIC_CF_NAME = "static_sasi_test_cf"; +private static final String FTS_CF_NAME =
[4/8] cassandra git commit: Merge branch cassandra-3.0 into cassandra-3.11
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5c9db9af/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java -- diff --cc src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java index 4536036,000..84a742b mode 100644,00..100644 --- a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java +++ b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java @@@ -1,261 -1,0 +1,263 @@@ +/* + * + * 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.rows; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Comparator; +import java.util.List; + +import org.apache.cassandra.config.CFMetaData; +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.filter.ClusteringIndexFilter; +import org.apache.cassandra.db.filter.ColumnFilter; +import org.apache.cassandra.io.sstable.IndexInfo; +import org.apache.cassandra.io.sstable.format.SSTableReader; ++import org.apache.cassandra.io.sstable.format.SSTableReadsListener; +import org.apache.cassandra.io.sstable.metadata.StatsMetadata; +import org.apache.cassandra.thrift.ThriftResultsMerger; +import org.apache.cassandra.utils.IteratorWithLowerBound; + +/** + * An unfiltered row iterator with a lower bound retrieved from either the global + * sstable statistics or the row index lower bounds (if available in the cache). + * Before initializing the sstable unfiltered row iterator, we return an empty row + * with the clustering set to the lower bound. The empty row will be filtered out and + * the result is that if we don't need to access this sstable, i.e. due to the LIMIT conditon, + * then we will not. See CASSANDRA-8180 for examples of why this is useful. + */ +public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilteredRowIterator implements IteratorWithLowerBound +{ +private final SSTableReader sstable; +private final ClusteringIndexFilter filter; +private final ColumnFilter selectedColumns; +private final boolean isForThrift; +private final int nowInSec; +private final boolean applyThriftTransformation; ++private final SSTableReadsListener listener; +private ClusteringBound lowerBound; +private boolean firstItemRetrieved; + +public UnfilteredRowIteratorWithLowerBound(DecoratedKey partitionKey, + SSTableReader sstable, + ClusteringIndexFilter filter, + ColumnFilter selectedColumns, + boolean isForThrift, + int nowInSec, -boolean applyThriftTransformation) ++ boolean applyThriftTransformation, ++ SSTableReadsListener listener) +{ +super(partitionKey); +this.sstable = sstable; +this.filter = filter; +this.selectedColumns = selectedColumns; +this.isForThrift = isForThrift; +this.nowInSec = nowInSec; +this.applyThriftTransformation = applyThriftTransformation; ++this.listener = listener; +this.lowerBound = null; +this.firstItemRetrieved = false; +} + +public Unfiltered lowerBound() +{ +if (lowerBound != null) +return makeBound(lowerBound); + +// The partition index lower bound is more accurate than the sstable metadata lower bound but it is only +// present if the iterator has already been initialized, which we only do when there are tombstones since in +// this case we cannot use the sstable metadata clustering values +ClusteringBound ret = getPartitionIndexLowerBound(); +return ret != null ? makeBound(ret) : makeBound(getMetadataLowerBound()); +} + +private Unfiltered makeBound(ClusteringBound
[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Merge branch 'cassandra-3.0' into cassandra-3.11 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/449400be Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/449400be Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/449400be Branch: refs/heads/cassandra-3.11 Commit: 449400be30a591a69499f2f81dedefdbe0e14785 Parents: e8053dd 2f1ab4a Author: T Jake LucianiAuthored: Tue Apr 4 12:46:12 2017 -0400 Committer: T Jake Luciani Committed: Tue Apr 4 12:46:12 2017 -0400 -- --
[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Merge branch 'cassandra-3.0' into cassandra-3.11 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a85b0071 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a85b0071 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a85b0071 Branch: refs/heads/cassandra-3.X Commit: a85b007103ec2ffcfac2ce9e591bc26657089549 Parents: a06b469 5f64ed7 Author: Carl YeksigianAuthored: Mon Dec 5 12:27:57 2016 -0500 Committer: Carl Yeksigian Committed: Mon Dec 5 12:27:57 2016 -0500 -- CHANGES.txt | 1 + src/java/org/apache/cassandra/service/StorageService.java | 9 + 2 files changed, 6 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a85b0071/CHANGES.txt -- diff --cc CHANGES.txt index e69a67a,5cacdd0..c04c2fa --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -163,9 -48,6 +163,10 @@@ Merged from 3.0 * Correct log message for statistics of offheap memtable flush (CASSANDRA-12776) * Explicitly set locale for string validation (CASSANDRA-12541,CASSANDRA-12542,CASSANDRA-12543,CASSANDRA-12545) Merged from 2.2: ++ * Use saved tokens when setting local tokens on StorageService.joinRing (CASSANDRA-12935) + * cqlsh: fix DESC TYPES errors (CASSANDRA-12914) + * Fix leak on skipped SSTables in sstableupgrade (CASSANDRA-12899) + * Avoid blocking gossip during pending range calculation (CASSANDRA-12281) * Fix purgeability of tombstones with max timestamp (CASSANDRA-12792) * Fail repair if participant dies during sync or anticompaction (CASSANDRA-12901) * cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a85b0071/src/java/org/apache/cassandra/service/StorageService.java -- diff --cc src/java/org/apache/cassandra/service/StorageService.java index 07eb1d8,9bf8c54..a53187f --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@@ -986,7 -917,8 +987,7 @@@ public class StorageService extends Not { if (dataAvailable) { - finishJoiningRing(bootstrap); -finishJoiningRing(bootstrapTokens); - ++finishJoiningRing(bootstrap, bootstrapTokens); // remove the existing info about the replaced node. if (!current.isEmpty()) { @@@ -1041,26 -967,17 +1042,26 @@@ } else if (isSurveyMode) { -isSurveyMode = false; logger.info("Leaving write survey mode and joining ring at operator request"); - finishJoiningRing(resumedBootstrap); -finishJoiningRing(SystemKeyspace.getSavedTokens()); ++finishJoiningRing(resumedBootstrap, SystemKeyspace.getSavedTokens()); +isSurveyMode = false; } } -private void finishJoiningRing(Collection tokens) +private void executePreJoinTasks(boolean bootstrap) +{ +StreamSupport.stream(ColumnFamilyStore.all().spliterator(), false) +.filter(cfs -> Schema.instance.getUserKeyspaces().contains(cfs.keyspace.getName())) +.forEach(cfs -> cfs.indexManager.executePreJoinTasksBlocking(bootstrap)); +} + - private void finishJoiningRing(boolean didBootstrap) ++private void finishJoiningRing(boolean didBootstrap, Collection tokens) { // start participating in the ring. +setMode(Mode.JOINING, "Finish joining ring", true); SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); +executePreJoinTasks(didBootstrap); - setTokens(bootstrapTokens); + setTokens(tokens); assert tokenMetadata.sortedTokens().size() > 0; doAuthSetup();