Allow populate_io_cache_on_flush to be set per-CF.

Patch by Alexey Zotov, reviewed by brandwonwilliams for CASSANDRA-4694
This commit is contained in:
Brandon Williams 2013-01-31 15:08:41 -06:00
parent c415eb8046
commit 21f63a916d
15 changed files with 153 additions and 28 deletions

View File

@ -3,6 +3,7 @@
* fix bug in compact storage metadata handling (CASSANDRA-5189)
* Validate login for USE queries (CASSANDRA-5207)
* cli: remove default username and password (CASSANDRA-5208)
* configure populate_io_cache_on_flush per-CF (CASSANDRA-4694)
1.2.1
* stream undelivered hints on decommission (CASSANDRA-5128)

View File

@ -391,6 +391,8 @@ index_interval: 128
# days). See http://wiki.apache.org/cassandra/DistributedDeletes
# - default_validation_class: specifies a validator class to use for
# validating all the column values in the CF.
# - populate_io_cache_on_flush: populates the page cache on memtable flush
# and compaction. Defaults to false.
# NOTE:
# min_ must be less than max_compaction_threshold!
# - min_compaction_threshold: the minimum number of SSTables needed

View File

@ -55,7 +55,7 @@ namespace rb CassandraThrift
# An effort should be made not to break forward-client-compatibility either
# (e.g. one should avoid removing obsolete fields from the IDL), but no
# guarantees in this respect are made by the Cassandra project.
const string VERSION = "19.35.0"
const string VERSION = "19.36.0"
#
@ -442,6 +442,7 @@ struct CfDef {
33: optional double bloom_filter_fp_chance,
34: optional string caching="keys_only",
37: optional double dclocal_read_repair_chance = 0.0,
38: optional bool populate_io_cache_on_flush,
/* All of the following are now ignored and unsupplied. */

View File

@ -32,15 +32,10 @@ import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CfDef");
@ -77,6 +72,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
private static final org.apache.thrift.protocol.TField MERGE_SHARDS_CHANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("merge_shards_chance", org.apache.thrift.protocol.TType.DOUBLE, (short)25);
private static final org.apache.thrift.protocol.TField ROW_CACHE_PROVIDER_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_provider", org.apache.thrift.protocol.TType.STRING, (short)27);
private static final org.apache.thrift.protocol.TField ROW_CACHE_KEYS_TO_SAVE_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_keys_to_save", org.apache.thrift.protocol.TType.I32, (short)31);
private static final org.apache.thrift.protocol.TField POPULATE_IO_CACHE_ON_FLUSH_FIELD_DESC = new org.apache.thrift.protocol.TField("populate_io_cache_on_flush", org.apache.thrift.protocol.TType.BOOL, (short)38);
public String keyspace; // required
public String name; // required
@ -100,6 +96,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
public double bloom_filter_fp_chance; // required
public String caching; // required
public double dclocal_read_repair_chance; // required
public boolean populate_io_cache_on_flush; // required
/**
* @deprecated
*/
@ -165,6 +162,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
BLOOM_FILTER_FP_CHANCE((short)33, "bloom_filter_fp_chance"),
CACHING((short)34, "caching"),
DCLOCAL_READ_REPAIR_CHANCE((short)37, "dclocal_read_repair_chance"),
POPULATE_IO_CACHE_ON_FLUSH((short)38, "populate_io_cache_on_flush"),
/**
* @deprecated
*/
@ -263,6 +261,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return CACHING;
case 37: // DCLOCAL_READ_REPAIR_CHANCE
return DCLOCAL_READ_REPAIR_CHANCE;
case 38: // POPULATE_IO_CACHE_ON_FLUSH
return POPULATE_IO_CACHE_ON_FLUSH;
case 9: // ROW_CACHE_SIZE
return ROW_CACHE_SIZE;
case 11: // KEY_CACHE_SIZE
@ -340,7 +340,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
private static final int __MEMTABLE_OPERATIONS_IN_MILLIONS_ISSET_ID = 14;
private static final int __MERGE_SHARDS_CHANCE_ISSET_ID = 15;
private static final int __ROW_CACHE_KEYS_TO_SAVE_ISSET_ID = 16;
private BitSet __isset_bit_vector = new BitSet(17);
private static final int __POPULATE_IO_CACHE_ISSET_ID = 17;
private BitSet __isset_bit_vector = new BitSet(18);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@ -374,7 +375,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.REPLICATE_ON_WRITE, new org.apache.thrift.meta_data.FieldMetaData("replicate_on_write", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.KEY_VALIDATION_CLASS, new org.apache.thrift.meta_data.FieldMetaData("key_validation_class", org.apache.thrift.TFieldRequirementType.OPTIONAL,
tmpMap.put(_Fields.KEY_VALIDATION_CLASS, new org.apache.thrift.meta_data.FieldMetaData("key_validation_class", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.KEY_ALIAS, new org.apache.thrift.meta_data.FieldMetaData("key_alias", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
@ -394,7 +395,9 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.DCLOCAL_READ_REPAIR_CHANCE, new org.apache.thrift.meta_data.FieldMetaData("dclocal_read_repair_chance", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.ROW_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("row_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL,
tmpMap.put(_Fields.POPULATE_IO_CACHE_ON_FLUSH, new org.apache.thrift.meta_data.FieldMetaData("populate_io_cache_on_flush", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.ROW_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("row_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.KEY_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("key_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
@ -426,7 +429,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
this.caching = "keys_only";
this.dclocal_read_repair_chance = 0;
}
public CfDef(
@ -483,7 +485,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
}
if (other.isSetKey_alias()) {
this.key_alias = org.apache.thrift.TBaseHelper.copyBinary(other.key_alias);
;
}
if (other.isSetCompaction_strategy()) {
this.compaction_strategy = other.compaction_strategy;
@ -523,6 +524,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
this.caching = other.caching;
}
this.dclocal_read_repair_chance = other.dclocal_read_repair_chance;
this.populate_io_cache_on_flush = other.populate_io_cache_on_flush;
this.row_cache_size = other.row_cache_size;
this.key_cache_size = other.key_cache_size;
this.row_cache_save_period_in_seconds = other.row_cache_save_period_in_seconds;
@ -573,8 +575,9 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
setBloom_filter_fp_chanceIsSet(false);
this.bloom_filter_fp_chance = 0.0;
this.caching = "keys_only";
this.dclocal_read_repair_chance = 0;
setPopulate_io_cache_on_flushIsSet(false);
this.populate_io_cache_on_flush = false;
setRow_cache_sizeIsSet(false);
this.row_cache_size = 0.0;
@ -1151,6 +1154,16 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return this;
}
public boolean getPopulate_io_cache_on_flush() {
return this.populate_io_cache_on_flush;
}
public CfDef setPopulate_io_cache_on_flush(boolean populate_io_cache_on_flush) {
this.populate_io_cache_on_flush = populate_io_cache_on_flush;
setPopulate_io_cache_on_flushIsSet(true);
return this;
}
public void unsetDclocal_read_repair_chance() {
__isset_bit_vector.clear(__DCLOCAL_READ_REPAIR_CHANCE_ISSET_ID);
}
@ -1164,6 +1177,19 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
__isset_bit_vector.set(__DCLOCAL_READ_REPAIR_CHANCE_ISSET_ID, value);
}
public void unsetPopulate_io_cache_on_flush() {
__isset_bit_vector.clear(__POPULATE_IO_CACHE_ISSET_ID);
}
/** Returns true if field populate_io_cache_on_flush is set (has been assigned a value) and false otherwise */
public boolean isSetPopulate_io_cache_on_flush() {
return __isset_bit_vector.get(__POPULATE_IO_CACHE_ISSET_ID);
}
public void setPopulate_io_cache_on_flushIsSet(boolean value) {
__isset_bit_vector.set(__POPULATE_IO_CACHE_ISSET_ID, value);
}
/**
* @deprecated
*/
@ -1633,6 +1659,14 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
}
break;
case POPULATE_IO_CACHE_ON_FLUSH:
if (value == null) {
unsetPopulate_io_cache_on_flush();
} else {
setPopulate_io_cache_on_flush((Boolean) value);
}
break;
case ROW_CACHE_SIZE:
if (value == null) {
unsetRow_cache_size();
@ -1784,6 +1818,9 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
case DCLOCAL_READ_REPAIR_CHANCE:
return Double.valueOf(getDclocal_read_repair_chance());
case POPULATE_IO_CACHE_ON_FLUSH:
return Boolean.valueOf(getPopulate_io_cache_on_flush());
case ROW_CACHE_SIZE:
return Double.valueOf(getRow_cache_size());
@ -1869,6 +1906,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return isSetCaching();
case DCLOCAL_READ_REPAIR_CHANCE:
return isSetDclocal_read_repair_chance();
case POPULATE_IO_CACHE_ON_FLUSH:
return isSetPopulate_io_cache_on_flush();
case ROW_CACHE_SIZE:
return isSetRow_cache_size();
case KEY_CACHE_SIZE:
@ -2104,6 +2143,15 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return false;
}
boolean this_present_populate_io_cache_on_flush = true && this.isSetPopulate_io_cache_on_flush();
boolean that_present_populate_io_cache_on_flush = true && that.isSetPopulate_io_cache_on_flush();
if (this_present_populate_io_cache_on_flush || that_present_populate_io_cache_on_flush) {
if (!(this_present_populate_io_cache_on_flush && that_present_populate_io_cache_on_flush))
return false;
if (this.populate_io_cache_on_flush != that.populate_io_cache_on_flush)
return false;
}
boolean this_present_row_cache_size = true && this.isSetRow_cache_size();
boolean that_present_row_cache_size = true && that.isSetRow_cache_size();
if (this_present_row_cache_size || that_present_row_cache_size) {
@ -2311,6 +2359,11 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
if (present_dclocal_read_repair_chance)
builder.append(dclocal_read_repair_chance);
boolean present_populate_io_cache_on_flush = true && (isSetPopulate_io_cache_on_flush());
builder.append(present_populate_io_cache_on_flush);
if (present_populate_io_cache_on_flush)
builder.append(populate_io_cache_on_flush);
boolean present_row_cache_size = true && (isSetRow_cache_size());
builder.append(present_row_cache_size);
if (present_row_cache_size)
@ -2592,6 +2645,16 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPopulate_io_cache_on_flush()).compareTo(typedOther.isSetPopulate_io_cache_on_flush());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPopulate_io_cache_on_flush()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.populate_io_cache_on_flush, typedOther.populate_io_cache_on_flush);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRow_cache_size()).compareTo(typedOther.isSetRow_cache_size());
if (lastComparison != 0) {
return lastComparison;
@ -2906,6 +2969,14 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 38: // POPULATE_IO_CACHE_ON_FLUSH
if (field.type == org.apache.thrift.protocol.TType.BOOL) {
this.populate_io_cache_on_flush = iprot.readBool();
setPopulate_io_cache_on_flushIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 9: // ROW_CACHE_SIZE
if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
this.row_cache_size = iprot.readDouble();
@ -3209,6 +3280,11 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
oprot.writeDouble(this.dclocal_read_repair_chance);
oprot.writeFieldEnd();
}
if (isSetPopulate_io_cache_on_flush()) {
oprot.writeFieldBegin(POPULATE_IO_CACHE_ON_FLUSH_FIELD_DESC);
oprot.writeBool(this.populate_io_cache_on_flush);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@ -3401,6 +3477,12 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
sb.append(this.dclocal_read_repair_chance);
first = false;
}
if (isSetPopulate_io_cache_on_flush()) {
if (!first) sb.append(", ");
sb.append("populate_io_cache_on_flush:");
sb.append(this.populate_io_cache_on_flush);
first = false;
}
if (isSetRow_cache_size()) {
if (!first) sb.append(", ");
sb.append("row_cache_size:");

View File

@ -64,6 +64,7 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet):
('gc_grace_seconds', None),
('read_repair_chance', None),
('replicate_on_write', None),
('populate_io_cache_on_flush', None),
)
old_columnfamily_layout_options = (
@ -76,6 +77,7 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet):
('gc_grace_seconds', None),
('read_repair_chance', None),
('replicate_on_write', None),
('populate_io_cache_on_flush', None),
)
new_columnfamily_layout_options = (
@ -86,6 +88,7 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet):
('gc_grace_seconds', None),
('read_repair_chance', None),
('replicate_on_write', None),
('populate_io_cache_on_flush', None),
)
old_columnfamily_layout_map_options = (
@ -492,7 +495,7 @@ def cf_new_prop_val_completer(ctxt, cass):
if this_opt in ('read_repair_chance', 'bloom_filter_fp_chance',
'dclocal_read_repair_chance'):
return [Hint('<float_between_0_and_1>')]
if this_opt == 'replicate_on_write':
if this_opt in ('replicate_on_write', 'populate_io_cache_on_flush'):
return ["'yes'", "'no'"]
if this_opt in ('min_compaction_threshold', 'max_compaction_threshold',
'gc_grace_seconds'):
@ -628,7 +631,7 @@ def cf_old_prop_val_completer(ctxt, cass):
return simple_cql_types
if this_opt in ('read_repair_chance', 'bloom_filter_fp_chance'):
return [Hint('<float_between_0_and_1>')]
if this_opt == 'replicate_on_write':
if this_opt in ('replicate_on_write', 'populate_io_cache_on_flush'):
return [Hint('<yes_or_no>')]
if this_opt in ('min_compaction_threshold', 'max_compaction_threshold', 'gc_grace_seconds'):
return [Hint('<integer>')]

View File

@ -50,6 +50,7 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
('max_compaction_threshold', None),
('replicate_on_write', None),
('compaction_strategy_class', 'compaction_strategy'),
('populate_io_cache_on_flush', None),
)
obsolete_cf_options = (
@ -832,7 +833,7 @@ def create_cf_option_val_completer(ctxt, cass):
return cqltypes.cql_types
if this_opt == 'read_repair_chance':
return [Hint('<float_between_0_and_1>')]
if this_opt == 'replicate_on_write':
if this_opt in ('replicate_on_write', 'populate_io_cache_on_flush'):
return [Hint('<yes_or_no>')]
if this_opt in ('min_compaction_threshold', 'max_compaction_threshold', 'gc_grace_seconds'):
return [Hint('<integer>')]

View File

@ -137,7 +137,8 @@ public class CliClient
COMPACTION_STRATEGY_OPTIONS,
COMPRESSION_OPTIONS,
BLOOM_FILTER_FP_CHANCE,
CACHING
CACHING,
POPULATE_IO_CACHE_ON_FLUSH
}
private static final String DEFAULT_PLACEMENT_STRATEGY = "org.apache.cassandra.locator.NetworkTopologyStrategy";
@ -1326,6 +1327,9 @@ public class CliClient
case CACHING:
cfDef.setCaching(CliUtils.unescapeSQLString(mValue));
break;
case POPULATE_IO_CACHE_ON_FLUSH:
cfDef.setPopulate_io_cache_on_flush(Boolean.parseBoolean(mValue));
break;
default:
//must match one of the above or we'd throw an exception at the valueOf statement above.
assert(false);
@ -1774,6 +1778,7 @@ public class CliClient
writeAttr(output, false, "read_repair_chance", cfDef.read_repair_chance);
writeAttr(output, false, "dclocal_read_repair_chance", cfDef.dclocal_read_repair_chance);
writeAttr(output, false, "populate_io_cache_on_flush", cfDef.populate_io_cache_on_flush);
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);
@ -2143,6 +2148,7 @@ public class CliClient
sessionState.out.printf(" Compaction min/max thresholds: %s/%s%n", cf_def.min_compaction_threshold, cf_def.max_compaction_threshold);
sessionState.out.printf(" Read repair chance: %s%n", cf_def.read_repair_chance);
sessionState.out.printf(" DC Local Read repair chance: %s%n", cf_def.dclocal_read_repair_chance);
sessionState.out.printf(" Populate IO Cache on flush: %b%n", cf_def.populate_io_cache_on_flush);
sessionState.out.printf(" Replicate on write: %s%n", cf_def.replicate_on_write);
sessionState.out.printf(" Caching: %s%n", cf_def.caching);
sessionState.out.printf(" Bloom Filter FP chance: %s%n", cf_def.isSetBloom_filter_fp_chance() ? cf_def.bloom_filter_fp_chance : "default");

View File

@ -77,6 +77,7 @@ public final class CFMetaData
public final static Class<? extends AbstractCompactionStrategy> DEFAULT_COMPACTION_STRATEGY_CLASS = SizeTieredCompactionStrategy.class;
public final static ByteBuffer DEFAULT_KEY_NAME = ByteBufferUtil.bytes("KEY");
public final static Caching DEFAULT_CACHING_STRATEGY = Caching.KEYS_ONLY;
public final static boolean DEFAULT_POPULATE_IO_CACHE_ON_FLUSH = false;
// Note that this is the default only for user created tables
public final static String DEFAULT_COMPRESSOR = SnappyCompressor.isAvailable() ? SnappyCompressor.class.getCanonicalName() : null;
@ -129,6 +130,7 @@ public final class CFMetaData
+ "key_aliases text,"
+ "bloom_filter_fp_chance double,"
+ "caching text,"
+ "populate_io_cache_on_flush boolean,"
+ "compaction_strategy_class text,"
+ "compression_parameters text,"
+ "value_alias text,"
@ -266,6 +268,7 @@ public final class CFMetaData
private volatile ByteBuffer valueAlias = null;
private volatile Double bloomFilterFpChance = null;
private volatile Caching caching = DEFAULT_CACHING_STRATEGY;
private volatile boolean populateIoCacheOnFlush = DEFAULT_POPULATE_IO_CACHE_ON_FLUSH;
volatile Map<ByteBuffer, ColumnDefinition> column_metadata = new HashMap<ByteBuffer,ColumnDefinition>();
public volatile Class<? extends AbstractCompactionStrategy> compactionStrategyClass = DEFAULT_COMPACTION_STRATEGY_CLASS;
@ -296,6 +299,7 @@ public final class CFMetaData
public CFMetaData compressionParameters(CompressionParameters prop) {compressionParameters = prop; return this;}
public CFMetaData bloomFilterFpChance(Double prop) {bloomFilterFpChance = prop; return this;}
public CFMetaData caching(Caching prop) {caching = prop; return this;}
public CFMetaData populateIoCacheOnFlush(boolean prop) {populateIoCacheOnFlush = prop; return this;}
public CFMetaData(String keyspace, String name, ColumnFamilyType type, AbstractType<?> comp, AbstractType<?> subcc)
{
@ -434,7 +438,8 @@ public final class CFMetaData
.compactionStrategyOptions(oldCFMD.compactionStrategyOptions)
.compressionParameters(oldCFMD.compressionParameters)
.bloomFilterFpChance(oldCFMD.bloomFilterFpChance)
.caching(oldCFMD.caching);
.caching(oldCFMD.caching)
.populateIoCacheOnFlush(oldCFMD.populateIoCacheOnFlush);
}
/**
@ -483,6 +488,11 @@ public final class CFMetaData
return replicateOnWrite;
}
public boolean populateIoCacheOnFlush()
{
return populateIoCacheOnFlush;
}
public int getGcGraceSeconds()
{
return gcGraceSeconds;
@ -597,6 +607,7 @@ public final class CFMetaData
.append(compressionParameters, rhs.compressionParameters)
.append(bloomFilterFpChance, rhs.bloomFilterFpChance)
.append(caching, rhs.caching)
.append(populateIoCacheOnFlush, rhs.populateIoCacheOnFlush)
.isEquals();
}
@ -627,6 +638,7 @@ public final class CFMetaData
.append(compressionParameters)
.append(bloomFilterFpChance)
.append(caching)
.append(populateIoCacheOnFlush)
.toHashCode();
}
@ -649,6 +661,8 @@ public final class CFMetaData
cf_def.setComment("");
if (!cf_def.isSetReplicate_on_write())
cf_def.setReplicate_on_write(CFMetaData.DEFAULT_REPLICATE_ON_WRITE);
if (!cf_def.isSetPopulate_io_cache_on_flush())
cf_def.setPopulate_io_cache_on_flush(CFMetaData.DEFAULT_POPULATE_IO_CACHE_ON_FLUSH);
if (!cf_def.isSetMin_compaction_threshold())
cf_def.setMin_compaction_threshold(CFMetaData.DEFAULT_MIN_COMPACTION_THRESHOLD);
if (!cf_def.isSetMax_compaction_threshold())
@ -704,6 +718,8 @@ public final class CFMetaData
newCFMD.readRepairChance(cf_def.read_repair_chance);
if (cf_def.isSetDclocal_read_repair_chance())
newCFMD.dcLocalReadRepairChance(cf_def.dclocal_read_repair_chance);
if (cf_def.isSetPopulate_io_cache_on_flush())
newCFMD.populateIoCacheOnFlush(cf_def.populate_io_cache_on_flush);
CompressionParameters cp = CompressionParameters.create(cf_def.compression_options);
@ -786,6 +802,7 @@ public final class CFMetaData
bloomFilterFpChance = cfm.bloomFilterFpChance;
caching = cfm.caching;
populateIoCacheOnFlush = cfm.populateIoCacheOnFlush;
MapDifference<ByteBuffer, ColumnDefinition> columnDiff = Maps.difference(column_metadata, cfm.column_metadata);
// columns that are no longer needed
@ -921,6 +938,7 @@ public final class CFMetaData
def.setRead_repair_chance(readRepairChance);
def.setDclocal_read_repair_chance(dcLocalReadRepairChance);
def.setReplicate_on_write(replicateOnWrite);
def.setPopulate_io_cache_on_flush(populateIoCacheOnFlush);
def.setGc_grace_seconds(gcGraceSeconds);
def.setDefault_validation_class(defaultValidator == null ? null : defaultValidator.toString());
def.setKey_validation_class(keyValidator.toString());
@ -1272,6 +1290,7 @@ public final class CFMetaData
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "read_repair_chance"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "local_read_repair_chance"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "replicate_on_write"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "populate_io_cache_on_flush"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "gc_grace_seconds"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "default_validator"));
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "key_validator"));
@ -1322,6 +1341,7 @@ public final class CFMetaData
cf.addColumn(Column.create(readRepairChance, timestamp, cfName, "read_repair_chance"));
cf.addColumn(Column.create(dcLocalReadRepairChance, timestamp, cfName, "local_read_repair_chance"));
cf.addColumn(Column.create(replicateOnWrite, timestamp, cfName, "replicate_on_write"));
cf.addColumn(Column.create(populateIoCacheOnFlush, timestamp, cfName, "populate_io_cache_on_flush"));
cf.addColumn(Column.create(gcGraceSeconds, timestamp, cfName, "gc_grace_seconds"));
cf.addColumn(Column.create(defaultValidator.toString(), timestamp, cfName, "default_validator"));
cf.addColumn(Column.create(keyValidator.toString(), timestamp, cfName, "key_validator"));
@ -1381,6 +1401,8 @@ public final class CFMetaData
if (result.has("value_alias"))
cfm.valueAlias(result.getBytes("value_alias"));
cfm.compactionStrategyOptions(fromJsonMap(result.getString("compaction_strategy_options")));
if (result.has("populate_io_cache_on_flush"))
cfm.populateIoCacheOnFlush(result.getBoolean("populate_io_cache_on_flush"));
return cfm;
}
@ -1544,6 +1566,7 @@ public final class CFMetaData
.append("compressionOptions", compressionParameters.asThriftOptions())
.append("bloomFilterFpChance", bloomFilterFpChance)
.append("caching", caching)
.append("populateIoCacheOnFlush", populateIoCacheOnFlush)
.toString();
}
}

View File

@ -203,8 +203,6 @@ public class DatabaseDescriptor
logger.info("disk_failure_policy is " + conf.disk_failure_policy);
logger.debug("page_cache_hinting is " + conf.populate_io_cache_on_flush);
/* Authentication and authorization backend, implementing IAuthenticator and IAuthorizer */
if (conf.authenticator != null)
authenticator = FBUtilities.construct(conf.authenticator, "authenticator");
@ -1256,11 +1254,6 @@ public class DatabaseDescriptor
return conf.streaming_socket_timeout_in_ms;
}
public static boolean populateIOCacheOnFlush()
{
return conf.populate_io_cache_on_flush;
}
public static String getLocalDataCenter()
{
return localDC;

View File

@ -186,6 +186,7 @@ public class AlterTableStatement
cfm.minCompactionThreshold(cfProps.getPropertyInt(CFPropDefs.KW_MINCOMPACTIONTHRESHOLD, cfm.getMinCompactionThreshold()));
cfm.maxCompactionThreshold(cfProps.getPropertyInt(CFPropDefs.KW_MAXCOMPACTIONTHRESHOLD, cfm.getMaxCompactionThreshold()));
cfm.caching(CFMetaData.Caching.fromString(cfProps.getPropertyString(CFPropDefs.KW_CACHING, cfm.getCaching().toString())));
cfm.populateIoCacheOnFlush(cfProps.getPropertyBoolean(CFPropDefs.KW_POPULATE_IO_CACHE_ON_FLUSH, cfm.populateIoCacheOnFlush()));
cfm.bloomFilterFpChance(cfProps.getPropertyDouble(CFPropDefs.KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));
if (!cfProps.compactionStrategyOptions.isEmpty())

View File

@ -48,6 +48,7 @@ public class CFPropDefs {
public static final String KW_REPLICATEONWRITE = "replicate_on_write";
public static final String KW_COMPACTION_STRATEGY_CLASS = "compaction_strategy_class";
public static final String KW_CACHING = "caching";
public static final String KW_POPULATE_IO_CACHE_ON_FLUSH = "populate_io_cache_on_flush";
public static final String KW_BF_FP_CHANCE = "bloom_filter_fp_chance";
// Maps CQL short names to the respective Cassandra comparator/validator class names
@ -87,6 +88,7 @@ public class CFPropDefs {
keywords.add(KW_REPLICATEONWRITE);
keywords.add(KW_COMPACTION_STRATEGY_CLASS);
keywords.add(KW_CACHING);
keywords.add(KW_POPULATE_IO_CACHE_ON_FLUSH);
keywords.add(KW_BF_FP_CHANCE);
obsoleteKeywords.add("row_cache_size");

View File

@ -194,7 +194,8 @@ public class CreateColumnFamilyStatement
.compactionStrategyOptions(cfProps.compactionStrategyOptions)
.compressionParameters(CompressionParameters.create(cfProps.compressionParameters))
.caching(CFMetaData.Caching.fromString(getPropertyString(CFPropDefs.KW_CACHING, CFMetaData.DEFAULT_CACHING_STRATEGY.toString())))
.bloomFilterFpChance(getPropertyDouble(CFPropDefs.KW_BF_FP_CHANCE, null));
.bloomFilterFpChance(getPropertyDouble(CFPropDefs.KW_BF_FP_CHANCE, null))
.populateIoCacheOnFlush(getPropertyBoolean(CFPropDefs.KW_POPULATE_IO_CACHE_ON_FLUSH, CFMetaData.DEFAULT_POPULATE_IO_CACHE_ON_FLUSH));
// CQL2 can have null keyAliases
if (keyAlias != null)

View File

@ -40,6 +40,7 @@ public class CFPropDefs extends PropertyDefinitions
public static final String KW_MAXCOMPACTIONTHRESHOLD = "max_threshold";
public static final String KW_REPLICATEONWRITE = "replicate_on_write";
public static final String KW_CACHING = "caching";
public static final String KW_POPULATE_IO_CACHE_ON_FLUSH = "populate_io_cache_on_flush";
public static final String KW_BF_FP_CHANCE = "bloom_filter_fp_chance";
public static final String KW_COMPACTION = "compaction";
@ -58,6 +59,7 @@ public class CFPropDefs extends PropertyDefinitions
keywords.add(KW_GCGRACESECONDS);
keywords.add(KW_REPLICATEONWRITE);
keywords.add(KW_CACHING);
keywords.add(KW_POPULATE_IO_CACHE_ON_FLUSH);
keywords.add(KW_BF_FP_CHANCE);
keywords.add(KW_COMPACTION);
keywords.add(KW_COMPRESSION);
@ -123,6 +125,7 @@ public class CFPropDefs extends PropertyDefinitions
cfm.minCompactionThreshold(toInt(KW_MINCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MINCOMPACTIONTHRESHOLD), cfm.getMinCompactionThreshold()));
cfm.maxCompactionThreshold(toInt(KW_MAXCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MAXCOMPACTIONTHRESHOLD), cfm.getMaxCompactionThreshold()));
cfm.caching(CFMetaData.Caching.fromString(getString(KW_CACHING, cfm.getCaching().toString())));
cfm.populateIoCacheOnFlush(getBoolean(KW_POPULATE_IO_CACHE_ON_FLUSH, cfm.populateIoCacheOnFlush()));
if (compactionStrategyClass != null)
{

View File

@ -96,7 +96,7 @@ public class SSTableWriter extends SSTable
dbuilder = SegmentedFile.getCompressedBuilder();
dataFile = CompressedSequentialWriter.open(getFilename(),
descriptor.filenameFor(Component.COMPRESSION_INFO),
!DatabaseDescriptor.populateIOCacheOnFlush(),
!metadata.populateIoCacheOnFlush(),
metadata.compressionParameters(),
sstableMetadataCollector);
}
@ -104,7 +104,7 @@ public class SSTableWriter extends SSTable
{
dbuilder = SegmentedFile.getBuilder(DatabaseDescriptor.getDiskAccessMode());
dataFile = SequentialWriter.open(new File(getFilename()),
!DatabaseDescriptor.populateIOCacheOnFlush());
!metadata.populateIoCacheOnFlush());
dataFile.setComputeDigest();
}
@ -439,7 +439,7 @@ public class SSTableWriter extends SSTable
IndexWriter(long keyCount)
{
indexFile = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_INDEX)),
!DatabaseDescriptor.populateIOCacheOnFlush());
!metadata.populateIoCacheOnFlush());
builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
summary = new IndexSummary(keyCount);
bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);

View File

@ -539,6 +539,9 @@ commands:
- replicate_on_write: Replicate every counter update from the leader to the
follower replicas. Accepts the values true and false.
- populate_io_cache_on_flush: Populates the page cache on memtable flush
and compaction. Accepts the values true and false.
- compression_options: Options related to compression.
Options have the form {key:value}.
The main recognized options are:
@ -808,6 +811,9 @@ commands:
- replicate_on_write: Replicate every counter update from the leader to the
follower replicas. Accepts the values true and false.
- populate_io_cache_on_flush: Populates the page cache on memtable flush
and compaction. Accepts the values true and false.
- compression_options: Options related to compression.
Options have the form {key:value}.
The main recognized options are: