cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [2/3] cassandra git commit: Config class uses boxed types but DD exposes primitive types
Date Wed, 05 Oct 2016 07:43:19 GMT
Config class uses boxed types but DD exposes primitive types

patch by Robert Stupp; reviewed by Carl Yeksigian for CASSANDRA-12199


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

Branch: refs/heads/trunk
Commit: b3a4e2005efca1b732f1ab30f89ec8b9541ca81b
Parents: 9fd0d07
Author: Robert Stupp <snazy@snazy.de>
Authored: Wed Oct 5 09:39:03 2016 +0200
Committer: Robert Stupp <snazy@snazy-ds15.fritz.box>
Committed: Wed Oct 5 09:39:03 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 .../org/apache/cassandra/config/Config.java     | 116 ++++++-------
 .../cassandra/config/DatabaseDescriptor.java    | 164 ++++++++++---------
 .../org/apache/cassandra/db/SystemKeyspace.java |   2 +-
 .../db/commitlog/CommitLogReplayer.java         |   5 +-
 .../compaction/LeveledCompactionStrategy.java   |  14 +-
 .../cassandra/net/IncomingTcpConnection.java    |   2 +-
 .../cassandra/net/OutboundTcpConnection.java    |   2 +-
 .../repair/SystemDistributedKeyspace.java       |   3 +-
 .../apache/cassandra/schema/SchemaKeyspace.java |   2 +-
 10 files changed, 160 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d86a36c..08de041 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.10
+ * Config class uses boxed types but DD exposes primitive types (CASSANDRA-12199)
  * Add pre- and post-shutdown hooks to Storage Service (CASSANDRA-12461)
  * Add hint delivery metrics (CASSANDRA-12693)
  * Remove IndexInfo cache from FileIndexInfoRetriever (CASSANDRA-12731)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 35a17a5..b1318d9 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -63,10 +63,10 @@ public class Config
     /* Hashing strategy Random or OPHF */
     public String partitioner;
 
-    public Boolean auto_bootstrap = true;
+    public boolean auto_bootstrap = true;
     public volatile boolean hinted_handoff_enabled = true;
     public Set<String> hinted_handoff_disabled_datacenters = Sets.newConcurrentHashSet();
-    public volatile Integer max_hint_window_in_ms = 3 * 3600 * 1000; // three hours
+    public volatile int max_hint_window_in_ms = 3 * 3600 * 1000; // three hours
     public String hints_directory;
 
     public ParameterizedClass seed_provider;
@@ -77,29 +77,29 @@ public class Config
 
     /* initial token in the ring */
     public String initial_token;
-    public Integer num_tokens = 1;
+    public int num_tokens = 1;
     /** Triggers automatic allocation of tokens if set, using the replication strategy of
the referenced keyspace */
     public String allocate_tokens_for_keyspace = null;
 
-    public volatile Long request_timeout_in_ms = 10000L;
+    public volatile long request_timeout_in_ms = 10000L;
 
-    public volatile Long read_request_timeout_in_ms = 5000L;
+    public volatile long read_request_timeout_in_ms = 5000L;
 
-    public volatile Long range_request_timeout_in_ms = 10000L;
+    public volatile long range_request_timeout_in_ms = 10000L;
 
-    public volatile Long write_request_timeout_in_ms = 2000L;
+    public volatile long write_request_timeout_in_ms = 2000L;
 
-    public volatile Long counter_write_request_timeout_in_ms = 5000L;
+    public volatile long counter_write_request_timeout_in_ms = 5000L;
 
-    public volatile Long cas_contention_timeout_in_ms = 1000L;
+    public volatile long cas_contention_timeout_in_ms = 1000L;
 
-    public volatile Long truncate_request_timeout_in_ms = 60000L;
+    public volatile long truncate_request_timeout_in_ms = 60000L;
 
     /**
      * @deprecated use {@link this#streaming_keep_alive_period_in_secs} instead
      */
     @Deprecated
-    public Integer streaming_socket_timeout_in_ms = 86400000; //24 hours
+    public int streaming_socket_timeout_in_ms = 86400000; //24 hours
 
     public Integer streaming_keep_alive_period_in_secs = 300; //5 minutes
 
@@ -107,88 +107,88 @@ public class Config
 
     public volatile long slow_query_log_timeout_in_ms = 500L;
 
-    public volatile Double phi_convict_threshold = 8.0;
+    public volatile double phi_convict_threshold = 8.0;
 
-    public Integer concurrent_reads = 32;
-    public Integer concurrent_writes = 32;
-    public Integer concurrent_counter_writes = 32;
-    public Integer concurrent_materialized_view_writes = 32;
+    public int concurrent_reads = 32;
+    public int concurrent_writes = 32;
+    public int concurrent_counter_writes = 32;
+    public int concurrent_materialized_view_writes = 32;
 
     @Deprecated
     public Integer concurrent_replicates = null;
 
-    public Integer memtable_flush_writers = null;
+    public int memtable_flush_writers = 0;
     public Integer memtable_heap_space_in_mb;
     public Integer memtable_offheap_space_in_mb;
     public Float memtable_cleanup_threshold = null;
 
-    public Integer storage_port = 7000;
-    public Integer ssl_storage_port = 7001;
+    public int storage_port = 7000;
+    public int ssl_storage_port = 7001;
     public String listen_address;
     public String listen_interface;
-    public Boolean listen_interface_prefer_ipv6 = false;
+    public boolean listen_interface_prefer_ipv6 = false;
     public String broadcast_address;
-    public Boolean listen_on_broadcast_address = false;
+    public boolean listen_on_broadcast_address = false;
     public String internode_authenticator;
 
     /* intentionally left set to true, despite being set to false in stock 2.2 cassandra.yaml
        we don't want to surprise Thrift users who have the setting blank in the yaml during
2.1->2.2 upgrade */
-    public Boolean start_rpc = true;
+    public boolean start_rpc = true;
     public String rpc_address;
     public String rpc_interface;
-    public Boolean rpc_interface_prefer_ipv6 = false;
+    public boolean rpc_interface_prefer_ipv6 = false;
     public String broadcast_rpc_address;
-    public Integer rpc_port = 9160;
-    public Integer rpc_listen_backlog = 50;
+    public int rpc_port = 9160;
+    public int rpc_listen_backlog = 50;
     public String rpc_server_type = "sync";
-    public Boolean rpc_keepalive = true;
-    public Integer rpc_min_threads = 16;
-    public Integer rpc_max_threads = Integer.MAX_VALUE;
+    public boolean rpc_keepalive = true;
+    public int rpc_min_threads = 16;
+    public int rpc_max_threads = Integer.MAX_VALUE;
     public Integer rpc_send_buff_size_in_bytes;
     public Integer rpc_recv_buff_size_in_bytes;
-    public Integer internode_send_buff_size_in_bytes;
-    public Integer internode_recv_buff_size_in_bytes;
+    public int internode_send_buff_size_in_bytes = 0;
+    public int internode_recv_buff_size_in_bytes = 0;
 
-    public Boolean start_native_transport = false;
-    public Integer native_transport_port = 9042;
+    public boolean start_native_transport = false;
+    public int native_transport_port = 9042;
     public Integer native_transport_port_ssl = null;
-    public Integer native_transport_max_threads = 128;
-    public Integer native_transport_max_frame_size_in_mb = 256;
-    public volatile Long native_transport_max_concurrent_connections = -1L;
-    public volatile Long native_transport_max_concurrent_connections_per_ip = -1L;
+    public int native_transport_max_threads = 128;
+    public int native_transport_max_frame_size_in_mb = 256;
+    public volatile long native_transport_max_concurrent_connections = -1L;
+    public volatile long native_transport_max_concurrent_connections_per_ip = -1L;
 
     @Deprecated
-    public Integer thrift_max_message_length_in_mb = 16;
+    public int thrift_max_message_length_in_mb = 16;
     /**
      * Max size of values in SSTables, in MegaBytes.
      * Default is the same as the native protocol frame limit: 256Mb.
      * See AbstractType for how it is used.
      */
-    public Integer max_value_size_in_mb = 256;
+    public int max_value_size_in_mb = 256;
 
-    public Integer thrift_framed_transport_size_in_mb = 15;
-    public Boolean snapshot_before_compaction = false;
-    public Boolean auto_snapshot = true;
+    public int thrift_framed_transport_size_in_mb = 15;
+    public boolean snapshot_before_compaction = false;
+    public boolean auto_snapshot = true;
 
     /* if the size of columns or super-columns are more than this, indexing will kick in
*/
-    public Integer column_index_size_in_kb = 64;
-    public Integer column_index_cache_size_in_kb = 2;
+    public int column_index_size_in_kb = 64;
+    public int column_index_cache_size_in_kb = 2;
     public volatile int batch_size_warn_threshold_in_kb = 5;
     public volatile int batch_size_fail_threshold_in_kb = 50;
     public Integer unlogged_batch_across_partitions_warn_threshold = 10;
     public volatile Integer concurrent_compactors;
-    public volatile Integer compaction_throughput_mb_per_sec = 16;
-    public volatile Integer compaction_large_partition_warning_threshold_mb = 100;
-    public Integer min_free_space_per_drive_in_mb = 50;
+    public volatile int compaction_throughput_mb_per_sec = 16;
+    public volatile int compaction_large_partition_warning_threshold_mb = 100;
+    public int min_free_space_per_drive_in_mb = 50;
 
     /**
      * @deprecated retry support removed on CASSANDRA-10992
      */
     @Deprecated
-    public Integer max_streaming_retries = 3;
+    public int max_streaming_retries = 3;
 
-    public volatile Integer stream_throughput_outbound_megabits_per_sec = 200;
-    public volatile Integer inter_dc_stream_throughput_outbound_megabits_per_sec = 200;
+    public volatile int stream_throughput_outbound_megabits_per_sec = 200;
+    public volatile int inter_dc_stream_throughput_outbound_megabits_per_sec = 200;
 
     public String[] data_file_directories = new String[0];
 
@@ -198,8 +198,8 @@ public class Config
     public String commitlog_directory;
     public Integer commitlog_total_space_in_mb;
     public CommitLogSync commitlog_sync;
-    public Double commitlog_sync_batch_window_in_ms;
-    public Integer commitlog_sync_period_in_ms;
+    public double commitlog_sync_batch_window_in_ms = Double.NaN;
+    public int commitlog_sync_period_in_ms;
     public int commitlog_segment_size_in_mb = 32;
     public ParameterizedClass commitlog_compression;
     public int commitlog_max_compression_buffers_in_pool = 3;
@@ -208,19 +208,19 @@ public class Config
     public Integer max_mutation_size_in_kb;
 
     // Change-data-capture logs
-    public Boolean cdc_enabled = false;
+    public boolean cdc_enabled = false;
     public String cdc_raw_directory;
-    public Integer cdc_total_space_in_mb;
-    public Integer cdc_free_space_check_interval_ms = 250;
+    public int cdc_total_space_in_mb = 0;
+    public int cdc_free_space_check_interval_ms = 250;
 
     @Deprecated
     public int commitlog_periodic_queue_size = -1;
 
     public String endpoint_snitch;
-    public Boolean dynamic_snitch = true;
-    public volatile Integer dynamic_snitch_update_interval_in_ms = 100;
-    public volatile Integer dynamic_snitch_reset_interval_in_ms = 600000;
-    public volatile Double dynamic_snitch_badness_threshold = 0.1;
+    public boolean dynamic_snitch = true;
+    public int dynamic_snitch_update_interval_in_ms = 100;
+    public int dynamic_snitch_reset_interval_in_ms = 600000;
+    public double dynamic_snitch_badness_threshold = 0.1;
 
     public String request_scheduler;
     public RequestSchedulerId request_scheduler_id;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 36def79..5041186 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -120,6 +120,11 @@ public class DatabaseDescriptor
     private static boolean toolInitialized;
     private static boolean daemonInitialized;
 
+    private static final int searchConcurrencyFactor = Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX
+ "search_concurrency_factor", "1"));
+
+    private static final boolean disableSTCSInL0 = Boolean.getBoolean(Config.PROPERTY_PREFIX
+ "disable_stcs_in_l0");
+    private static final boolean unsafeSystem = Boolean.getBoolean(Config.PROPERTY_PREFIX
+ "unsafesystem");
+
     public static void daemonInitialization() throws ConfigurationException
     {
         if (toolInitialized)
@@ -249,7 +254,7 @@ public class DatabaseDescriptor
     @VisibleForTesting
     public static Config loadConfig() throws ConfigurationException
     {
-        String loaderClass = System.getProperty("cassandra.config.loader");
+        String loaderClass = System.getProperty(Config.PROPERTY_PREFIX + "config.loader");
         ConfigurationLoader loader = loaderClass == null
                                    ? new YamlConfigurationLoader()
                                    : FBUtilities.<ConfigurationLoader>construct(loaderClass,
"configuration loading");
@@ -330,11 +335,11 @@ public class DatabaseDescriptor
 
         if (conf.commitlog_sync == Config.CommitLogSync.batch)
         {
-            if (conf.commitlog_sync_batch_window_in_ms == null)
+            if (Double.isNaN(conf.commitlog_sync_batch_window_in_ms) || conf.commitlog_sync_batch_window_in_ms
<= 0d)
             {
-                throw new ConfigurationException("Missing value for commitlog_sync_batch_window_in_ms:
Double expected.", false);
+                throw new ConfigurationException("Missing value for commitlog_sync_batch_window_in_ms:
positive double value expected.", false);
             }
-            else if (conf.commitlog_sync_period_in_ms != null)
+            else if (conf.commitlog_sync_period_in_ms != 0)
             {
                 throw new ConfigurationException("Batch sync specified, but commitlog_sync_period_in_ms
found. Only specify commitlog_sync_batch_window_in_ms when using batch sync", false);
             }
@@ -342,11 +347,11 @@ public class DatabaseDescriptor
         }
         else
         {
-            if (conf.commitlog_sync_period_in_ms == null)
+            if (conf.commitlog_sync_period_in_ms <= 0)
             {
-                throw new ConfigurationException("Missing value for commitlog_sync_period_in_ms:
Integer expected", false);
+                throw new ConfigurationException("Missing value for commitlog_sync_period_in_ms:
positive integer expected", false);
             }
-            else if (conf.commitlog_sync_batch_window_in_ms != null)
+            else if (!Double.isNaN(conf.commitlog_sync_batch_window_in_ms))
             {
                 throw new ConfigurationException("commitlog_sync_period_in_ms specified,
but commitlog_sync_batch_window_in_ms found.  Only specify commitlog_sync_period_in_ms when
using periodic sync.", false);
             }
@@ -377,11 +382,6 @@ public class DatabaseDescriptor
             throw new ConfigurationException("gc_warn_threshold_in_ms must be a positive
integer");
         }
 
-        if (conf.max_hint_window_in_ms == null)
-        {
-            throw new ConfigurationException("max_hint_window_in_ms cannot be set to null",
false);
-        }
-
         /* phi convict threshold for FailureDetector */
         if (conf.phi_convict_threshold < 5 || conf.phi_convict_threshold > 16)
         {
@@ -389,17 +389,17 @@ public class DatabaseDescriptor
         }
 
         /* Thread per pool */
-        if (conf.concurrent_reads != null && conf.concurrent_reads < 2)
+        if (conf.concurrent_reads < 2)
         {
             throw new ConfigurationException("concurrent_reads must be at least 2, but was
" + conf.concurrent_reads, false);
         }
 
-        if (conf.concurrent_writes != null && conf.concurrent_writes < 2)
+        if (conf.concurrent_writes < 2)
         {
             throw new ConfigurationException("concurrent_writes must be at least 2, but was
" + conf.concurrent_writes, false);
         }
 
-        if (conf.concurrent_counter_writes != null && conf.concurrent_counter_writes
< 2)
+        if (conf.concurrent_counter_writes < 2)
             throw new ConfigurationException("concurrent_counter_writes must be at least
2, but was " + conf.concurrent_counter_writes, false);
 
         if (conf.concurrent_replicates != null)
@@ -433,26 +433,17 @@ public class DatabaseDescriptor
         // use -Dcassandra.storagedir (set in cassandra-env.sh) as the parent dir for data/,
commitlog/, and saved_caches/
         if (conf.commitlog_directory == null)
         {
-            conf.commitlog_directory = System.getProperty("cassandra.storagedir", null);
-            if (conf.commitlog_directory == null)
-                throw new ConfigurationException("commitlog_directory is missing and -Dcassandra.storagedir
is not set", false);
-            conf.commitlog_directory += File.separator + "commitlog";
+            conf.commitlog_directory = storagedirFor("commitlog");
         }
 
         if (conf.hints_directory == null)
         {
-            conf.hints_directory = System.getProperty("cassandra.storagedir", null);
-            if (conf.hints_directory == null)
-                throw new ConfigurationException("hints_directory is missing and -Dcassandra.storagedir
is not set", false);
-            conf.hints_directory += File.separator + "hints";
+            conf.hints_directory = storagedirFor("hints");
         }
 
         if (conf.cdc_raw_directory == null)
         {
-            conf.cdc_raw_directory = System.getProperty("cassandra.storagedir", null);
-            if (conf.cdc_raw_directory == null)
-                throw new ConfigurationException("cdc_raw_directory is missing and -Dcassandra.storagedir
is not set", false);
-            conf.cdc_raw_directory += File.separator + "cdc_raw";
+            conf.cdc_raw_directory = storagedirFor("cdc_raw");
         }
 
         if (conf.commitlog_total_space_in_mb == null)
@@ -482,7 +473,7 @@ public class DatabaseDescriptor
             }
         }
 
-        if (conf.cdc_total_space_in_mb == null)
+        if (conf.cdc_total_space_in_mb == 0)
         {
             int preferredSize = 4096;
             int minSize = 0;
@@ -509,24 +500,18 @@ public class DatabaseDescriptor
             }
         }
 
-        if (conf.cdc_enabled == true)
+        if (conf.cdc_enabled)
         {
             logger.info("cdc_enabled is true. Starting casssandra node with Change-Data-Capture
enabled.");
         }
 
         if (conf.saved_caches_directory == null)
         {
-            conf.saved_caches_directory = System.getProperty("cassandra.storagedir", null);
-            if (conf.saved_caches_directory == null)
-                throw new ConfigurationException("saved_caches_directory is missing and -Dcassandra.storagedir
is not set", false);
-            conf.saved_caches_directory += File.separator + "saved_caches";
+            conf.saved_caches_directory = storagedirFor("saved_caches");
         }
         if (conf.data_file_directories == null || conf.data_file_directories.length == 0)
         {
-            String defaultDataDir = System.getProperty("cassandra.storagedir", null);
-            if (defaultDataDir == null)
-                throw new ConfigurationException("data_file_directories is not missing and
-Dcassandra.storagedir is not set", false);
-            conf.data_file_directories = new String[]{ defaultDataDir + File.separator +
"data" };
+            conf.data_file_directories = new String[]{ storagedir("data_file_directories")
+ File.separator + "data" };
         }
 
         long dataFreeBytes = 0;
@@ -563,7 +548,7 @@ public class DatabaseDescriptor
         if (conf.hints_directory.equals(conf.saved_caches_directory))
             throw new ConfigurationException("saved_caches_directory must not be the same
as the hints_directory", false);
 
-        if (conf.memtable_flush_writers == null)
+        if (conf.memtable_flush_writers == 0)
         {
             conf.memtable_flush_writers = conf.data_file_directories.length == 1 ? 2 : 1;
         }
@@ -593,9 +578,7 @@ public class DatabaseDescriptor
         if (conf.concurrent_compactors <= 0)
             throw new ConfigurationException("concurrent_compactors should be strictly greater
than 0, but was " + conf.concurrent_compactors, false);
 
-        if (conf.num_tokens == null)
-            conf.num_tokens = 1;
-        else if (conf.num_tokens > MAX_NUM_TOKENS)
+        if (conf.num_tokens > MAX_NUM_TOKENS)
             throw new ConfigurationException(String.format("A maximum number of %d tokens
per node is supported", MAX_NUM_TOKENS), false);
 
         try
@@ -671,6 +654,9 @@ public class DatabaseDescriptor
             throw new ConfigurationException("index_summary_capacity_in_mb option was set
incorrectly to '"
                                              + conf.index_summary_capacity_in_mb + "', it
should be a non-negative integer.", false);
 
+        if (conf.index_interval != null)
+            logger.warn("index_interval has been deprecated and should be removed from cassandra.yaml");
+
         if(conf.encryption_options != null)
         {
             logger.warn("Please rename encryption_options as server_encryption_options in
the yaml");
@@ -693,13 +679,13 @@ public class DatabaseDescriptor
 
         // native transport encryption options
         if (conf.native_transport_port_ssl != null
-            && conf.native_transport_port_ssl.intValue() != conf.native_transport_port.intValue()
+            && conf.native_transport_port_ssl != conf.native_transport_port
             && !conf.client_encryption_options.enabled)
         {
             throw new ConfigurationException("Encryption must be enabled in client_encryption_options
for native_transport_port_ssl", false);
         }
 
-        if (conf.max_value_size_in_mb == null || conf.max_value_size_in_mb <= 0)
+        if (conf.max_value_size_in_mb <= 0)
             throw new ConfigurationException("max_value_size_in_mb must be positive", false);
 
         switch (conf.disk_optimization_strategy)
@@ -734,6 +720,19 @@ public class DatabaseDescriptor
         }
     }
 
+    private static String storagedirFor(String type)
+    {
+        return storagedir(type + "_directory") + File.separator + type;
+    }
+
+    private static String storagedir(String errMsgType)
+    {
+        String storagedir = System.getProperty(Config.PROPERTY_PREFIX + "storagedir", null);
+        if (storagedir == null)
+            throw new ConfigurationException(errMsgType + " is missing and -Dcassandra.storagedir
is not set", false);
+        return storagedir;
+    }
+
     public static void applyAddressConfig() throws ConfigurationException
     {
         applyAddressConfig(conf);
@@ -965,7 +964,7 @@ public class DatabaseDescriptor
         }
         try
         {
-            partitioner = FBUtilities.newPartitioner(System.getProperty("cassandra.partitioner",
conf.partitioner));
+            partitioner = FBUtilities.newPartitioner(System.getProperty(Config.PROPERTY_PREFIX
+ "partitioner", conf.partitioner));
         }
         catch (Exception e)
         {
@@ -1281,12 +1280,12 @@ public class DatabaseDescriptor
 
     public static Collection<String> getInitialTokens()
     {
-        return tokensFromString(System.getProperty("cassandra.initial_token", conf.initial_token));
+        return tokensFromString(System.getProperty(Config.PROPERTY_PREFIX + "initial_token",
conf.initial_token));
     }
 
     public static String getAllocateTokensForKeyspace()
     {
-        return System.getProperty("cassandra.allocate_tokens_for_keyspace", conf.allocate_tokens_for_keyspace);
+        return System.getProperty(Config.PROPERTY_PREFIX + "allocate_tokens_for_keyspace",
conf.allocate_tokens_for_keyspace);
     }
 
     public static Collection<String> tokensFromString(String tokenString)
@@ -1298,7 +1297,7 @@ public class DatabaseDescriptor
         return tokens;
     }
 
-    public static Integer getNumTokens()
+    public static int getNumTokens()
     {
         return conf.num_tokens;
     }
@@ -1307,10 +1306,10 @@ public class DatabaseDescriptor
     {
         try
         {
-            if (System.getProperty("cassandra.replace_address", null) != null)
-                return InetAddress.getByName(System.getProperty("cassandra.replace_address",
null));
-            else if (System.getProperty("cassandra.replace_address_first_boot", null) !=
null)
-                return InetAddress.getByName(System.getProperty("cassandra.replace_address_first_boot",
null));
+            if (System.getProperty(Config.PROPERTY_PREFIX + "replace_address", null) != null)
+                return InetAddress.getByName(System.getProperty(Config.PROPERTY_PREFIX +
"replace_address", null));
+            else if (System.getProperty(Config.PROPERTY_PREFIX + "replace_address_first_boot",
null) != null)
+                return InetAddress.getByName(System.getProperty(Config.PROPERTY_PREFIX +
"replace_address_first_boot", null));
             return null;
         }
         catch (UnknownHostException e)
@@ -1321,14 +1320,14 @@ public class DatabaseDescriptor
 
     public static Collection<String> getReplaceTokens()
     {
-        return tokensFromString(System.getProperty("cassandra.replace_token", null));
+        return tokensFromString(System.getProperty(Config.PROPERTY_PREFIX + "replace_token",
null));
     }
 
     public static UUID getReplaceNode()
     {
         try
         {
-            return UUID.fromString(System.getProperty("cassandra.replace_node", null));
+            return UUID.fromString(System.getProperty(Config.PROPERTY_PREFIX + "replace_node",
null));
         } catch (NullPointerException e)
         {
             return null;
@@ -1342,17 +1341,17 @@ public class DatabaseDescriptor
 
     public static int getStoragePort()
     {
-        return Integer.parseInt(System.getProperty("cassandra.storage_port", conf.storage_port.toString()));
+        return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "storage_port",
Integer.toString(conf.storage_port)));
     }
 
     public static int getSSLStoragePort()
     {
-        return Integer.parseInt(System.getProperty("cassandra.ssl_storage_port", conf.ssl_storage_port.toString()));
+        return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "ssl_storage_port",
Integer.toString(conf.ssl_storage_port)));
     }
 
     public static int getRpcPort()
     {
-        return Integer.parseInt(System.getProperty("cassandra.rpc_port", conf.rpc_port.toString()));
+        return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "rpc_port", Integer.toString(conf.rpc_port)));
     }
 
     public static int getRpcListenBacklog()
@@ -1365,7 +1364,7 @@ public class DatabaseDescriptor
         return conf.request_timeout_in_ms;
     }
 
-    public static void setRpcTimeout(Long timeOutInMillis)
+    public static void setRpcTimeout(long timeOutInMillis)
     {
         conf.request_timeout_in_ms = timeOutInMillis;
     }
@@ -1375,7 +1374,7 @@ public class DatabaseDescriptor
         return conf.read_request_timeout_in_ms;
     }
 
-    public static void setReadRpcTimeout(Long timeOutInMillis)
+    public static void setReadRpcTimeout(long timeOutInMillis)
     {
         conf.read_request_timeout_in_ms = timeOutInMillis;
     }
@@ -1385,7 +1384,7 @@ public class DatabaseDescriptor
         return conf.range_request_timeout_in_ms;
     }
 
-    public static void setRangeRpcTimeout(Long timeOutInMillis)
+    public static void setRangeRpcTimeout(long timeOutInMillis)
     {
         conf.range_request_timeout_in_ms = timeOutInMillis;
     }
@@ -1395,7 +1394,7 @@ public class DatabaseDescriptor
         return conf.write_request_timeout_in_ms;
     }
 
-    public static void setWriteRpcTimeout(Long timeOutInMillis)
+    public static void setWriteRpcTimeout(long timeOutInMillis)
     {
         conf.write_request_timeout_in_ms = timeOutInMillis;
     }
@@ -1405,7 +1404,7 @@ public class DatabaseDescriptor
         return conf.counter_write_request_timeout_in_ms;
     }
 
-    public static void setCounterWriteRpcTimeout(Long timeOutInMillis)
+    public static void setCounterWriteRpcTimeout(long timeOutInMillis)
     {
         conf.counter_write_request_timeout_in_ms = timeOutInMillis;
     }
@@ -1415,7 +1414,7 @@ public class DatabaseDescriptor
         return conf.cas_contention_timeout_in_ms;
     }
 
-    public static void setCasContentionTimeout(Long timeOutInMillis)
+    public static void setCasContentionTimeout(long timeOutInMillis)
     {
         conf.cas_contention_timeout_in_ms = timeOutInMillis;
     }
@@ -1425,7 +1424,7 @@ public class DatabaseDescriptor
         return conf.truncate_request_timeout_in_ms;
     }
 
-    public static void setTruncateRpcTimeout(Long timeOutInMillis)
+    public static void setTruncateRpcTimeout(long timeOutInMillis)
     {
         conf.truncate_request_timeout_in_ms = timeOutInMillis;
     }
@@ -1517,7 +1516,7 @@ public class DatabaseDescriptor
 
     public static boolean getDisableSTCSInL0()
     {
-        return Boolean.getBoolean("cassandra.disable_stcs_in_l0");
+        return disableSTCSInL0;
     }
 
     public static int getStreamThroughputOutboundMegabitsPerSec()
@@ -1639,7 +1638,7 @@ public class DatabaseDescriptor
         return broadcastAddress;
     }
 
-    public static Boolean shouldListenOnBroadcastAddress()
+    public static boolean shouldListenOnBroadcastAddress()
     {
         return conf.listen_on_broadcast_address;
     }
@@ -1712,12 +1711,12 @@ public class DatabaseDescriptor
         return conf.rpc_recv_buff_size_in_bytes;
     }
 
-    public static Integer getInternodeSendBufferSize()
+    public static int getInternodeSendBufferSize()
     {
         return conf.internode_send_buff_size_in_bytes;
     }
 
-    public static Integer getInternodeRecvBufferSize()
+    public static int getInternodeRecvBufferSize()
     {
         return conf.internode_recv_buff_size_in_bytes;
     }
@@ -1729,7 +1728,7 @@ public class DatabaseDescriptor
 
     public static int getNativeTransportPort()
     {
-        return Integer.parseInt(System.getProperty("cassandra.native_transport_port", conf.native_transport_port.toString()));
+        return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "native_transport_port",
Integer.toString(conf.native_transport_port)));
     }
 
     @VisibleForTesting
@@ -1749,7 +1748,7 @@ public class DatabaseDescriptor
         conf.native_transport_port_ssl = port;
     }
 
-    public static Integer getNativeTransportMaxThreads()
+    public static int getNativeTransportMaxThreads()
     {
         return conf.native_transport_max_threads;
     }
@@ -1759,7 +1758,7 @@ public class DatabaseDescriptor
         return conf.native_transport_max_frame_size_in_mb * 1024 * 1024;
     }
 
-    public static Long getNativeTransportMaxConcurrentConnections()
+    public static long getNativeTransportMaxConcurrentConnections()
     {
         return conf.native_transport_max_concurrent_connections;
     }
@@ -1769,7 +1768,7 @@ public class DatabaseDescriptor
         conf.native_transport_max_concurrent_connections = nativeTransportMaxConcurrentConnections;
     }
 
-    public static Long getNativeTransportMaxConcurrentConnectionsPerIp()
+    public static long getNativeTransportMaxConcurrentConnectionsPerIp()
     {
         return conf.native_transport_max_concurrent_connections_per_ip;
     }
@@ -1876,7 +1875,7 @@ public class DatabaseDescriptor
 
     public static boolean isAutoBootstrap()
     {
-        return Boolean.parseBoolean(System.getProperty("cassandra.auto_bootstrap", conf.auto_bootstrap.toString()));
+        return Boolean.parseBoolean(System.getProperty(Config.PROPERTY_PREFIX + "auto_bootstrap",
Boolean.toString(conf.auto_bootstrap)));
     }
 
     public static void setHintedHandoffEnabled(boolean hintedHandoffEnabled)
@@ -1930,7 +1929,7 @@ public class DatabaseDescriptor
     {
         return conf.dynamic_snitch_update_interval_in_ms;
     }
-    public static void setDynamicUpdateInterval(Integer dynamicUpdateInterval)
+    public static void setDynamicUpdateInterval(int dynamicUpdateInterval)
     {
         conf.dynamic_snitch_update_interval_in_ms = dynamicUpdateInterval;
     }
@@ -1939,7 +1938,7 @@ public class DatabaseDescriptor
     {
         return conf.dynamic_snitch_reset_interval_in_ms;
     }
-    public static void setDynamicResetInterval(Integer dynamicResetInterval)
+    public static void setDynamicResetInterval(int dynamicResetInterval)
     {
         conf.dynamic_snitch_reset_interval_in_ms = dynamicResetInterval;
     }
@@ -1949,7 +1948,7 @@ public class DatabaseDescriptor
         return conf.dynamic_snitch_badness_threshold;
     }
 
-    public static void setDynamicBadnessThreshold(Double dynamicBadnessThreshold)
+    public static void setDynamicBadnessThreshold(double dynamicBadnessThreshold)
     {
         conf.dynamic_snitch_badness_threshold = dynamicBadnessThreshold;
     }
@@ -1974,7 +1973,7 @@ public class DatabaseDescriptor
         return conf.batchlog_replay_throttle_in_kb;
     }
 
-    public static void setHintedHandoffThrottleInKB(Integer throttleInKB)
+    public static void setHintedHandoffThrottleInKB(int throttleInKB)
     {
         conf.hinted_handoff_throttle_in_kb = throttleInKB;
     }
@@ -2347,18 +2346,18 @@ public class DatabaseDescriptor
         return conf.cdc_raw_directory;
     }
 
-    public static Integer getCDCSpaceInMB()
+    public static int getCDCSpaceInMB()
     {
         return conf.cdc_total_space_in_mb;
     }
 
     @VisibleForTesting
-    public static void setCDCSpaceInMB(Integer input)
+    public static void setCDCSpaceInMB(int input)
     {
         conf.cdc_total_space_in_mb = input;
     }
 
-    public static Integer getCDCDiskCheckInterval()
+    public static int getCDCDiskCheckInterval()
     {
         return conf.cdc_free_space_check_interval_ms;
     }
@@ -2371,7 +2370,12 @@ public class DatabaseDescriptor
 
     public static int searchConcurrencyFactor()
     {
-        return Integer.parseInt(System.getProperty("cassandra.search_concurrency_factor",
"1"));
+        return searchConcurrencyFactor;
+    }
+
+    public static boolean isUnsafeSystem()
+    {
+        return unsafeSystem;
     }
 
     public static void setBackPressureEnabled(boolean backPressureEnabled)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 598914a..05b7ac9 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -808,7 +808,7 @@ public final class SystemKeyspace
 
     public static void forceBlockingFlush(String cfname)
     {
-        if (!Boolean.getBoolean("cassandra.unsafesystem"))
+        if (!DatabaseDescriptor.isUnsafeSystem())
             FBUtilities.waitOnFuture(Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(cfname).forceFlush());
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
index 2c323b1..eeb9bc8 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.cassandra.concurrent.Stage;
 import org.apache.cassandra.concurrent.StageManager;
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.config.Config;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.config.SchemaConstants;
 import org.apache.cassandra.db.ColumnFamilyStore;
@@ -55,9 +56,9 @@ public class CommitLogReplayer implements CommitLogReadHandler
     public static long MAX_OUTSTANDING_REPLAY_BYTES = Long.getLong("cassandra.commitlog_max_outstanding_replay_bytes",
1024 * 1024 * 64);
     @VisibleForTesting
     public static MutationInitiator mutationInitiator = new MutationInitiator();
-    static final String IGNORE_REPLAY_ERRORS_PROPERTY = "cassandra.commitlog.ignorereplayerrors";
+    static final String IGNORE_REPLAY_ERRORS_PROPERTY = Config.PROPERTY_PREFIX + "commitlog.ignorereplayerrors";
     private static final Logger logger = LoggerFactory.getLogger(CommitLogReplayer.class);
-    private static final int MAX_OUTSTANDING_REPLAY_COUNT = Integer.getInteger("cassandra.commitlog_max_outstanding_replay_count",
1024);
+    private static final int MAX_OUTSTANDING_REPLAY_COUNT = Integer.getInteger(Config.PROPERTY_PREFIX
+ "commitlog_max_outstanding_replay_count", 1024);
 
     private final Set<Keyspace> keyspacesReplayed;
     private final Queue<Future<Integer>> futures;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
index eca87c9..0633251f 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.config.Config;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
 import org.apache.cassandra.db.rows.UnfilteredRowIterator;
@@ -45,6 +46,7 @@ public class LeveledCompactionStrategy extends AbstractCompactionStrategy
 {
     private static final Logger logger = LoggerFactory.getLogger(LeveledCompactionStrategy.class);
     private static final String SSTABLE_SIZE_OPTION = "sstable_size_in_mb";
+    private static final boolean tolerateSstableSize = Boolean.getBoolean(Config.PROPERTY_PREFIX
+ "tolerate_sstable_size");
 
     @VisibleForTesting
     final LeveledManifest manifest;
@@ -56,12 +58,12 @@ public class LeveledCompactionStrategy extends AbstractCompactionStrategy
         int configuredMaxSSTableSize = 160;
         SizeTieredCompactionStrategyOptions localOptions = new SizeTieredCompactionStrategyOptions(options);
         if (options != null)
-        {
-            if (options.containsKey(SSTABLE_SIZE_OPTION))
-            {
-                configuredMaxSSTableSize = Integer.parseInt(options.get(SSTABLE_SIZE_OPTION));
-                if (!Boolean.getBoolean("cassandra.tolerate_sstable_size"))
-                {
+        {             
+            if (options.containsKey(SSTABLE_SIZE_OPTION))             
+            {                 
+                configuredMaxSSTableSize = Integer.parseInt(options.get(SSTABLE_SIZE_OPTION));
                
+                if (!tolerateSstableSize)
+                {                     
                     if (configuredMaxSSTableSize >= 1000)
                         logger.warn("Max sstable size of {}MB is configured for {}.{}; having
a unit of compaction this large is probably a bad idea",
                                 configuredMaxSSTableSize, cfs.name, cfs.getColumnFamilyName());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
index 02147ef..cd80e00 100644
--- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
@@ -62,7 +62,7 @@ public class IncomingTcpConnection extends FastThreadLocalThread implements
Clos
         this.compressed = compressed;
         this.socket = socket;
         this.group = group;
-        if (DatabaseDescriptor.getInternodeRecvBufferSize() != null)
+        if (DatabaseDescriptor.getInternodeRecvBufferSize() > 0)
         {
             try
             {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
index 9a47fda..1f47334 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
@@ -403,7 +403,7 @@ public class OutboundTcpConnection extends FastThreadLocalThread
                 {
                     socket.setTcpNoDelay(DatabaseDescriptor.getInterDCTcpNoDelay());
                 }
-                if (DatabaseDescriptor.getInternodeSendBufferSize() != null)
+                if (DatabaseDescriptor.getInternodeSendBufferSize() > 0)
                 {
                     try
                     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/repair/SystemDistributedKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/SystemDistributedKeyspace.java b/src/java/org/apache/cassandra/repair/SystemDistributedKeyspace.java
index b8aaceb..552f318 100644
--- a/src/java/org/apache/cassandra/repair/SystemDistributedKeyspace.java
+++ b/src/java/org/apache/cassandra/repair/SystemDistributedKeyspace.java
@@ -38,6 +38,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.SchemaConstants;
 import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.UntypedResultSet;
@@ -310,7 +311,7 @@ public final class SystemDistributedKeyspace
 
     public static void forceBlockingFlush(String table)
     {
-        if (!Boolean.getBoolean("cassandra.unsafesystem"))
+        if (!DatabaseDescriptor.isUnsafeSystem())
             FBUtilities.waitOnFuture(Keyspace.open(SchemaConstants.DISTRIBUTED_KEYSPACE_NAME).getColumnFamilyStore(table).forceFlush());
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3a4e200/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index 36a8072..f1ee3c1 100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@ -276,7 +276,7 @@ public final class SchemaKeyspace
 
     static void flush()
     {
-        if (!Boolean.getBoolean("cassandra.unsafesystem"))
+        if (!DatabaseDescriptor.isUnsafeSystem())
             ALL.forEach(table -> FBUtilities.waitOnFuture(getSchemaCFS(table).forceFlush()));
     }
 


Mime
View raw message