Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First part for better Cassandra 1.0 support (create/edit CF)

  • Loading branch information...
commit a6ac35fc6bfe6894af630a31954a61b35c3bede2 1 parent dec220e
@sebgiroux authored
View
68 columnfamily_action.php
@@ -32,17 +32,15 @@
$key_cache_size = $_POST['key_cache_size'];
$key_cache_save_period_in_seconds = $_POST['key_cache_save_period_in_seconds'];
$read_repair_chance = $_POST['read_repair_chance'];
- $gc_grace_seconds = $_POST['gc_grace_seconds'];
- $memtable_operations_in_millions = $_POST['memtable_operations_in_millions'];
- $memtable_throughput_in_mb = $_POST['memtable_throughput_in_mb'];
- $memtable_flush_after_mins = $_POST['memtable_flush_after_mins'];
+ $gc_grace_seconds = $_POST['gc_grace_seconds'];
+
$default_validation_class = $_POST['default_validation_class'];
$min_compaction_threshold = $_POST['min_compaction_threshold'];
$max_compaction_threshold = $_POST['max_compaction_threshold'];
$keyspace_name = $_POST['keyspace_name'];
- $columnfamily_name = $_POST['columnfamily_name'];
-
+ $columnfamily_name = $_POST['columnfamily_name'];
+
$attrs = array('column_type' => $column_type,
'comment' => $comment,
'row_cache_size' => $row_cache_size,
@@ -51,13 +49,33 @@
'key_cache_save_period_in_seconds' => $key_cache_save_period_in_seconds,
'read_repair_chance' => $read_repair_chance,
'gc_grace_seconds' => $gc_grace_seconds,
- 'memtable_operations_in_millions' => $memtable_operations_in_millions,
- 'memtable_throughput_in_mb' => $memtable_throughput_in_mb,
- 'memtable_flush_after_mins' => $memtable_flush_after_mins,
'default_validation_class' => $default_validation_class,
'min_compaction_threshold' => $min_compaction_threshold,
'max_compaction_threshold' => $max_compaction_threshold);
+ $thrift_api_version = $sys_manager->describe_version();
+
+ // Cassandra 0.8-
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'<')) {
+ $attrs['memtable_operations_in_millions'] = $_POST['memtable_operations_in_millions'];
+ $attrs['memtable_throughput_in_mb'] = $_POST['memtable_throughput_in_mb'];
+ $attrs['memtable_flush_after_mins'] = $_POST['memtable_flush_after_mins'];
+ }
+
+ // Cassandra 1.0+
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'>=')) {
+ $attrs['replicate_on_write'] = $_POST['replicate_on_write'];
+ $attrs['key_validation_class'] = $_POST['key_validation_class'];
+ $attrs['key_alias'] = $_POST['key_alias'];
+ $attrs['compaction_strategy'] = $_POST['compaction_strategy'];
+ $attrs['bloom_filter_fp_chance'] = $_POST['bloom_filter_fp_chance'];
+ $attrs['caching'] = $_POST['caching'];
+ $attrs['dclocal_read_repair_chance'] = $_POST['dclocal_read_repair_chance'];
+ $attrs['merge_shards_chance'] = $_POST['merge_shards_chance'];
+ $attrs['row_cache_provider'] = $_POST['row_cache_provider'];
+ $attrs['row_cache_keys_to_save'] = $_POST['row_cache_keys_to_save'];
+ }
+
if (isset($_POST['comparator_type']))
$attrs['comparator_type'] = $_POST['comparator_type'];
@@ -108,7 +126,7 @@
$included_header = true;
echo getHTML('header.php');
- if ($cf) {
+ if ($cf) {
$vw_vars['column_type'] = $cf->column_type;
$vw_vars['comparator_type'] = $cf->comparator_type;
$vw_vars['subcomparator_type'] = $cf->subcomparator_type;
@@ -123,15 +141,35 @@
$vw_vars['max_compaction_threshold'] = $cf->max_compaction_threshold;
$vw_vars['row_cache_save_period_in_seconds'] = $cf->row_cache_save_period_in_seconds;
$vw_vars['key_cache_save_period_in_seconds'] = $cf->key_cache_save_period_in_seconds;
- $vw_vars['memtable_flush_after_mins'] = $cf->memtable_flush_after_mins;
- $vw_vars['memtable_throughput_in_mb'] = $cf->memtable_throughput_in_mb;
- $vw_vars['memtable_operations_in_millions'] = $cf->memtable_operations_in_millions;
+
+ $thrift_api_version = $sys_manager->describe_version();
+
+ // Cassandra 0.8-
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'<')) {
+ $vw_vars['memtable_flush_after_mins'] = $cf->memtable_flush_after_mins;
+ $vw_vars['memtable_throughput_in_mb'] = $cf->memtable_throughput_in_mb;
+ $vw_vars['memtable_operations_in_millions'] = $cf->memtable_operations_in_millions;
+ }
+
+ // Cassandra 1.0+
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'>=')) {
+ $vw_vars['replicate_on_write'] = $cf->replicate_on_write;
+ $vw_vars['key_validation_class'] = $cf->key_validation_class;
+ $vw_vars['key_alias'] = $cf->key_alias;
+ $vw_vars['compaction_strategy'] = $cf->compaction_strategy;
+ $vw_vars['bloom_filter_fp_chance'] = $cf->bloom_filter_fp_chance;
+ $vw_vars['caching'] = $cf->caching;
+ $vw_vars['dclocal_read_repair_chance'] = $cf->dclocal_read_repair_chance;
+ $vw_vars['merge_shards_chance'] = $cf->merge_shards_chance;
+ $vw_vars['row_cache_provider'] = $cf->row_cache_provider;
+ $vw_vars['row_cache_keys_to_save'] = $cf->row_cache_keys_to_save;
+ }
if (!isset($vw_vars['success_message'])) $vw_vars['success_message'] = '';
if (!isset($vw_vars['error_message'])) $vw_vars['error_message'] = '';
-
+
$vw_vars['mode'] = 'edit';
- $vw_vars['thrift_api_version'] = $sys_manager->describe_version();
+ $vw_vars['thrift_api_version'] = $thrift_api_version;
echo getHTML('create_edit_columnfamily.php',$vw_vars);
}
View
1  include/kernel.inc.php
@@ -21,6 +21,7 @@
error_reporting(E_ALL);
define('MINIMUM_THRIFT_API_VERSION_FOR_COUNTERS','19.10.0');
+ define('THRIFT_API_VERSION_FOR_CASSANDRA_1_0','19.20.0');
$cluster_helper = new ClusterHelper($CASSANDRA_CLUSTERS);
View
76 keyspace_action.php
@@ -65,14 +65,52 @@
$gc_grace_seconds = $_POST['gc_grace_seconds'];
if (!empty($gc_grace_seconds)) $attrs['gc_grace_seconds'] = $gc_grace_seconds;
- $memtable_operations_in_millions = $_POST['memtable_operations_in_millions'];
- if (!empty($memtable_operations_in_millions)) $attrs['memtable_operations_in_millions'] = $memtable_operations_in_millions;
+ $thrift_api_version = $sys_manager->describe_version();
- $memtable_throughput_in_mb = $_POST['memtable_throughput_in_mb'];
- if (!empty($memtable_throughput_in_mb)) $attrs['memtable_throughput_in_mb'] = $memtable_throughput_in_mb;
+ // Cassandra 0.8-
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'<')) {
+ $memtable_operations_in_millions = $_POST['memtable_operations_in_millions'];
+ if (!empty($memtable_operations_in_millions)) $attrs['memtable_operations_in_millions'] = $memtable_operations_in_millions;
+
+ $memtable_throughput_in_mb = $_POST['memtable_throughput_in_mb'];
+ if (!empty($memtable_throughput_in_mb)) $attrs['memtable_throughput_in_mb'] = $memtable_throughput_in_mb;
+
+ $memtable_flush_after_mins = $_POST['memtable_flush_after_mins'];
+ if (!empty($memtable_flush_after_mins)) $attrs['memtable_flush_after_mins'] = $memtable_flush_after_mins;
+ }
+
+ // Cassandra 1.0+
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'>=')) {
+ $replicate_on_write = $_POST['replicate_on_write'];
+ if (!empty($replicate_on_write)) $attrs['replicate_on_write'] = $replicate_on_write;
+
+ $key_validation_class = $_POST['key_validation_class'];
+ if (!empty($key_validation_class)) $attrs['key_validation_class'] = $key_validation_class;
+
+ $key_alias = $_POST['key_alias'];
+ if (!empty($key_alias)) $attrs['key_alias'] = $key_alias;
+
+ $compaction_strategy = $_POST['compaction_strategy'];
+ if (!empty($compaction_strategy)) $attrs['compaction_strategy'] = $compaction_strategy;
+
+ $bloom_filter_fp_chance = $_POST['bloom_filter_fp_chance'];
+ if (!empty($bloom_filter_fp_chance)) $attrs['bloom_filter_fp_chance'] = $bloom_filter_fp_chance;
- $memtable_flush_after_mins = $_POST['memtable_flush_after_mins'];
- if (!empty($memtable_flush_after_mins)) $attrs['memtable_flush_after_mins'] = $memtable_flush_after_mins;
+ $caching = $_POST['caching'];
+ if (!empty($caching)) $attrs['caching'] = $caching;
+
+ $dclocal_read_repair_chance = $_POST['dclocal_read_repair_chance'];
+ if (!empty($dclocal_read_repair_chance)) $attrs['dclocal_read_repair_chance'] = $dclocal_read_repair_chance;
+
+ $merge_shards_chance = $_POST['merge_shards_chance'];
+ if (!empty($merge_shards_chance)) $attrs['merge_shards_chance'] = $merge_shards_chance;
+
+ $row_cache_provider = $_POST['row_cache_provider'];
+ if (!empty($row_cache_provider)) $attrs['row_cache_provider'] = $row_cache_provider;
+
+ $row_cache_keys_to_save = $_POST['row_cache_keys_to_save'];
+ if (!empty($row_cache_keys_to_save)) $attrs['row_cache_keys_to_save'] = $row_cache_keys_to_save;
+ }
$default_validation_class = $_POST['default_validation_class'];
if (!empty($default_validation_class)) $attrs['default_validation_class'] = $default_validation_class;
@@ -128,9 +166,29 @@
$vw_vars['max_compaction_threshold'] = '';
$vw_vars['row_cache_save_period_in_seconds'] = '';
$vw_vars['key_cache_save_period_in_seconds'] = '';
- $vw_vars['memtable_flush_after_mins'] = '';
- $vw_vars['memtable_throughput_in_mb'] = '';
- $vw_vars['memtable_operations_in_millions'] = '';
+
+ $thrift_api_version = $sys_manager->describe_version();
+
+ // Cassandra 1.0+
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'>=')) {
+ $vw_vars['replicate_on_write'] = '';
+ $vw_vars['key_validation_class'] = '';
+ $vw_vars['key_alias'] = '';
+ $vw_vars['compaction_strategy'] = '';
+ $vw_vars['bloom_filter_fp_chance'] = '';
+ $vw_vars['caching'] = '';
+ $vw_vars['dclocal_read_repair_chance'] = '';
+ $vw_vars['merge_shards_chance'] = '';
+ $vw_vars['row_cache_provider'] = '';
+ $vw_vars['row_cache_keys_to_save'] = '';
+ }
+
+ // Cassandra 0.8-
+ if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'<')) {
+ $vw_vars['memtable_flush_after_mins'] = '';
+ $vw_vars['memtable_throughput_in_mb'] = '';
+ $vw_vars['memtable_operations_in_millions'] = '';
+ }
$vw_vars['mode'] = 'create';
$vw_vars['thrift_api_version'] = $sys_manager->describe_version();
View
90 views/create_edit_columnfamily.php
@@ -121,6 +121,8 @@
<div class="clear_label"></div>
</div>
+ <?php if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'<')): ?>
+
<div>
<label for="memtable_operations_in_millions">
<div class="form_label">Memtable Operations in Millions:</div>
@@ -148,12 +150,14 @@
<div class="clear_label"></div>
</div>
+ <?php endif; ?>
+
<div>
<label for="default_validation_class">
<div class="form_label">Default Validation Class:</div>
<div class="form_label_help" id="default_validation_class_tooltip">?</div>
</label>
- <input type="text" id="default_validation_class" name="default_validation_class" value="<?php echo $default_validation_class; ?>" /> <?php if ( version_compare($thrift_api_version,MINIMUM_THRIFT_API_VERSION_FOR_COUNTERS,'>=')): ?>* Use "CounterColumnType" for Counter Column<?php endif;?>
+ <input type="text" id="default_validation_class" name="default_validation_class" value="<?php echo $default_validation_class; ?>" /> <?php if (version_compare($thrift_api_version,MINIMUM_THRIFT_API_VERSION_FOR_COUNTERS,'>=')): ?>* Use "CounterColumnType" for Counter Column<?php endif;?>
<div class="clear_label"></div>
</div>
@@ -175,6 +179,90 @@
<div class="clear_label"></div>
</div>
+ <?php if (version_compare($thrift_api_version,THRIFT_API_VERSION_FOR_CASSANDRA_1_0,'>=')): ?>
+
+ <div>
+ <label for="replicate_on_write">
+ <div class="form_label">Replicate on Write:</div>
+ </label>
+ <input type="text" id="replicate_on_write" name="replicate_on_write" value="<?php echo $replicate_on_write; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="key_validation_class">
+ <div class="form_label">Key Validation Class:</div>
+ </label>
+ <input type="text" id="key_validation_class" name="key_validation_class" value="<?php echo $key_validation_class; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="key_alias">
+ <div class="form_label">Key Alias:</div>
+ </label>
+ <input type="text" id="key_alias" name="key_alias" value="<?php echo $key_alias; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="compaction_strategy">
+ <div class="form_label">Compaction Strategy:</div>
+ </label>
+ <input type="text" id="compaction_strategy" name="compaction_strategy" value="<?php echo $compaction_strategy; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="bloom_filter_fp_chance">
+ <div class="form_label">Bloom Filter FP Chance:</div>
+ </label>
+ <input type="text" id="bloom_filter_fp_chance" name="bloom_filter_fp_chance" value="<?php echo $bloom_filter_fp_chance; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="caching">
+ <div class="form_label">Caching:</div>
+ </label>
+ <input type="text" id="caching" name="caching" value="<?php echo $caching; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="dclocal_read_repair_chance">
+ <div class="form_label">DC Local Read Repair Chance:</div>
+ </label>
+ <input type="text" id="dclocal_read_repair_chance" name="dclocal_read_repair_chance" value="<?php echo $dclocal_read_repair_chance; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="merge_shards_chance">
+ <div class="form_label">Merge Shards Chance:</div>
+ </label>
+ <input type="text" id="merge_shards_chance" name="merge_shards_chance" value="<?php echo $merge_shards_chance; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="row_cache_provider">
+ <div class="form_label">Row Cache Provider:</div>
+ </label>
+ <input type="text" id="row_cache_provider" name="row_cache_provider" value="<?php echo $row_cache_provider; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <div>
+ <label for="row_cache_keys_to_save">
+ <div class="form_label">Row Cache Keys To Save:</div>
+ </label>
+ <input type="text" id="row_cache_keys_to_save" name="row_cache_keys_to_save" value="<?php echo $row_cache_keys_to_save; ?>" />
+ <div class="clear_label"></div>
+ </div>
+
+ <?php endif; ?>
+
<p class="form_tips">* Any field left blank will use the server default value.</p>
<div>
Please sign in to comment.
Something went wrong with that request. Please try again.