Merge branch 'cassandra-1.2' into cassandra-2.0 Conflicts: src/java/org/apache/cassandra/db/compaction/CompactionManager.java src/java/org/apache/cassandra/io/sstable/SSTableReader.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e9c027a3 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e9c027a3 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e9c027a3 Branch: refs/heads/trunk Commit: e9c027a3a74d4be211b7f95308c7b2a106dc3b9e Parents: 2648047 9d7bb1e Author: Yuki Morishita <yu...@apache.org> Authored: Wed Sep 18 14:23:52 2013 -0500 Committer: Yuki Morishita <yu...@apache.org> Committed: Wed Sep 18 14:23:52 2013 -0500 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../db/compaction/CompactionManager.java | 14 +++++++-- .../cassandra/io/sstable/SSTableReader.java | 30 ++++++++++++++------ 3 files changed, 34 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e9c027a3/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index fd8d852,c6e1169..26fcc2f --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -47,54 -20,14 +47,55 @@@ Merged from 1.2 * Add SSTableDeletingNotification to DataTracker (CASSANDRA-6010) * Fix snapshots in use get deleted during snapshot repair (CASSANDRA-6011) * Move hints and exception count to o.a.c.metrics (CASSANDRA-6017) + * Fix memory leak in snapshot repair (CASSANDRA-6047) -1.2.9 +2.0.0 + * Fix thrift validation when inserting into CQL3 tables (CASSANDRA-5138) + * Fix periodic memtable flushing behavior with clean memtables (CASSANDRA-5931) + * Fix dateOf() function for pre-2.0 timestamp columns (CASSANDRA-5928) + * Fix SSTable unintentionally loads BF when opened for batch (CASSANDRA-5938) + * Add stream session progress to JMX (CASSANDRA-4757) + * Fix NPE during CAS operation (CASSANDRA-5925) +Merged from 1.2: * Fix getBloomFilterDiskSpaceUsed for AlwaysPresentFilter (CASSANDRA-5900) - * migrate 1.1 schema_columnfamilies.key_alias column to key_aliases - (CASSANDRA-5800) - * add --migrate option to sstableupgrade and sstablescrub (CASSANDRA-5831) + * Don't announce schema version until we've loaded the changes locally + (CASSANDRA-5904) + * Fix to support off heap bloom filters size greater than 2 GB (CASSANDRA-5903) + * Properly handle parsing huge map and set literals (CASSANDRA-5893) + + +2.0.0-rc2 + * enable vnodes by default (CASSANDRA-5869) + * fix CAS contention timeout (CASSANDRA-5830) + * fix HsHa to respect max frame size (CASSANDRA-4573) + * Fix (some) 2i on composite components omissions (CASSANDRA-5851) + * cqlsh: add DESCRIBE FULL SCHEMA variant (CASSANDRA-5880) +Merged from 1.2: + * Correctly validate sparse composite cells in scrub (CASSANDRA-5855) + * Add KeyCacheHitRate metric to CF metrics (CASSANDRA-5868) + * cqlsh: add support for multiline comments (CASSANDRA-5798) + * Handle CQL3 SELECT duplicate IN restrictions on clustering columns + (CASSANDRA-5856) + + +2.0.0-rc1 + * improve DecimalSerializer performance (CASSANDRA-5837) + * fix potential spurious wakeup in AsyncOneResponse (CASSANDRA-5690) + * fix schema-related trigger issues (CASSANDRA-5774) + * Better validation when accessing CQL3 table from thrift (CASSANDRA-5138) + * Fix assertion error during repair (CASSANDRA-5801) + * Fix range tombstone bug (CASSANDRA-5805) + * DC-local CAS (CASSANDRA-5797) + * Add a native_protocol_version column to the system.local table (CASSANRDA-5819) + * Use index_interval from cassandra.yaml when upgraded (CASSANDRA-5822) + * Fix buffer underflow on socket close (CASSANDRA-5792) +Merged from 1.2: + * Fix reading DeletionTime from 1.1-format sstables (CASSANDRA-5814) + * cqlsh: add collections support to COPY (CASSANDRA-5698) + * retry important messages for any IOException (CASSANDRA-5804) + * Allow empty IN relations in SELECT/UPDATE/DELETE statements (CASSANDRA-5626) + * cqlsh: fix crashing on Windows due to libedit detection (CASSANDRA-5812) * fix bulk-loading compressed sstables (CASSANDRA-5820) * (Hadoop) fix quoting in CqlPagingRecordReader and CqlRecordWriter (CASSANDRA-5824) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e9c027a3/src/java/org/apache/cassandra/db/compaction/CompactionManager.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java index 2f9aed2,5c17b0a..f3c2011 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@@ -755,12 -713,12 +755,13 @@@ public class CompactionManager implemen return; Collection<SSTableReader> sstables; + String snapshotName = validator.desc.sessionId.toString(); int gcBefore; - if (cfs.snapshotExists(snapshotName)) - boolean isSnapshotValidation = cfs.snapshotExists(validator.request.sessionid); ++ boolean isSnapshotValidation = cfs.snapshotExists(snapshotName); + if (isSnapshotValidation) { // If there is a snapshot created for the session then read from there. - sstables = cfs.getSnapshotSSTableReader(validator.request.sessionid); + sstables = cfs.getSnapshotSSTableReader(snapshotName); // Computing gcbefore based on the current time wouldn't be very good because we know each replica will execute // this at a different time (that's the whole purpose of repair with snaphsot). So instead we take the creation @@@ -800,10 -769,17 +801,17 @@@ } finally { - SSTableReader.releaseReferences(sstables); iter.close(); - if (cfs.snapshotExists(snapshotName)) + if (isSnapshotValidation) + { + for (SSTableReader sstable : sstables) + FileUtils.closeQuietly(sstable); - cfs.clearSnapshot(validator.request.sessionid); + cfs.clearSnapshot(snapshotName); + } + else + { + SSTableReader.releaseReferences(sstables); + } metrics.finishCompaction(ci); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/e9c027a3/src/java/org/apache/cassandra/io/sstable/SSTableReader.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/io/sstable/SSTableReader.java index b5f7d22,ed221d9..e0c096f --- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java @@@ -61,10 -59,10 +61,10 @@@ import org.apache.cassandra.utils.* import static org.apache.cassandra.db.Directories.SECONDARY_INDEX_NAME_SEPARATOR; /** - * SSTableReaders are open()ed by Table.onStart; after that they are created by SSTableWriter.renameAndOpen. + * SSTableReaders are open()ed by Keyspace.onStart; after that they are created by SSTableWriter.renameAndOpen. * Do not re-call open() on existing SSTable files; use the references kept by ColumnFamilyStore post-start instead. */ - public class SSTableReader extends SSTable + public class SSTableReader extends SSTable implements Closeable { private static final Logger logger = LoggerFactory.getLogger(SSTableReader.class); @@@ -335,6 -345,20 +335,21 @@@ this.bf = bloomFilter; } + /** + * Clean up all opened resources. + * + * @throws IOException + */ + public void close() throws IOException + { + // Force finalizing mmapping if necessary + ifile.cleanup(); + dfile.cleanup(); + // close the BF so it can be opened later. + bf.close(); ++ indexSummary.close(); + } + public void setTrackedBy(DataTracker tracker) { deletingTask.setTracker(tracker); @@@ -1032,23 -992,8 +1052,17 @@@ { if (references.decrementAndGet() == 0 && isCompacted.get()) { + /** + * Make OS a favour and suggest (using fadvice call) that we + * don't want to see pages of this SSTable in memory anymore. + * + * NOTE: We can't use madvice in java because it requires address of + * the mapping, so instead we always open a file and run fadvice(fd, 0, 0) on it + */ + dropPageCache(); + - // Force finalizing mmapping if necessary - ifile.cleanup(); - dfile.cleanup(); - + FileUtils.closeQuietly(this); deletingTask.schedule(); - // close the BF so it can be opened later. - FileUtils.closeQuietly(bf); - FileUtils.closeQuietly(indexSummary); } assert references.get() >= 0 : "Reference counter " + references.get() + " for " + dfile.path; }