cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Compression chunk_length shouldn't be mandatory
Date Thu, 27 Jun 2013 07:56:14 GMT
Updated Branches:
  refs/heads/trunk 753dc9927 -> c06244916


Compression chunk_length shouldn't be mandatory

patch by slebresne; reviewed by iamaleksey for CASSANDRA-507


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

Branch: refs/heads/trunk
Commit: c06244916ad3b3527345f4a6b6130214ddc987fb
Parents: 753dc99
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Jun 27 09:54:50 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Jun 27 09:54:50 2013 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cql3/CFPropDefs.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c0624491/src/java/org/apache/cassandra/cql3/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFPropDefs.java b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
index 2416df9..94b22ff 100644
--- a/src/java/org/apache/cassandra/cql3/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
@@ -99,28 +99,28 @@ public class CFPropDefs extends PropertyDefinitions
 
             CFMetaData.validateCompactionOptions(compactionStrategyClass, compactionOptions);
         }
-        
+
         Map<String, String> compressionOptions = getCompressionOptions();
         if (!compressionOptions.isEmpty())
         {
             String sstableCompressionClass = compressionOptions.get(CompressionParameters.SSTABLE_COMPRESSION);
             if (sstableCompressionClass == null)
                 throw new ConfigurationException("Missing sub-option '" + CompressionParameters.SSTABLE_COMPRESSION
+ "' for the '" + KW_COMPRESSION + "' option.");
-                
-            String chunkLength = compressionOptions.get(CompressionParameters.CHUNK_LENGTH_KB);
-            if (chunkLength == null)
-                throw new ConfigurationException("Missing sub-option '" + CompressionParameters.CHUNK_LENGTH_KB
+ "' for the '" + KW_COMPRESSION + "' option.");
-                
+
+            Integer chunkLength = CompressionParameters.DEFAULT_CHUNK_LENGTH;
+            if (compressionOptions.containsKey(CompressionParameters.CHUNK_LENGTH_KB))
+                chunkLength = CompressionParameters.parseChunkLength(compressionOptions.get(CompressionParameters.CHUNK_LENGTH_KB));
+
             Map<String, String> remainingOptions = new HashMap<String, String>(compressionOptions);
             remainingOptions.remove(CompressionParameters.SSTABLE_COMPRESSION);
             remainingOptions.remove(CompressionParameters.CHUNK_LENGTH_KB);
-            CompressionParameters cp = new CompressionParameters(sstableCompressionClass,
CompressionParameters.parseChunkLength(chunkLength), remainingOptions);
+            CompressionParameters cp = new CompressionParameters(sstableCompressionClass,
chunkLength, remainingOptions);
             cp.validate();
         }
 
         validateMinimumInt(KW_DEFAULT_TIME_TO_LIVE, 0, CFMetaData.DEFAULT_DEFAULT_TIME_TO_LIVE);
         validateMinimumInt(KW_INDEX_INTERVAL, 1, CFMetaData.DEFAULT_INDEX_INTERVAL);
-        
+
         SpeculativeRetry.fromString(getString(KW_SPECULATIVE_RETRY, SpeculativeRetry.RetryType.NONE.name()));
     }
 


Mime
View raw message