cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds));
cf.setGc_grace_seconds(gcGraceSeconds); cf.setBloom_filter_fp_chance(falsePositiveChance); cf.setCompression_options(compressionOptions);
@Override public ColumnFamilyDefinition setGcGraceSeconds(Integer seconds) { if (seconds != null) cfDef.setGc_grace_seconds(seconds); return this; }
@Override public ColumnFamilyDefinition setGcGraceSeconds(Integer seconds) { if (seconds != null) cfDef.setGc_grace_seconds(seconds); return this; }
/** * 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; }
.setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "TestBeanColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "TestBeanColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "PurpleColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "SimpleTestBeanColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "SimpleRelationshipBeanColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "NoAnonymousColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "ComplexColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "CompositeColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "Furniture").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "MyConvertedCollectionFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "CustomIdColumnFamily").setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cluster = HFactory.getOrCreateCluster("TestPool", "localhost:9170"); createKeyspace(cluster, "TestKeyspace", "org.apache.cassandra.locator.SimpleStrategy", 1, cfDefList);
private void onSetGcGrace(CfDef cfDef, Properties cFProperties, StringBuilder builder) { String gcGraceSeconds = cFProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS); if (gcGraceSeconds != null) { try { if (builder != null) { appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS); } else { cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds)); } } catch (NumberFormatException nfe) { log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe); throw new SchemaGenerationException(nfe); } } }
d.setComparator_type(comparatorType.getClassName() + comparatorTypeAlias); d.setDefault_validation_class(defaultValidationClass); d.setGc_grace_seconds(gcGraceSeconds); if ( id != 0) d.setId(id);
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; } }
cf.setGc_grace_seconds(gcGraceSeconds); cf.setBloom_filter_fp_chance(falsePositiveChance); cf.setCompression_options(compressionOptions);
/** * 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 GC_GRACE: cfDef.setGc_grace_seconds(Integer.parseInt(mValue)); break; case COLUMN_METADATA:
/** * Private helper to initialize a column family definition */ protected void initializeColumnFamilyDefinition() throws ClassNotFoundException { columnFamilyDefinition = new CfDef(); columnFamilyDefinition.setName(columnFamily); columnFamilyDefinition.setKeyspace(getKeySpace()); ColumnFamily cfAnnotation = target.getAnnotation(ColumnFamily.class); String comparatorType = cfAnnotation.compareWith().getName(); if (cfAnnotation.reversed()) { comparatorType = String.format("%s(reversed=true)", comparatorType); } columnFamilyDefinition.setComparator_type(comparatorType); columnFamilyDefinition.setKey_cache_size(cfAnnotation.keysCached()); columnFamilyDefinition.setRow_cache_size(cfAnnotation.rowsCached()); columnFamilyDefinition.setComment(StringUtils.defaultIfEmpty(cfAnnotation.comment(), null)); columnFamilyDefinition.setComparator_type(cfAnnotation.compareWith().getName()); columnFamilyDefinition.setRead_repair_chance(cfAnnotation.readRepairChance()); columnFamilyDefinition.setGc_grace_seconds(cfAnnotation.gcGraceSeconds()); columnFamilyDefinition.setDefault_validation_class(StringUtils.defaultIfEmpty(cfAnnotation.defaultValidationClass().getName(), null)); columnFamilyDefinition.setKey_validation_class(StringUtils.defaultIfEmpty(cfAnnotation.defaultKeyValidationClass().getName(), null)); columnFamilyDefinition.setMin_compaction_threshold(cfAnnotation.minCompactionThreshold()); columnFamilyDefinition.setMax_compaction_threshold(cfAnnotation.maxCompactionThreshold()); columnFamilyDefinition.setReplicate_on_write(cfAnnotation.replicateOnWrite()); }
.setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "SimpleRelationshipBeanColumnFamily") .setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); cfDefList.add(new CfDef("TestKeyspace", "NoAnonymousColumnFamily") .setComparator_type(BytesType.class.getSimpleName()) .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400)); .setKey_cache_size(0).setRow_cache_size(0).setGc_grace_seconds(86400));
def.setRead_repair_chance(readRepairChance); def.setDclocal_read_repair_chance(dcLocalReadRepairChance); def.setGc_grace_seconds(gcGraceSeconds); def.setDefault_validation_class(defaultValidator == null ? null : defaultValidator.toString()); def.setKey_validation_class(keyValidator.toString());
def.setRead_repair_chance(cfm.params.readRepairChance); def.setDclocal_read_repair_chance(cfm.params.dcLocalReadRepairChance); def.setGc_grace_seconds(cfm.params.gcGraceSeconds); def.setDefault_validation_class(cfm.makeLegacyDefaultValidator().toString()); def.setKey_validation_class(cfm.getKeyValidator().toString());
def.setRead_repair_chance(cfm.params.readRepairChance); def.setDclocal_read_repair_chance(cfm.params.dcLocalReadRepairChance); def.setGc_grace_seconds(cfm.params.gcGraceSeconds); def.setDefault_validation_class(cfm.makeLegacyDefaultValidator().toString()); def.setKey_validation_class(cfm.getKeyValidator().toString());
d.setComparator_type(comparatorType.getClassName() + comparatorTypeAlias); d.setDefault_validation_class(defaultValidationClass); d.setGc_grace_seconds(gcGraceSeconds); if ( id != 0) d.setId(id);
d.setComparator_type(comparatorType.getClassName() + comparatorTypeAlias); d.setDefault_validation_class(defaultValidationClass); d.setGc_grace_seconds(gcGraceSeconds); if ( id != 0) d.setId(id);
unsetGc_grace_seconds(); } else { setGc_grace_seconds((Integer)value);