cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject cassandra git commit: Followup to CASSANDRA-8671 - additional data directories
Date Fri, 16 Oct 2015 10:32:21 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 f3143e624 -> e1fb18a00


Followup to CASSANDRA-8671 - additional data directories

Patch by Blake Eggleston; reviewed by marcuse for CASSANDRA-10518


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

Branch: refs/heads/cassandra-3.0
Commit: e1fb18a00b598431f52b88d12e2eddbe07233e88
Parents: f3143e6
Author: Blake Eggleston <bdeggleston@gmail.com>
Authored: Thu Oct 15 14:14:37 2015 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Fri Oct 16 12:30:59 2015 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 12 ++++++++----
 .../db/compaction/AbstractCompactionStrategy.java       |  6 +++++-
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1fb18a0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 062eb0a..4c9fc55 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -84,12 +84,17 @@ import static org.apache.cassandra.utils.Throwables.maybeFail;
 
 public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 {
-    // the directories used to load sstables on cfs instantiation
+    // The directories which will be searched for sstables on cfs instantiation.
     private static volatile Directories.DataDirectory[] initialDirectories = Directories.dataDirectories;
 
     /**
-     * a hook to add additional directories to initialDirectories.
+     * A hook to add additional directories to initialDirectories.
      * Any additional directories should be added prior to ColumnFamilyStore instantiation
on startup
+     *
+     * Since the directories used by a given table are determined by the compaction strategy,
+     * it's possible for sstables to be written to directories specified outside of cassandra.yaml.
+     * By adding additional directories to initialDirectories, sstables in these extra locations
are
+     * made discoverable on sstable instantiation.
      */
     public static synchronized void addInitialDirectories(Directories.DataDirectory[] newDirectories)
     {
@@ -363,7 +368,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
         this.keyspace = keyspace;
         this.metadata = metadata;
-        this.directories = directories;
         name = columnFamilyName;
         minCompactionThreshold = new DefaultValue<>(metadata.params.compaction.minCompactionThreshold());
         maxCompactionThreshold = new DefaultValue<>(metadata.params.compaction.maxCompactionThreshold());
@@ -388,7 +392,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
         // compaction strategy should be created after the CFS has been prepared
         compactionStrategyManager = new CompactionStrategyManager(this);
-        this.directories = this.compactionStrategyManager.getDirectories();
+        this.directories = compactionStrategyManager.getDirectories();
 
         if (maxCompactionThreshold.value() <= 0 || minCompactionThreshold.value() <=0)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1fb18a0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
index 721fd70..ae8839e 100644
--- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
@@ -78,6 +78,8 @@ public abstract class AbstractCompactionStrategy
     protected boolean uncheckedTombstoneCompaction;
     protected boolean disableTombstoneCompactions = false;
 
+    private final Directories directories;
+
     /**
      * pause/resume/getNextBackgroundTask must synchronize.  This guarantees that after pause
completes,
      * no new tasks will be generated; or put another way, pause can't run until in-progress
tasks are
@@ -117,11 +119,13 @@ public abstract class AbstractCompactionStrategy
             tombstoneCompactionInterval = DEFAULT_TOMBSTONE_COMPACTION_INTERVAL;
             uncheckedTombstoneCompaction = DEFAULT_UNCHECKED_TOMBSTONE_COMPACTION_OPTION;
         }
+
+        directories = new Directories(cfs.metadata, Directories.dataDirectories);
     }
 
     public Directories getDirectories()
     {
-        return cfs.getDirectories();
+        return directories;
     }
 
     /**


Mime
View raw message