Github user zznate commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/205#discussion_r173964414
  
    --- Diff: src/java/org/apache/cassandra/db/virtual/Settings.java ---
    @@ -0,0 +1,161 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.cassandra.db.virtual;
    +
    +import java.lang.reflect.Array;
    +import java.lang.reflect.Field;
    +import java.lang.reflect.Modifier;
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.function.Consumer;
    +
    +import org.apache.cassandra.config.Config;
    +import org.apache.cassandra.config.DatabaseDescriptor;
    +import org.apache.cassandra.cql3.CQL3Type;
    +import org.apache.cassandra.cql3.ColumnIdentifier;
    +import org.apache.cassandra.cql3.QueryOptions;
    +import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
    +import org.apache.cassandra.db.DecoratedKey;
    +import org.apache.cassandra.db.InMemoryVirtualTable;
    +import org.apache.cassandra.db.rows.Row;
    +import org.apache.cassandra.exceptions.CassandraException;
    +import org.apache.cassandra.exceptions.InvalidRequestException;
    +import org.apache.cassandra.schema.ColumnMetadata;
    +import org.apache.cassandra.schema.TableMetadata;
    +import org.apache.cassandra.service.StorageProxy;
    +import org.apache.cassandra.service.StorageService;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.google.common.collect.ImmutableMap;
    +
    +public class Settings extends InMemoryVirtualTable
    +{
    +    private static final Logger logger = 
LoggerFactory.getLogger(Settings.class);
    +    private static Map<String, Consumer<String>> WRITABLES = 
ImmutableMap.<String, Consumer<String>>builder()
    +      .put("batch_size_warn_threshold_in_kb", v -> 
DatabaseDescriptor.setBatchSizeWarnThresholdInKB(Integer.parseInt(v)))
    +      .put("batch_size_fail_threshold_in_kb", v -> 
DatabaseDescriptor.setBatchSizeFailThresholdInKB(Integer.parseInt(v)))
    +
    +      .put("compaction_throughput_mb_per_sec", v -> 
StorageService.instance.setCompactionThroughputMbPerSec(Integer.parseInt(v)))
    +      .put("concurrent_compactors", v -> 
StorageService.instance.setConcurrentCompactors(Integer.parseInt(v)))
    +      .put("concurrent_validations", v -> 
StorageService.instance.setConcurrentValidators(Integer.parseInt(v)))
    +
    +      .put("tombstone_warn_threshold", v -> 
DatabaseDescriptor.setTombstoneWarnThreshold(Integer.parseInt(v)))
    +      .put("tombstone_failure_threshold", v -> 
DatabaseDescriptor.setTombstoneFailureThreshold(Integer.parseInt(v)))
    +
    +      .put("hinted_handoff_enabled", v -> 
StorageProxy.instance.setHintedHandoffEnabled(Boolean.parseBoolean(v)))
    +      .put("hinted_handoff_throttle_in_kb", v -> 
StorageService.instance.setHintedHandoffThrottleInKB(Integer.parseInt(v)))
    +
    +      .put("incremental_backups", v -> 
DatabaseDescriptor.setIncrementalBackupsEnabled(Boolean.parseBoolean(v)))
    +
    +      .put("inter_dc_stream_throughput_outbound_megabits_per_sec", v -> 
StorageService.instance.setInterDCStreamThroughputMbPerSec(Integer.parseInt(v)))
    +      .put("stream_throughput_outbound_megabits_per_sec", v -> 
StorageService.instance.setStreamThroughputMbPerSec(Integer.parseInt(v)))
    +
    +      .put("truncate_request_timeout_in_ms", v -> 
StorageService.instance.setTruncateRpcTimeout(Long.parseLong(v)))
    +      .put("cas_contention_timeout_in_ms", v -> 
StorageService.instance.setCasContentionTimeout(Long.parseLong(v)))
    +      .put("counter_write_request_timeout_in_ms", v -> 
StorageService.instance.setCounterWriteRpcTimeout(Long.parseLong(v)))
    +      .put("write_request_timeout_in_ms", v -> 
StorageService.instance.setWriteRpcTimeout(Long.parseLong(v)))
    +      .put("range_request_timeout_in_ms", v -> 
StorageService.instance.setRangeRpcTimeout(Long.parseLong(v)))
    +      .put("read_request_timeout_in_ms", v -> 
StorageService.instance.setReadRpcTimeout(Long.parseLong(v)))
    +      .put("request_timeout_in_ms",v -> 
StorageService.instance.setRpcTimeout(Long.parseLong(v)))
    +
    +      .put("phi_convict_threshold", v -> 
DatabaseDescriptor.setPhiConvictThreshold(Double.parseDouble(v)))
    +      .build();
    +
    +    public static Map<String, CQL3Type> columns()
    --- End diff --
    
    same as above - let's just keep a static ref in an initializer. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to