public void writeAllProperties()

in priam/src/main/java/com/netflix/priam/tuner/StandardTuner.java [55:161]


    public void writeAllProperties(String yamlLocation, String hostname, String seedProvider)
            throws Exception {
        DumperOptions options = new DumperOptions();
        options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
        Yaml yaml = new Yaml(options);
        File yamlFile = new File(yamlLocation);
        Map map = yaml.load(new FileInputStream(yamlFile));
        map.put("cluster_name", config.getAppName());
        map.put("storage_port", config.getStoragePort());
        map.put("ssl_storage_port", config.getSSLStoragePort());
        map.put("start_rpc", config.isThriftEnabled());
        map.put("rpc_port", config.getThriftPort());
        map.put("start_native_transport", config.isNativeTransportEnabled());
        map.put("native_transport_port", config.getNativeTransportPort());
        map.put("listen_address", hostname);
        map.put("rpc_address", hostname);
        // Dont bootstrap in restore mode
        if (!Restore.isRestoreEnabled(config, instanceInfo)) {
            map.put("auto_bootstrap", config.getAutoBoostrap());
        } else {
            map.put("auto_bootstrap", false);
        }

        map.put("saved_caches_directory", config.getCacheLocation());
        map.put("commitlog_directory", config.getCommitLogLocation());
        map.put("data_file_directories", Lists.newArrayList(config.getDataFileLocation()));

        boolean enableIncremental = IncrementalBackup.isEnabled(config, backupRestoreConfig);
        map.put("incremental_backups", enableIncremental);

        map.put("endpoint_snitch", config.getSnitch());
        if (map.containsKey("in_memory_compaction_limit_in_mb")) {
            map.remove("in_memory_compaction_limit_in_mb");
        }
        map.put("compaction_throughput_mb_per_sec", config.getCompactionThroughput());
        map.put(
                "partitioner",
                derivePartitioner(map.get("partitioner").toString(), config.getPartitioner()));

        if (map.containsKey("memtable_total_space_in_mb")) {
            map.remove("memtable_total_space_in_mb");
        }

        map.put("stream_throughput_outbound_megabits_per_sec", config.getStreamingThroughputMB());
        if (map.containsKey("multithreaded_compaction")) {
            map.remove("multithreaded_compaction");
        }

        map.put("max_hint_window_in_ms", config.getMaxHintWindowInMS());
        map.put("hinted_handoff_throttle_in_kb", config.getHintedHandoffThrottleKb());
        map.put("authenticator", config.getAuthenticator());
        map.put("authorizer", config.getAuthorizer());
        map.put("internode_compression", config.getInternodeCompression());
        map.put("dynamic_snitch", config.isDynamicSnitchEnabled());

        map.put("concurrent_reads", config.getConcurrentReadsCnt());
        map.put("concurrent_writes", config.getConcurrentWritesCnt());
        map.put("concurrent_compactors", config.getConcurrentCompactorsCnt());

        map.put("rpc_server_type", config.getRpcServerType());
        map.put("rpc_min_threads", config.getRpcMinThreads());
        map.put("rpc_max_threads", config.getRpcMaxThreads());
        // Add private ip address as broadcast_rpc_address. This will ensure that COPY function
        // works correctly.
        map.put("broadcast_rpc_address", instanceInfo.getPrivateIP());

        map.put("tombstone_warn_threshold", config.getTombstoneWarnThreshold());
        map.put("tombstone_failure_threshold", config.getTombstoneFailureThreshold());
        map.put("streaming_socket_timeout_in_ms", config.getStreamingSocketTimeoutInMS());

        map.put("memtable_cleanup_threshold", config.getMemtableCleanupThreshold());
        map.put(
                "compaction_large_partition_warning_threshold_mb",
                config.getCompactionLargePartitionWarnThresholdInMB());
        map.put("auto_snapshot", config.getAutoSnapshot());
        map.put("disk_failure_policy", config.getDiskFailurePolicy());

        List<?> seedp = (List) map.get("seed_provider");
        Map<String, String> m = (Map<String, String>) seedp.get(0);
        m.put("class_name", seedProvider);

        configfureSecurity(map);
        configureGlobalCaches(config, map);
        // force to 1 until vnodes are properly supported
        map.put("num_tokens", 1);

        // Additional C* Yaml properties, which can be set via Priam.extra.params
        addExtraCassParams(map);

        // Custom specific C* yaml properties which might not be available in Apache C* OSS
        addCustomCassParams(map);

        // remove troublesome properties
        map.remove("flush_largest_memtables_at");
        map.remove("reduce_cache_capacity_to");

        logger.info(yaml.dump(map));
        yaml.dump(map, new FileWriter(yamlFile));

        // TODO: port commit log backups to the PropertiesFileTuner implementation
        configureCommitLogBackups();

        PropertiesFileTuner propertyTuner = new PropertiesFileTuner(config);
        for (String propertyFile : config.getTunablePropertyFiles()) {
            propertyTuner.updateAndSaveProperties(propertyFile);
        }
    }