cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [4/6] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Thu, 04 Dec 2014 23:30:30 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/compaction/CompactionManager.java


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

Branch: refs/heads/trunk
Commit: b7a0cd9e6037a0fb21a5fb64310c50cd39e35496
Parents: 587657d ceed3a2
Author: Yuki Morishita <yukim@apache.org>
Authored: Thu Dec 4 17:26:59 2014 -0600
Committer: Yuki Morishita <yukim@apache.org>
Committed: Thu Dec 4 17:26:59 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/db/ColumnFamilyStore.java  | 36 ++++++++++++++++++--
 2 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a0cd9e/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 041c1e1,79c2d81..145347b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -33,35 -16,7 +33,36 @@@ Merged from 2.0
   * Avoid overlap in L1 when L0 contains many nonoverlapping
     sstables (CASSANDRA-8211)
   * Improve PropertyFileSnitch logging (CASSANDRA-8183)
 - * Abort liveRatio calculation if the memtable is flushed (CASSANDRA-8164)
 + * Add DC-aware sequential repair (CASSANDRA-8193)
++ * Use live sstables in snapshot repair if possible (CASSANDRA-8312)
 +
 +
 +2.1.2
 + * (cqlsh) parse_for_table_meta errors out on queries with undefined
 +   grammars (CASSANDRA-8262)
 + * (cqlsh) Fix SELECT ... TOKEN() function broken in C* 2.1.1 (CASSANDRA-8258)
 + * Fix Cassandra crash when running on JDK8 update 40 (CASSANDRA-8209)
 + * Optimize partitioner tokens (CASSANDRA-8230)
 + * Improve compaction of repaired/unrepaired sstables (CASSANDRA-8004)
 + * Make cache serializers pluggable (CASSANDRA-8096)
 + * Fix issues with CONTAINS (KEY) queries on secondary indexes
 +   (CASSANDRA-8147)
 + * Fix read-rate tracking of sstables for some queries (CASSANDRA-8239)
 + * Fix default timestamp in QueryOptions (CASSANDRA-8246)
 + * Set socket timeout when reading remote version (CASSANDRA-8188)
 + * Refactor how we track live size (CASSANDRA-7852)
 + * Make sure unfinished compaction files are removed (CASSANDRA-8124)
 + * Fix shutdown when run as Windows service (CASSANDRA-8136)
 + * Fix DESCRIBE TABLE with custom indexes (CASSANDRA-8031)
 + * Fix race in RecoveryManagerTest (CASSANDRA-8176)
 + * Avoid IllegalArgumentException while sorting sstables in
 +   IndexSummaryManager (CASSANDRA-8182)
 + * Shutdown JVM on file descriptor exhaustion (CASSANDRA-7579)
 + * Add 'die' policy for commit log and disk failure (CASSANDRA-7927)
 + * Fix installing as service on Windows (CASSANDRA-8115)
 + * Fix CREATE TABLE for CQL2 (CASSANDRA-8144)
 + * Avoid boxing in ColumnStats min/max trackers (CASSANDRA-8109)
 +Merged from 2.0:
   * Correctly handle non-text column names in cql3 (CASSANDRA-8178)
   * Fix deletion for indexes on primary key columns (CASSANDRA-8206)
   * Add 'nodetool statusgossip' (CASSANDRA-8125)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a0cd9e/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 0507973,b5c6c98..be89318
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -2165,32 -1838,42 +2165,62 @@@ public class ColumnFamilyStore implemen
          }
      }
  
 +    private void writeSnapshotManifest(final JSONArray filesJSONArr, final String snapshotName)
 +    {
 +        final File manifestFile = directories.getSnapshotManifestFile(snapshotName);
 +        final JSONObject manifestJSON = new JSONObject();
 +        manifestJSON.put("files", filesJSONArr);
 +
 +        try
 +        {
 +            if (!manifestFile.getParentFile().exists())
 +                manifestFile.getParentFile().mkdirs();
 +            PrintStream out = new PrintStream(manifestFile);
 +            out.println(manifestJSON.toJSONString());
 +            out.close();
 +        }
 +        catch (IOException e)
 +        {
 +            throw new FSWriteError(e, manifestFile);
 +        }
 +    }
 +
      public List<SSTableReader> getSnapshotSSTableReader(String tag) throws IOException
      {
+         Map<Integer, SSTableReader> active = new HashMap<>();
+         for (SSTableReader sstable : data.getView().sstables)
+             active.put(sstable.descriptor.generation, sstable);
          Map<Descriptor, Set<Component>> snapshots = directories.sstableLister().snapshots(tag).list();
-         List<SSTableReader> readers = new ArrayList<SSTableReader>(snapshots.size());
-         for (Map.Entry<Descriptor, Set<Component>> entries : snapshots.entrySet())
-             readers.add(SSTableReader.open(entries.getKey(), entries.getValue(), metadata,
partitioner));
+         List<SSTableReader> readers = new ArrayList<>(snapshots.size());
+         try
+         {
+             for (Map.Entry<Descriptor, Set<Component>> entries : snapshots.entrySet())
+             {
+                 // Try acquire reference to an active sstable instead of snapshot if it
exists,
+                 // to avoid opening new sstables. If it fails, use the snapshot reference
instead.
+                 SSTableReader sstable = active.get(entries.getKey().generation);
+                 if (sstable == null || !sstable.acquireReference())
+                 {
+                     if (logger.isDebugEnabled())
+                         logger.debug("using snapshot sstable " + entries.getKey());
+                     sstable = SSTableReader.open(entries.getKey(), entries.getValue(), metadata,
partitioner);
+                     // This is technically not necessary since it's a snapshot but makes
things easier
+                     sstable.acquireReference();
+                 }
+                 else if (logger.isDebugEnabled())
+                 {
+                     logger.debug("using active sstable " + entries.getKey());
+                 }
+                 readers.add(sstable);
+             }
+         }
+         catch (IOException | RuntimeException e)
+         {
+             // In case one of the snapshot sstables fails to open,
+             // we must release the references to the ones we opened so far
+             SSTableReader.releaseReferences(readers);
+             throw e;
+         }
          return readers;
      }
  


Mime
View raw message