merge from 1.2

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

Branch: refs/heads/cassandra-2.0
Commit: 810f0678ccd598b8f99b7b5df459c5cbe76ee9b8
Parents: a7c6541 d40f3c8
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Mon Oct 14 10:37:32 2013 +0100
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Mon Oct 14 10:37:32 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/db/DataTracker.java    | 30 ++++++++++++++------
 .../cassandra/io/sstable/SSTableReader.java     |  4 +--
 3 files changed, 25 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/810f0678/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 4668ae2,53bc848..cd06acc
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -48,43 -23,10 +48,44 @@@ Merged from 1.2
   * (Hadoop) Fetch no more than 128 splits in parallel (CASSANDRA-6169)
   * stress: add username/password authentication support (CASSANDRA-6068)
   * Fix indexed queries with row cache enabled on parent table (CASSANDRA-5732)
+  * Fix compaction race during columnfamily drop (CASSANDRA-5957)
  
  
 -1.2.10
 +2.0.1
 + * Fix bug that could allow reading deleted data temporarily (CASSANDRA-6025)
 + * Improve memory use defaults (CASSANDRA-5069)
 + * Make ThriftServer more easlly extensible (CASSANDRA-6058)
 + * Remove Hadoop dependency from ITransportFactory (CASSANDRA-6062)
 + * add file_cache_size_in_mb setting (CASSANDRA-5661)
 + * Improve error message when yaml contains invalid properties 
(CASSANDRA-5958)
 + * Improve leveled compaction's ability to find non-overlapping L0 compactions
 +   to work on concurrently (CASSANDRA-5921)
 + * Notify indexer of columns shadowed by range tombstones (CASSANDRA-5614)
 + * Log Merkle tree stats (CASSANDRA-2698)
 + * Switch from crc32 to adler32 for compressed sstable checksums 
(CASSANDRA-5862)
 + * Improve offheap memcpy performance (CASSANDRA-5884)
 + * Use a range aware scanner for cleanup (CASSANDRA-2524)
 + * Cleanup doesn't need to inspect sstables that contain only local data
 +   (CASSANDRA-5722)
 + * Add ability for CQL3 to list partition keys (CASSANDRA-4536)
 + * Improve native protocol serialization (CASSANDRA-5664)
 + * Upgrade Thrift to 0.9.1 (CASSANDRA-5923)
 + * Require superuser status for adding triggers (CASSANDRA-5963)
 + * Make standalone scrubber handle old and new style leveled manifest
 +   (CASSANDRA-6005)
 + * Fix paxos bugs (CASSANDRA-6012, 6013, 6023)
 + * Fix paged ranges with multiple replicas (CASSANDRA-6004)
 + * Fix potential AssertionError during tracing (CASSANDRA-6041)
 + * Fix NPE in sstablesplit (CASSANDRA-6027)
 + * Migrate pre-2.0 key/value/column aliases to system.schema_columns
 +   (CASSANDRA-6009)
 + * Paging filter empty rows too agressively (CASSANDRA-6040)
 + * Support variadic parameters for IN clauses (CASSANDRA-4210)
 + * cqlsh: return the result of CAS writes (CASSANDRA-5796)
 + * Fix validation of IN clauses with 2ndary indexes (CASSANDRA-6050)
 + * Support named bind variables in CQL (CASSANDRA-6033)
 +Merged from 1.2:
 + * Allow cache-keys-to-save to be set at runtime (CASSANDRA-5980)
   * Avoid second-guessing out-of-space state (CASSANDRA-5605)
   * Tuning knobs for dealing with large blobs and many CFs (CASSANDRA-5982)
   * (Hadoop) Fix CQLRW for thrift tables (CASSANDRA-6002)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/810f0678/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/DataTracker.java
index 1a19fef,4fe0a5e..365d607
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@@ -199,19 -188,20 +199,20 @@@ public class DataTracke
      }
  
      /**
 -     * Removes files from compacting status: this is different from 
'markCompacted'
 +     * Removes files from compacting status: this is different from 
'markObsolete'
       * because it should be run regardless of whether a compaction succeeded.
       */
 -    public void unmarkCompacting(Collection<SSTableReader> unmark)
 +    public void unmarkCompacting(Iterable<SSTableReader> unmark)
      {
-         if (!cfstore.isValid())
+         boolean isValid = cfstore.isValid();
+         if (!isValid)
          {
 -            // We don't know if the original compaction suceeded or failed, 
which makes it difficult to know
 -            // if the sstable reference has already been released.
 -            // A "good enough" approach is to mark the sstables involved 
compacted, which if compaction succeeded
 +            // The CF has been dropped.  We don't know if the original 
compaction suceeded or failed,
 +            // which makes it difficult to know if the sstable reference has 
already been released.
 +            // A "good enough" approach is to mark the sstables involved 
obsolete, which if compaction succeeded
              // is harmlessly redundant, and if it failed ensures that at 
least the sstable will get deleted on restart.
              for (SSTableReader sstable : unmark)
 -                sstable.markCompacted();
 +                sstable.markObsolete();
          }
  
          View currentView, newView;
@@@ -221,9 -211,17 +222,17 @@@
              newView = currentView.unmarkCompacting(unmark);
          }
          while (!view.compareAndSet(currentView, newView));
+ 
+         if (!isValid)
+         {
+             // when the CFS is invalidated, it will call 
unreferenceSSTables().  However, unreferenceSSTables only deals
+             // with sstables that aren't currently being compacted.  If there 
are ongoing compactions that finish or are
+             // interrupted after the CFS is invalidated, those sstables need 
to be unreferenced as well, so we do that here.
+             unreferenceSSTables();
+         }
      }
  
 -    public void markCompacted(Collection<SSTableReader> sstables, 
OperationType compactionType)
 +    public void markObsolete(Collection<SSTableReader> sstables, 
OperationType compactionType)
      {
          replace(sstables, Collections.<SSTableReader>emptyList());
          notifySSTablesChanged(sstables, 
Collections.<SSTableReader>emptyList(), compactionType);
@@@ -360,8 -360,13 +369,13 @@@
              long size = sstable.bytesOnDisk();
              StorageMetrics.load.dec(size);
              cfstore.metric.liveDiskSpaceUsed.dec(size);
+ 
+             // tolerateCompacted will be true when the CFS is no longer valid 
(dropped). If there were ongoing
+             // compactions when it was invalidated, sstables may already be 
marked compacted, so we should
+             // tolerate that (see CASSANDRA-5957)
 -            boolean firstToCompact = sstable.markCompacted();
 +            boolean firstToCompact = sstable.markObsolete();
-             assert firstToCompact : sstable + " was already marked compacted";
+             assert (tolerateCompacted || firstToCompact) : sstable + " was 
already marked compacted";
+ 
              sstable.releaseReference();
          }
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/810f0678/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index abd7c9f,ed221d9..cb0873d
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@@ -1102,10 -1003,10 +1102,10 @@@ public class SSTableReader extends SSTa
       * When calling this function, the caller must ensure that the 
SSTableReader is not referenced anywhere
       * except for threads holding a reference.
       *
-      * @return true if the this is the first time the file was marked 
compacted.  Calling this
-      * multiple times would be buggy.
 -     * @return true if the this is the first time the file was marked 
compacted.  With rare exceptions
 -     * (see DataTracker.unmarkCompacted) calling this multiple times would be 
buggy.
++     * @return true if the this is the first time the file was marked 
obsolete.  Calling this
++     * multiple times is usually buggy (see exceptions in 
DataTracker.unmarkCompacting and removeOldSSTablesSize).
       */
 -    public boolean markCompacted()
 +    public boolean markObsolete()
      {
          if (logger.isDebugEnabled())
              logger.debug("Marking " + getFilename() + " compacted");

Reply via email to