private void createColumnFamily(Cassandra.Client client, String ksName, String cfName, String comparator) throws BackendException { CfDef createColumnFamily = new CfDef(); createColumnFamily.setName(cfName); createColumnFamily.setKeyspace(ksName); createColumnFamily.setComparator_type(comparator); ImmutableMap.Builder<String, String> compressionOptions = new ImmutableMap.Builder<String, String>(); if (compressionEnabled) { compressionOptions.put("sstable_compression", compressionClass) .put("chunk_length_kb", Integer.toString(compressionChunkSizeKB)); } createColumnFamily.setCompression_options(compressionOptions.build()); // Hard-coded caching settings if (cfName.startsWith(Backend.EDGESTORE_NAME)) { createColumnFamily.setCaching("keys_only"); } else if (cfName.startsWith(Backend.INDEXSTORE_NAME)) { createColumnFamily.setCaching("rows_only"); } log.debug("Adding column family {} to keyspace {}...", cfName, ksName); try { client.system_add_column_family(createColumnFamily); } catch (SchemaDisagreementException e) { throw new TemporaryBackendException("Error in setting up column family", e); } catch (Exception e) { throw new PermanentBackendException(e); } log.debug("Added column family {} to keyspace {}.", cfName, ksName); }
/** * On set caching. * * @param cfDef * the cf def * @param cfProperties * the cf properties * @param builder * the builder */ private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String caching = cfProperties.getProperty(CassandraConstants.CACHING); if (caching != null) { if (builder != null) { appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING); } else { cfDef.setCaching(caching); } } }
/** * Provides a basic column family definition. This is a subset of #getCfDef, and does not * include compression options, but also does not require raw metadata to be passed in. * * Warning to developers: you must update CKVS.isMatchingCf if you update this method */ static CfDef getStandardCfDef(String keyspace, String internalTableName) { CfDef cf = new CfDef(keyspace, internalTableName); cf.setComparator_type("CompositeType(BytesType,LongType)"); cf.setCompaction_strategy(CassandraConstants.LEVELED_COMPACTION_STRATEGY); cf.setCompression_options(Maps.<String, String>newHashMap()); cf.setGc_grace_seconds(CassandraConstants.DEFAULT_GC_GRACE_SECONDS); // explicitly set fields to default values cf.setCaching("KEYS_ONLY"); cf.setDclocal_read_repair_chance(0.1); cf.setTriggers(ImmutableList.of()); cf.setCells_per_row_to_cache("0"); cf.setMin_index_interval(128); cf.setMax_index_interval(2048); cf.setComment(""); cf.setColumn_metadata(ImmutableList.of()); cf.setMin_compaction_threshold(4); cf.setMax_compaction_threshold(32); cf.setKey_validation_class("org.apache.cassandra.db.marshal.BytesType"); cf.setCompaction_strategy_options(ImmutableMap.of()); cf.setDefault_validation_class("org.apache.cassandra.db.marshal.BytesType"); return cf; }
@Override public ColumnFamilyDefinition setCaching(String caching) { cfDef.setCaching(caching); return this; }
@Override public ColumnFamilyDefinition setCaching(String caching) { cfDef.setCaching(caching); return this; }
private void onSetCaching(CfDef cfDef, Properties cFProperties, StringBuilder builder) { String caching = cFProperties.getProperty(CassandraConstants.CACHING); if (caching != null) { if (builder != null) { appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING); } else { cfDef.setCaching(caching); } } }
private void createColumnFamily(Cassandra.Client client, String ksName, String cfName, String comparator) throws BackendException { CfDef createColumnFamily = new CfDef(); createColumnFamily.setName(cfName); createColumnFamily.setKeyspace(ksName); createColumnFamily.setComparator_type(comparator); ImmutableMap.Builder<String, String> compressionOptions = new ImmutableMap.Builder<String, String>(); if (compressionEnabled) { compressionOptions.put("sstable_compression", compressionClass) .put("chunk_length_kb", Integer.toString(compressionChunkSizeKB)); } createColumnFamily.setCompression_options(compressionOptions.build()); // Hard-coded caching settings if (cfName.startsWith(Backend.EDGESTORE_NAME)) { createColumnFamily.setCaching("keys_only"); } else if (cfName.startsWith(Backend.INDEXSTORE_NAME)) { createColumnFamily.setCaching("rows_only"); } log.debug("Adding column family {} to keyspace {}...", cfName, ksName); try { client.system_add_column_family(createColumnFamily); } catch (SchemaDisagreementException e) { throw new TemporaryBackendException("Error in setting up column family", e); } catch (Exception e) { throw new PermanentBackendException(e); } log.debug("Added column family {} to keyspace {}.", cfName, ksName); }
private void createColumnFamily(Cassandra.Client client, String ksName, String cfName, String comparator) throws BackendException { CfDef createColumnFamily = new CfDef(); createColumnFamily.setName(cfName); createColumnFamily.setKeyspace(ksName); createColumnFamily.setComparator_type(comparator); ImmutableMap.Builder<String, String> compressionOptions = new ImmutableMap.Builder<String, String>(); if (compressionEnabled) { compressionOptions.put("sstable_compression", compressionClass) .put("chunk_length_kb", Integer.toString(compressionChunkSizeKB)); } createColumnFamily.setCompression_options(compressionOptions.build()); // Hard-coded caching settings if (cfName.startsWith(Backend.EDGESTORE_NAME)) { createColumnFamily.setCaching("keys_only"); } else if (cfName.startsWith(Backend.INDEXSTORE_NAME)) { createColumnFamily.setCaching("rows_only"); } log.debug("Adding column family {} to keyspace {}...", cfName, ksName); try { client.system_add_column_family(createColumnFamily); } catch (SchemaDisagreementException e) { throw new TemporaryBackendException("Error in setting up column family", e); } catch (Exception e) { throw new PermanentBackendException(e); } log.debug("Added column family {} to keyspace {}.", cfName, ksName); }
static CfDef getStandardCfDef(String keyspace, String internalTableName) { CfDef cf = new CfDef(keyspace, internalTableName); cf.setComparator_type("CompositeType(BytesType,LongType)"); cf.setCompaction_strategy("LeveledCompactionStrategy"); cf.setCompaction_strategy_options(ImmutableMap.of("sstable_size_in_mb", CassandraConstants.SSTABLE_SIZE_IN_MB)); cf.setCompression_options(Maps.<String, String>newHashMap()); cf.setGc_grace_seconds(GC_GRACE_SECONDS); // explicitly set fields to default values cf.setCaching("KEYS_ONLY"); cf.setDclocal_read_repair_chance(0.1); cf.setTriggers(new ArrayList<TriggerDef>()); cf.setCells_per_row_to_cache("0"); cf.setMin_index_interval(128); cf.setMax_index_interval(2048); cf.setComment(""); cf.setColumn_metadata(new ArrayList<ColumnDef>()); cf.setMin_compaction_threshold(4); cf.setMax_compaction_threshold(32); cf.setKey_validation_class("org.apache.cassandra.db.marshal.BytesType"); cf.setCompaction_strategy_options(new HashMap<String, String>()); cf.setDefault_validation_class("org.apache.cassandra.db.marshal.BytesType"); return cf; } }
/** * Provides a basic column family definition. This is a subset of #getCfDef, and does not * include compression options, but also does not require raw metadata to be passed in. * * Warning to developers: you must update CKVS.isMatchingCf if you update this method */ static CfDef getStandardCfDef(String keyspace, String internalTableName) { CfDef cf = new CfDef(keyspace, internalTableName); cf.setComparator_type("CompositeType(BytesType,LongType)"); cf.setCompaction_strategy(CassandraConstants.LEVELED_COMPACTION_STRATEGY); cf.setCompression_options(Maps.<String, String>newHashMap()); cf.setGc_grace_seconds(CassandraConstants.DEFAULT_GC_GRACE_SECONDS); // explicitly set fields to default values cf.setCaching("KEYS_ONLY"); cf.setDclocal_read_repair_chance(0.1); cf.setTriggers(ImmutableList.of()); cf.setCells_per_row_to_cache("0"); cf.setMin_index_interval(128); cf.setMax_index_interval(2048); cf.setComment(""); cf.setColumn_metadata(ImmutableList.of()); cf.setMin_compaction_threshold(4); cf.setMax_compaction_threshold(32); cf.setKey_validation_class("org.apache.cassandra.db.marshal.BytesType"); cf.setCompaction_strategy_options(ImmutableMap.of()); cf.setDefault_validation_class("org.apache.cassandra.db.marshal.BytesType"); return cf; }
break; case CACHING: cfDef.setCaching(CliUtils.unescapeSQLString(mValue)); break; case CELLS_PER_ROW_TO_CACHE:
def.setMax_index_interval(maxIndexInterval); def.setMemtable_flush_period_in_ms(memtableFlushPeriod); def.setCaching(caching.toThriftCaching()); def.setCells_per_row_to_cache(caching.toThriftCellsPerRow()); def.setDefault_time_to_live(defaultTimeToLive);
def.setMax_index_interval(cfm.params.maxIndexInterval); def.setMemtable_flush_period_in_ms(cfm.params.memtableFlushPeriodInMs); def.setCaching(toThrift(cfm.params.caching)); def.setCells_per_row_to_cache(toThriftCellsPerRow(cfm.params.caching)); def.setDefault_time_to_live(cfm.params.defaultTimeToLive);
def.setMax_index_interval(cfm.params.maxIndexInterval); def.setMemtable_flush_period_in_ms(cfm.params.memtableFlushPeriodInMs); def.setCaching(toThrift(cfm.params.caching)); def.setCells_per_row_to_cache(toThriftCellsPerRow(cfm.params.caching)); def.setDefault_time_to_live(cfm.params.defaultTimeToLive);
unsetCaching(); } else { setCaching((String)value);
unsetCaching(); } else { setCaching((String)value);
unsetCaching(); } else { setCaching((String)value);