merge from 1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9a336a19 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9a336a19 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9a336a19 Branch: refs/heads/trunk Commit: 9a336a192f290ccdb1d8d636f5a22539cb91b5b5 Parents: 9b315df 2216a3d Author: Pavel Yaskevich <xe...@apache.org> Authored: Tue Feb 7 23:51:40 2012 +0300 Committer: Pavel Yaskevich <xe...@apache.org> Committed: Tue Feb 7 23:51:40 2012 +0300 ---------------------------------------------------------------------- CHANGES.txt | 2 + src/java/org/apache/cassandra/cli/CliClient.java | 162 ++++++++------- .../apache/cassandra/db/HintedHandOffManager.java | 4 +- 3 files changed, 91 insertions(+), 77 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/9a336a19/CHANGES.txt ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/9a336a19/src/java/org/apache/cassandra/cli/CliClient.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cli/CliClient.java index 3f6fa9d,ab48b51..c132a77 --- a/src/java/org/apache/cassandra/cli/CliClient.java +++ b/src/java/org/apache/cassandra/cli/CliClient.java @@@ -1605,32 -1623,37 +1603,34 @@@ public class CliClien /** * Creates a CLI script for the CfDef including meta data to the supplied StringBuilder. - * @param sb - * @param cfDef + * + * @param output File to write to. + * @param cfDef CfDef to export attributes from. */ - private void showColumnFamily(StringBuilder sb, CfDef cfDef) + private void showColumnFamily(PrintStream output, CfDef cfDef) { - sb.append("create column family " + CliUtils.escapeSQLString(cfDef.name)); + output.append("create column family ").append(CliUtils.escapeSQLString(cfDef.name)); - writeAttr(sb, true, "column_type", cfDef.column_type); - writeAttr(sb, false, "comparator", normaliseType(cfDef.comparator_type, "org.apache.cassandra.db.marshal")); + writeAttr(output, true, "column_type", cfDef.column_type); + writeAttr(output, false, "comparator", normaliseType(cfDef.comparator_type, "org.apache.cassandra.db.marshal")); if (cfDef.column_type.equals("Super")) - writeAttr(sb, false, "subcomparator", normaliseType(cfDef.subcomparator_type, "org.apache.cassandra.db.marshal")); + writeAttr(output, false, "subcomparator", normaliseType(cfDef.subcomparator_type, "org.apache.cassandra.db.marshal")); if (!StringUtils.isEmpty(cfDef.default_validation_class)) - writeAttr(sb, false, "default_validation_class", + writeAttr(output, false, "default_validation_class", normaliseType(cfDef.default_validation_class, "org.apache.cassandra.db.marshal")); - writeAttr(sb, false, "key_validation_class", + writeAttr(output, false, "key_validation_class", normaliseType(cfDef.key_validation_class, "org.apache.cassandra.db.marshal")); - writeAttr(sb, false, "read_repair_chance", cfDef.read_repair_chance); - writeAttr(sb, false, "gc_grace", cfDef.gc_grace_seconds); - writeAttr(sb, false, "min_compaction_threshold", cfDef.min_compaction_threshold); - writeAttr(sb, false, "max_compaction_threshold", cfDef.max_compaction_threshold); - writeAttr(sb, false, "replicate_on_write", cfDef.replicate_on_write); - writeAttr(sb, false, "compaction_strategy", cfDef.compaction_strategy); - writeAttr(sb, false, "caching", cfDef.caching); - writeAttr(output, false, "rows_cached", cfDef.row_cache_size); - writeAttr(output, false, "row_cache_save_period", cfDef.row_cache_save_period_in_seconds); - writeAttr(output, false, "row_cache_keys_to_save", cfDef.row_cache_keys_to_save); - writeAttr(output, false, "keys_cached", cfDef.key_cache_size); - writeAttr(output, false, "key_cache_save_period", cfDef.key_cache_save_period_in_seconds); ++ + writeAttr(output, false, "read_repair_chance", cfDef.read_repair_chance); + writeAttr(output, false, "gc_grace", cfDef.gc_grace_seconds); + writeAttr(output, false, "min_compaction_threshold", cfDef.min_compaction_threshold); + writeAttr(output, false, "max_compaction_threshold", cfDef.max_compaction_threshold); + writeAttr(output, false, "replicate_on_write", cfDef.replicate_on_write); - writeAttr(output, false, "row_cache_provider", normaliseType(cfDef.row_cache_provider, "org.apache.cassandra.cache")); + writeAttr(output, false, "compaction_strategy", cfDef.compaction_strategy); ++ writeAttr(output, false, "caching", cfDef.caching); + if (cfDef.isSetBloom_filter_fp_chance()) - writeAttr(sb, false, "bloom_filter_fp_chance", cfDef.bloom_filter_fp_chance); + writeAttr(output, false, "bloom_filter_fp_chance", cfDef.bloom_filter_fp_chance); if (!cfDef.compaction_strategy_options.isEmpty()) { @@@ -1706,25 -1731,26 +1708,26 @@@ /** * Writes the supplied ColumnDef to the StringBuilder as a cli script. - * @param sb - * @param cfDef - * @param colDef + * + * @param output The File to write to. + * @param cfDef The CfDef as a source for comparator/validator + * @param colDef The Column Definition to export */ - private void showColumnMeta(StringBuilder sb, CfDef cfDef, ColumnDef colDef) + private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef) { - sb.append(NEWLINE + TAB + TAB + "{"); + output.append(NEWLINE + TAB + TAB + "{"); - final AbstractType comparator = getFormatType(cfDef.column_type.equals("Super") + final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super") ? cfDef.subcomparator_type : cfDef.comparator_type); - sb.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE); + output.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE); String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal"); - sb.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass)); + output.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass)); if (colDef.isSetIndex_name()) { - sb.append("," + NEWLINE); - sb.append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE); - sb.append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue()))); + output.append(",").append(NEWLINE) + .append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE) + .append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue()))); if (colDef.index_options != null) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/9a336a19/src/java/org/apache/cassandra/db/HintedHandOffManager.java ----------------------------------------------------------------------