mirror of https://github.com/apache/cassandra
merge from 0.8
git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1091572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
commit
9fd80e3e54
|
|
@ -6,11 +6,10 @@
|
|||
2124, 2302, 2277)
|
||||
* avoid double RowMutation serialization on write path (CASSANDRA-1800)
|
||||
* make NetworkTopologyStrategy the default (CASSANDRA-1960)
|
||||
* configurable internode encryption (CASSANDRA-1567)
|
||||
* configurable internode encryption (CASSANDRA-1567, 2152)
|
||||
* human readable column names in sstable2json output (CASSANDRA-1933)
|
||||
* change default JMX port to 7199 (CASSANDRA-2027)
|
||||
* backwards compatible internal messaging (CASSANDRA-1015)
|
||||
* check for null encryption in MessagingService (CASSANDRA-2152)
|
||||
* atomic switch of memtables and sstables (CASSANDRA-2284)
|
||||
* add pluggable SeedProvider (CASSANDRA-1669)
|
||||
* Fix clustertool to not throw exception when calling get_endpoints (CASSANDRA-2437)
|
||||
|
|
@ -21,6 +20,8 @@
|
|||
* give snapshots the same name on each node (CASSANDRA-1791)
|
||||
* multithreaded compaction (CASSANDRA-2191)
|
||||
* compaction throttling (CASSANDRA-2156)
|
||||
* add key type information and alias (CASSANDRA-2311, 2396)
|
||||
|
||||
|
||||
0.7.5
|
||||
* Avoid seeking when sstable2json exports the entire file (CASSANDRA-2318)
|
||||
|
|
@ -46,7 +47,9 @@
|
|||
index (CASSANDRA-2376)
|
||||
* fix race condition that could leave orphaned data files when
|
||||
dropping CF or KS (CASSANDRA-2381)
|
||||
* convert mmap assertion to if/throw so scrub can catch it (CASSANDRA-2417)
|
||||
* Try harder to close files after compaction (CASSANDRA-2431)
|
||||
* re-set bootstrapped flag after move finishes (CASSANDRA-2435)
|
||||
|
||||
|
||||
0.7.4
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
from thrift.Thrift import *
|
||||
from ttypes import *
|
||||
|
||||
VERSION = "20.0.0"
|
||||
VERSION = "20.1.0"
|
||||
|
|
|
|||
|
|
@ -2324,6 +2324,7 @@ class CfDef:
|
|||
- merge_shards_chance
|
||||
- key_validation_class
|
||||
- row_cache_provider
|
||||
- key_alias
|
||||
"""
|
||||
|
||||
thrift_spec = (
|
||||
|
|
@ -2355,9 +2356,10 @@ class CfDef:
|
|||
(25, TType.DOUBLE, 'merge_shards_chance', None, None, ), # 25
|
||||
(26, TType.STRING, 'key_validation_class', None, None, ), # 26
|
||||
(27, TType.STRING, 'row_cache_provider', None, "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider", ), # 27
|
||||
(28, TType.STRING, 'key_alias', None, None, ), # 28
|
||||
)
|
||||
|
||||
def __init__(self, keyspace=None, name=None, column_type=thrift_spec[3][4], comparator_type=thrift_spec[5][4], subcomparator_type=None, comment=None, row_cache_size=thrift_spec[9][4], key_cache_size=thrift_spec[11][4], read_repair_chance=thrift_spec[12][4], column_metadata=None, gc_grace_seconds=None, default_validation_class=None, id=None, min_compaction_threshold=None, max_compaction_threshold=None, row_cache_save_period_in_seconds=None, key_cache_save_period_in_seconds=None, memtable_flush_after_mins=None, memtable_throughput_in_mb=None, memtable_operations_in_millions=None, replicate_on_write=None, merge_shards_chance=None, key_validation_class=None, row_cache_provider=thrift_spec[27][4],):
|
||||
def __init__(self, keyspace=None, name=None, column_type=thrift_spec[3][4], comparator_type=thrift_spec[5][4], subcomparator_type=None, comment=None, row_cache_size=thrift_spec[9][4], key_cache_size=thrift_spec[11][4], read_repair_chance=thrift_spec[12][4], column_metadata=None, gc_grace_seconds=None, default_validation_class=None, id=None, min_compaction_threshold=None, max_compaction_threshold=None, row_cache_save_period_in_seconds=None, key_cache_save_period_in_seconds=None, memtable_flush_after_mins=None, memtable_throughput_in_mb=None, memtable_operations_in_millions=None, replicate_on_write=None, merge_shards_chance=None, key_validation_class=None, row_cache_provider=thrift_spec[27][4], key_alias=None,):
|
||||
self.keyspace = keyspace
|
||||
self.name = name
|
||||
self.column_type = column_type
|
||||
|
|
@ -2382,6 +2384,7 @@ class CfDef:
|
|||
self.merge_shards_chance = merge_shards_chance
|
||||
self.key_validation_class = key_validation_class
|
||||
self.row_cache_provider = row_cache_provider
|
||||
self.key_alias = key_alias
|
||||
|
||||
def read(self, iprot):
|
||||
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
|
||||
|
|
@ -2518,6 +2521,11 @@ class CfDef:
|
|||
self.row_cache_provider = iprot.readString();
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
elif fid == 28:
|
||||
if ftype == TType.STRING:
|
||||
self.key_alias = iprot.readString();
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
iprot.readFieldEnd()
|
||||
|
|
@ -2627,6 +2635,10 @@ class CfDef:
|
|||
oprot.writeFieldBegin('row_cache_provider', TType.STRING, 27)
|
||||
oprot.writeString(self.row_cache_provider)
|
||||
oprot.writeFieldEnd()
|
||||
if self.key_alias != None:
|
||||
oprot.writeFieldBegin('key_alias', TType.STRING, 28)
|
||||
oprot.writeString(self.key_alias)
|
||||
oprot.writeFieldEnd()
|
||||
oprot.writeFieldStop()
|
||||
oprot.writeStructEnd()
|
||||
def validate(self):
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,4 +7,4 @@
|
|||
from thrift.Thrift import *
|
||||
from ttypes import *
|
||||
|
||||
VERSION = "20.0.0"
|
||||
VERSION = "20.1.0"
|
||||
|
|
|
|||
|
|
@ -2324,6 +2324,7 @@ class CfDef:
|
|||
- merge_shards_chance
|
||||
- key_validation_class
|
||||
- row_cache_provider
|
||||
- key_alias
|
||||
"""
|
||||
|
||||
thrift_spec = (
|
||||
|
|
@ -2355,9 +2356,10 @@ class CfDef:
|
|||
(25, TType.DOUBLE, 'merge_shards_chance', None, None, ), # 25
|
||||
(26, TType.STRING, 'key_validation_class', None, None, ), # 26
|
||||
(27, TType.STRING, 'row_cache_provider', None, "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider", ), # 27
|
||||
(28, TType.STRING, 'key_alias', None, None, ), # 28
|
||||
)
|
||||
|
||||
def __init__(self, keyspace=None, name=None, column_type=thrift_spec[3][4], comparator_type=thrift_spec[5][4], subcomparator_type=None, comment=None, row_cache_size=thrift_spec[9][4], key_cache_size=thrift_spec[11][4], read_repair_chance=thrift_spec[12][4], column_metadata=None, gc_grace_seconds=None, default_validation_class=None, id=None, min_compaction_threshold=None, max_compaction_threshold=None, row_cache_save_period_in_seconds=None, key_cache_save_period_in_seconds=None, memtable_flush_after_mins=None, memtable_throughput_in_mb=None, memtable_operations_in_millions=None, replicate_on_write=None, merge_shards_chance=None, key_validation_class=None, row_cache_provider=thrift_spec[27][4],):
|
||||
def __init__(self, keyspace=None, name=None, column_type=thrift_spec[3][4], comparator_type=thrift_spec[5][4], subcomparator_type=None, comment=None, row_cache_size=thrift_spec[9][4], key_cache_size=thrift_spec[11][4], read_repair_chance=thrift_spec[12][4], column_metadata=None, gc_grace_seconds=None, default_validation_class=None, id=None, min_compaction_threshold=None, max_compaction_threshold=None, row_cache_save_period_in_seconds=None, key_cache_save_period_in_seconds=None, memtable_flush_after_mins=None, memtable_throughput_in_mb=None, memtable_operations_in_millions=None, replicate_on_write=None, merge_shards_chance=None, key_validation_class=None, row_cache_provider=thrift_spec[27][4], key_alias=None,):
|
||||
self.keyspace = keyspace
|
||||
self.name = name
|
||||
self.column_type = column_type
|
||||
|
|
@ -2382,6 +2384,7 @@ class CfDef:
|
|||
self.merge_shards_chance = merge_shards_chance
|
||||
self.key_validation_class = key_validation_class
|
||||
self.row_cache_provider = row_cache_provider
|
||||
self.key_alias = key_alias
|
||||
|
||||
def read(self, iprot):
|
||||
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
|
||||
|
|
@ -2518,6 +2521,11 @@ class CfDef:
|
|||
self.row_cache_provider = iprot.readString();
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
elif fid == 28:
|
||||
if ftype == TType.STRING:
|
||||
self.key_alias = iprot.readString();
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
iprot.readFieldEnd()
|
||||
|
|
@ -2627,6 +2635,10 @@ class CfDef:
|
|||
oprot.writeFieldBegin('row_cache_provider', TType.STRING, 27)
|
||||
oprot.writeString(self.row_cache_provider)
|
||||
oprot.writeFieldEnd()
|
||||
if self.key_alias != None:
|
||||
oprot.writeFieldBegin('key_alias', TType.STRING, 28)
|
||||
oprot.writeString(self.key_alias)
|
||||
oprot.writeFieldEnd()
|
||||
oprot.writeFieldStop()
|
||||
oprot.writeStructEnd()
|
||||
def validate(self):
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace rb CassandraThrift
|
|||
# for every edit that doesn't result in a change to major/minor.
|
||||
#
|
||||
# See the Semantic Versioning Specification (SemVer) http://semver.org.
|
||||
const string VERSION = "20.0.0"
|
||||
const string VERSION = "20.1.0"
|
||||
|
||||
|
||||
#
|
||||
|
|
@ -394,6 +394,7 @@ struct CfDef {
|
|||
25: optional double merge_shards_chance,
|
||||
26: optional string key_validation_class,
|
||||
27: optional string row_cache_provider="org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider",
|
||||
28: optional binary key_alias,
|
||||
}
|
||||
|
||||
/* describes a keyspace. */
|
||||
|
|
|
|||
|
|
@ -69,6 +69,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 KEY_VALIDATION_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("key_validation_class", org.apache.thrift.protocol.TType.STRING, (short)26);
|
||||
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 KEY_ALIAS_FIELD_DESC = new org.apache.thrift.protocol.TField("key_alias", org.apache.thrift.protocol.TType.STRING, (short)28);
|
||||
|
||||
public String keyspace;
|
||||
public String name;
|
||||
|
|
@ -94,6 +95,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
public double merge_shards_chance;
|
||||
public String key_validation_class;
|
||||
public String row_cache_provider;
|
||||
public ByteBuffer key_alias;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
|
@ -120,7 +122,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
REPLICATE_ON_WRITE((short)24, "replicate_on_write"),
|
||||
MERGE_SHARDS_CHANCE((short)25, "merge_shards_chance"),
|
||||
KEY_VALIDATION_CLASS((short)26, "key_validation_class"),
|
||||
ROW_CACHE_PROVIDER((short)27, "row_cache_provider");
|
||||
ROW_CACHE_PROVIDER((short)27, "row_cache_provider"),
|
||||
KEY_ALIAS((short)28, "key_alias");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
|
@ -183,6 +186,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
return KEY_VALIDATION_CLASS;
|
||||
case 27: // ROW_CACHE_PROVIDER
|
||||
return ROW_CACHE_PROVIDER;
|
||||
case 28: // KEY_ALIAS
|
||||
return KEY_ALIAS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
@ -291,6 +296,8 @@ 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.ROW_CACHE_PROVIDER, new org.apache.thrift.meta_data.FieldMetaData("row_cache_provider", 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)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CfDef.class, metaDataMap);
|
||||
}
|
||||
|
|
@ -373,6 +380,10 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
if (other.isSetRow_cache_provider()) {
|
||||
this.row_cache_provider = other.row_cache_provider;
|
||||
}
|
||||
if (other.isSetKey_alias()) {
|
||||
this.key_alias = org.apache.thrift.TBaseHelper.copyBinary(other.key_alias);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public CfDef deepCopy() {
|
||||
|
|
@ -422,6 +433,7 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
this.key_validation_class = null;
|
||||
this.row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
|
||||
|
||||
this.key_alias = null;
|
||||
}
|
||||
|
||||
public String getKeyspace() {
|
||||
|
|
@ -1001,6 +1013,40 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
}
|
||||
}
|
||||
|
||||
public byte[] getKey_alias() {
|
||||
setKey_alias(org.apache.thrift.TBaseHelper.rightSize(key_alias));
|
||||
return key_alias == null ? null : key_alias.array();
|
||||
}
|
||||
|
||||
public ByteBuffer bufferForKey_alias() {
|
||||
return key_alias;
|
||||
}
|
||||
|
||||
public CfDef setKey_alias(byte[] key_alias) {
|
||||
setKey_alias(key_alias == null ? (ByteBuffer)null : ByteBuffer.wrap(key_alias));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CfDef setKey_alias(ByteBuffer key_alias) {
|
||||
this.key_alias = key_alias;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetKey_alias() {
|
||||
this.key_alias = null;
|
||||
}
|
||||
|
||||
/** Returns true if field key_alias is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetKey_alias() {
|
||||
return this.key_alias != null;
|
||||
}
|
||||
|
||||
public void setKey_aliasIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.key_alias = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case KEYSPACE:
|
||||
|
|
@ -1195,6 +1241,14 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
}
|
||||
break;
|
||||
|
||||
case KEY_ALIAS:
|
||||
if (value == null) {
|
||||
unsetKey_alias();
|
||||
} else {
|
||||
setKey_alias((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1272,6 +1326,9 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
case ROW_CACHE_PROVIDER:
|
||||
return getRow_cache_provider();
|
||||
|
||||
case KEY_ALIAS:
|
||||
return getKey_alias();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
|
@ -1331,6 +1388,8 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
return isSetKey_validation_class();
|
||||
case ROW_CACHE_PROVIDER:
|
||||
return isSetRow_cache_provider();
|
||||
case KEY_ALIAS:
|
||||
return isSetKey_alias();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
|
@ -1564,6 +1623,15 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_key_alias = true && this.isSetKey_alias();
|
||||
boolean that_present_key_alias = true && that.isSetKey_alias();
|
||||
if (this_present_key_alias || that_present_key_alias) {
|
||||
if (!(this_present_key_alias && that_present_key_alias))
|
||||
return false;
|
||||
if (!this.key_alias.equals(that.key_alias))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1691,6 +1759,11 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
if (present_row_cache_provider)
|
||||
builder.append(row_cache_provider);
|
||||
|
||||
boolean present_key_alias = true && (isSetKey_alias());
|
||||
builder.append(present_key_alias);
|
||||
if (present_key_alias)
|
||||
builder.append(key_alias);
|
||||
|
||||
return builder.toHashCode();
|
||||
}
|
||||
|
||||
|
|
@ -1942,6 +2015,16 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetKey_alias()).compareTo(typedOther.isSetKey_alias());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey_alias()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key_alias, typedOther.key_alias);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2152,6 +2235,13 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 28: // KEY_ALIAS
|
||||
if (field.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
this.key_alias = iprot.readBinary();
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
|
|
@ -2310,6 +2400,13 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (this.key_alias != null) {
|
||||
if (isSetKey_alias()) {
|
||||
oprot.writeFieldBegin(KEY_ALIAS_FIELD_DESC);
|
||||
oprot.writeBinary(this.key_alias);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
|
@ -2498,6 +2595,16 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
|
|||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetKey_alias()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("key_alias:");
|
||||
if (this.key_alias == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
org.apache.thrift.TBaseHelper.toString(this.key_alias, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class Constants {
|
||||
|
||||
public static final String VERSION = "20.0.0";
|
||||
public static final String VERSION = "20.1.0";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ protocol InterNode {
|
|||
union { int, null } id;
|
||||
union { array<ColumnDef>, null } column_metadata;
|
||||
union { string, null } row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
|
||||
union { null, bytes } key_alias = null;
|
||||
}
|
||||
|
||||
@aliases(["org.apache.cassandra.config.avro.KsDef"])
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import org.apache.cassandra.db.marshal.TimeUUIDType;
|
|||
import org.apache.cassandra.db.marshal.UTF8Type;
|
||||
import org.apache.cassandra.db.migration.Migration;
|
||||
import org.apache.cassandra.io.SerDeUtils;
|
||||
import org.apache.cassandra.thrift.InvalidRequestException;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
|
|
@ -131,7 +132,7 @@ public final class CFMetaData
|
|||
|
||||
//REQUIRED
|
||||
public final Integer cfId; // internal id, never exposed to user
|
||||
public final String ksName; // name of keyspace
|
||||
public final String ksName; // name of keyspace
|
||||
public final String cfName; // name of this column family
|
||||
public final ColumnFamilyType cfType; // standard, super
|
||||
public final AbstractType comparator; // bytes, long, timeuuid, utf8, etc.
|
||||
|
|
@ -155,6 +156,7 @@ public final class CFMetaData
|
|||
private double memtableOperationsInMillions; // default based on throughput
|
||||
private double mergeShardsChance; // default 0.1, chance [0.0, 1.0] of merging old shards during replication
|
||||
private IRowCacheProvider rowCacheProvider;
|
||||
private ByteBuffer keyAlias; // default NULL
|
||||
// NOTE: if you find yourself adding members to this class, make sure you keep the convert methods in lockstep.
|
||||
|
||||
private Map<ByteBuffer, ColumnDefinition> column_metadata;
|
||||
|
|
@ -175,6 +177,7 @@ public final class CFMetaData
|
|||
public CFMetaData memSize(int prop) {memtableThroughputInMb = prop; return this;}
|
||||
public CFMetaData memOps(double prop) {memtableOperationsInMillions = prop; return this;}
|
||||
public CFMetaData mergeShardsChance(double prop) {mergeShardsChance = prop; return this;}
|
||||
public CFMetaData keyAlias(ByteBuffer prop) {keyAlias = prop; return this;}
|
||||
public CFMetaData columnMetadata(Map<ByteBuffer,ColumnDefinition> prop) {column_metadata = prop; return this;}
|
||||
public CFMetaData rowCacheProvider(IRowCacheProvider prop) { rowCacheProvider = prop; return this;};
|
||||
|
||||
|
|
@ -236,6 +239,7 @@ public final class CFMetaData
|
|||
defaultValidator = BytesType.instance;
|
||||
keyValidator = BytesType.instance;
|
||||
comment = "";
|
||||
keyAlias = null; // This qualifies as a 'strange default'.
|
||||
column_metadata = new HashMap<ByteBuffer,ColumnDefinition>();
|
||||
}
|
||||
|
||||
|
|
@ -335,6 +339,7 @@ public final class CFMetaData
|
|||
cf.memtable_throughput_in_mb = memtableThroughputInMb;
|
||||
cf.memtable_operations_in_millions = memtableOperationsInMillions;
|
||||
cf.merge_shards_chance = mergeShardsChance;
|
||||
cf.key_alias = keyAlias;
|
||||
cf.column_metadata = SerDeUtils.createArray(column_metadata.size(),
|
||||
org.apache.cassandra.db.migration.avro.ColumnDef.SCHEMA$);
|
||||
for (ColumnDefinition cd : column_metadata.values())
|
||||
|
|
@ -399,6 +404,7 @@ public final class CFMetaData
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if (cf.key_alias != null) { newCFMD.keyAlias(cf.key_alias); }
|
||||
|
||||
return newCFMD.comment(cf.comment.toString())
|
||||
.rowCacheSize(cf.row_cache_size)
|
||||
|
|
@ -496,6 +502,11 @@ public final class CFMetaData
|
|||
return rowCacheProvider;
|
||||
}
|
||||
|
||||
public ByteBuffer getKeyAlias()
|
||||
{
|
||||
return keyAlias;
|
||||
}
|
||||
|
||||
public Map<ByteBuffer, ColumnDefinition> getColumn_metadata()
|
||||
{
|
||||
return Collections.unmodifiableMap(column_metadata);
|
||||
|
|
@ -506,7 +517,7 @@ public final class CFMetaData
|
|||
return superColumnName == null ? comparator : subcolumnComparator;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj)
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
{
|
||||
|
|
@ -542,6 +553,7 @@ public final class CFMetaData
|
|||
.append(memtableThroughputInMb, rhs.memtableThroughputInMb)
|
||||
.append(memtableOperationsInMillions, rhs.memtableOperationsInMillions)
|
||||
.append(mergeShardsChance, rhs.mergeShardsChance)
|
||||
.append(keyAlias, rhs.keyAlias)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
|
@ -571,6 +583,7 @@ public final class CFMetaData
|
|||
.append(memtableThroughputInMb)
|
||||
.append(memtableOperationsInMillions)
|
||||
.append(mergeShardsChance)
|
||||
.append(keyAlias)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +625,49 @@ public final class CFMetaData
|
|||
if (!cf_def.isSetRow_cache_provider())
|
||||
cf_def.setRow_cache_provider(CFMetaData.DEFAULT_ROW_CACHE_PROVIDER);
|
||||
}
|
||||
|
||||
|
||||
public static CFMetaData convertToCFMetaData(org.apache.cassandra.thrift.CfDef cf_def) throws InvalidRequestException, ConfigurationException
|
||||
{
|
||||
ColumnFamilyType cfType = ColumnFamilyType.create(cf_def.column_type);
|
||||
if (cfType == null)
|
||||
{
|
||||
throw new InvalidRequestException("Invalid column type " + cf_def.column_type);
|
||||
}
|
||||
|
||||
applyImplicitDefaults(cf_def);
|
||||
|
||||
validateMinMaxCompactionThresholds(cf_def);
|
||||
validateMemtableSettings(cf_def);
|
||||
validateAliasCompares(cf_def);
|
||||
|
||||
CFMetaData newCFMD = new CFMetaData(cf_def.keyspace,
|
||||
cf_def.name,
|
||||
cfType,
|
||||
DatabaseDescriptor.getComparator(cf_def.comparator_type),
|
||||
cf_def.subcomparator_type == null ? null : DatabaseDescriptor.getComparator(cf_def.subcomparator_type));
|
||||
|
||||
if (cf_def.isSetGc_grace_seconds()) { newCFMD.gcGraceSeconds(cf_def.gc_grace_seconds); }
|
||||
if (cf_def.isSetMin_compaction_threshold()) { newCFMD.minCompactionThreshold(cf_def.min_compaction_threshold); }
|
||||
if (cf_def.isSetMax_compaction_threshold()) { newCFMD.maxCompactionThreshold(cf_def.max_compaction_threshold); }
|
||||
if (cf_def.isSetRow_cache_save_period_in_seconds()) { newCFMD.rowCacheSavePeriod(cf_def.row_cache_save_period_in_seconds); }
|
||||
if (cf_def.isSetKey_cache_save_period_in_seconds()) { newCFMD.keyCacheSavePeriod(cf_def.key_cache_save_period_in_seconds); }
|
||||
if (cf_def.isSetMemtable_flush_after_mins()) { newCFMD.memTime(cf_def.memtable_flush_after_mins); }
|
||||
if (cf_def.isSetMemtable_throughput_in_mb()) { newCFMD.memSize(cf_def.memtable_throughput_in_mb); }
|
||||
if (cf_def.isSetMemtable_operations_in_millions()) { newCFMD.memOps(cf_def.memtable_operations_in_millions); }
|
||||
if (cf_def.isSetMerge_shards_chance()) { newCFMD.mergeShardsChance(cf_def.merge_shards_chance); }
|
||||
if (cf_def.isSetRow_cache_provider()) { newCFMD.rowCacheProvider(FBUtilities.newCacheProvider(cf_def.row_cache_provider)); }
|
||||
if (cf_def.isSetKey_alias()) { newCFMD.keyAlias(cf_def.key_alias); }
|
||||
|
||||
return newCFMD.comment(cf_def.comment)
|
||||
.rowCacheSize(cf_def.row_cache_size)
|
||||
.keyCacheSize(cf_def.key_cache_size)
|
||||
.readRepairChance(cf_def.read_repair_chance)
|
||||
.replicateOnWrite(cf_def.replicate_on_write)
|
||||
.defaultValidator(DatabaseDescriptor.getComparator(cf_def.default_validation_class))
|
||||
.keyValidator(DatabaseDescriptor.getComparator(cf_def.key_validation_class))
|
||||
.columnMetadata(ColumnDefinition.fromColumnDef(cf_def.column_metadata));
|
||||
}
|
||||
|
||||
// merges some final fields from this CFM with modifiable fields from CfDef into a new CFMetaData.
|
||||
public void apply(org.apache.cassandra.db.migration.avro.CfDef cf_def) throws ConfigurationException
|
||||
{
|
||||
|
|
@ -638,6 +693,7 @@ public final class CFMetaData
|
|||
|
||||
validateMinMaxCompactionThresholds(cf_def);
|
||||
validateMemtableSettings(cf_def);
|
||||
validateAliasCompares(cf_def);
|
||||
|
||||
comment = enforceCommentNotNull(cf_def.comment);
|
||||
rowCacheSize = cf_def.row_cache_size;
|
||||
|
|
@ -657,7 +713,8 @@ public final class CFMetaData
|
|||
mergeShardsChance = cf_def.merge_shards_chance;
|
||||
if (cf_def.row_cache_provider != null)
|
||||
rowCacheProvider = FBUtilities.newCacheProvider(cf_def.row_cache_provider.toString());
|
||||
|
||||
keyAlias = cf_def.key_alias;
|
||||
|
||||
// adjust secondary indexes. figure out who is coming and going.
|
||||
Set<ByteBuffer> toRemove = new HashSet<ByteBuffer>();
|
||||
Set<ByteBuffer> newIndexNames = new HashSet<ByteBuffer>();
|
||||
|
|
@ -723,6 +780,7 @@ public final class CFMetaData
|
|||
def.setMemtable_throughput_in_mb(cfm.memtableThroughputInMb);
|
||||
def.setMemtable_operations_in_millions(cfm.memtableOperationsInMillions);
|
||||
def.setMerge_shards_chance(cfm.mergeShardsChance);
|
||||
def.setKey_alias(cfm.keyAlias);
|
||||
List<org.apache.cassandra.thrift.ColumnDef> column_meta = new ArrayList< org.apache.cassandra.thrift.ColumnDef>(cfm.column_metadata.size());
|
||||
for (ColumnDefinition cd : cfm.column_metadata.values())
|
||||
{
|
||||
|
|
@ -767,6 +825,7 @@ public final class CFMetaData
|
|||
def.memtable_operations_in_millions = cfm.memtableOperationsInMillions;
|
||||
def.merge_shards_chance = cfm.mergeShardsChance;
|
||||
def.key_validation_class = cfm.keyValidator.getClass().getName();
|
||||
def.key_alias = cfm.keyAlias;
|
||||
List<org.apache.cassandra.db.migration.avro.ColumnDef> column_meta = new ArrayList<org.apache.cassandra.db.migration.avro.ColumnDef>(cfm.column_metadata.size());
|
||||
for (ColumnDefinition cd : cfm.column_metadata.values())
|
||||
{
|
||||
|
|
@ -807,6 +866,7 @@ public final class CFMetaData
|
|||
newDef.row_cache_size = def.getRow_cache_size();
|
||||
newDef.subcomparator_type = def.getSubcomparator_type();
|
||||
newDef.merge_shards_chance = def.getMerge_shards_chance();
|
||||
newDef.key_alias = def.key_alias;
|
||||
|
||||
List<org.apache.cassandra.db.migration.avro.ColumnDef> columnMeta = new ArrayList<org.apache.cassandra.db.migration.avro.ColumnDef>();
|
||||
if (def.isSetColumn_metadata())
|
||||
|
|
@ -905,6 +965,20 @@ public final class CFMetaData
|
|||
DatabaseDescriptor.validateMemtableOperations(cf_def.memtable_operations_in_millions);
|
||||
}
|
||||
|
||||
public static void validateAliasCompares(org.apache.cassandra.thrift.CfDef cf_def) throws ConfigurationException
|
||||
{
|
||||
AbstractType comparator = DatabaseDescriptor.getComparator(cf_def.comparator_type);
|
||||
if (cf_def.key_alias != null)
|
||||
comparator.validate(cf_def.key_alias);
|
||||
}
|
||||
|
||||
public static void validateAliasCompares(org.apache.cassandra.db.migration.avro.CfDef cf_def) throws ConfigurationException
|
||||
{
|
||||
AbstractType comparator = DatabaseDescriptor.getComparator(cf_def.comparator_type);
|
||||
if (cf_def.key_alias != null)
|
||||
comparator.validate(cf_def.key_alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
@ -931,6 +1005,7 @@ public final class CFMetaData
|
|||
.append("memtableThroughputInMb", memtableThroughputInMb)
|
||||
.append("memtableOperationsInMillions", memtableOperationsInMillions)
|
||||
.append("mergeShardsChance", mergeShardsChance)
|
||||
.append("keyAlias", keyAlias)
|
||||
.append("column_metadata", column_metadata)
|
||||
.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
|
|||
public void finishBootstrapping()
|
||||
{
|
||||
isBootstrapMode = false;
|
||||
SystemTable.setBootstrapped(true);
|
||||
setToken(getLocalToken());
|
||||
logger_.info("Bootstrap/move completed! Now serving reads.");
|
||||
}
|
||||
|
|
@ -439,14 +440,13 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
|
|||
logger_.info("This node will not auto bootstrap because it is configured to be a seed node.");
|
||||
|
||||
Token token;
|
||||
boolean bootstrapped = false;
|
||||
if (DatabaseDescriptor.isAutoBootstrap()
|
||||
&& !(DatabaseDescriptor.getSeeds().contains(FBUtilities.getLocalAddress()) || SystemTable.isBootstrapped()))
|
||||
{
|
||||
setMode("Joining: getting load information", true);
|
||||
setMode("Joining: getting load and schema information", true);
|
||||
StorageLoadBalancer.instance.waitForLoadInfo();
|
||||
if (logger_.isDebugEnabled())
|
||||
logger_.debug("... got load info");
|
||||
logger_.debug("... got load + schema info");
|
||||
if (tokenMetadata_.isMember(FBUtilities.getLocalAddress()))
|
||||
{
|
||||
String s = "This node is already a member of the token ring; bootstrap aborted. (If replacing a dead node, remove the old one from the ring first.)";
|
||||
|
|
@ -459,8 +459,6 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
|
|||
{
|
||||
bootstrap(token);
|
||||
assert !isBootstrapMode; // bootstrap will block until finished
|
||||
bootstrapped = true;
|
||||
SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
|
||||
}
|
||||
// else nothing to do, go directly to participating in ring
|
||||
}
|
||||
|
|
@ -485,7 +483,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
|
|||
{
|
||||
logger_.info("Using saved token " + token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
|
||||
setToken(token);
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
|
||||
try
|
||||
{
|
||||
applyMigrationOnStage(new AddColumnFamily(convertToCFMetaData(cf_def)));
|
||||
applyMigrationOnStage(new AddColumnFamily(CFMetaData.convertToCFMetaData(cf_def)));
|
||||
return DatabaseDescriptor.getDefsVersion().toString();
|
||||
}
|
||||
catch (ConfigurationException e)
|
||||
|
|
@ -855,7 +855,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
for (CfDef cfDef : ks_def.cf_defs)
|
||||
{
|
||||
ThriftValidation.validateCfDef(cfDef);
|
||||
cfDefs.add(convertToCFMetaData(cfDef));
|
||||
cfDefs.add(CFMetaData.convertToCFMetaData(cfDef));
|
||||
}
|
||||
|
||||
// Attempt to instantiate the ARS, which will throw a ConfigException if
|
||||
|
|
@ -996,45 +996,6 @@ public class CassandraServer implements Cassandra.Iface
|
|||
throw new SchemaDisagreementException();
|
||||
}
|
||||
|
||||
// @see CFMetaData.applyImplicitDefaults().
|
||||
private CFMetaData convertToCFMetaData(CfDef cf_def) throws InvalidRequestException, ConfigurationException
|
||||
{
|
||||
ColumnFamilyType cfType = ColumnFamilyType.create(cf_def.column_type);
|
||||
if (cfType == null)
|
||||
{
|
||||
throw new InvalidRequestException("Invalid column type " + cf_def.column_type);
|
||||
}
|
||||
|
||||
CFMetaData.applyImplicitDefaults(cf_def);
|
||||
CFMetaData.validateMinMaxCompactionThresholds(cf_def);
|
||||
CFMetaData.validateMemtableSettings(cf_def);
|
||||
|
||||
CFMetaData newCFMD = new CFMetaData(cf_def.keyspace,
|
||||
cf_def.name,
|
||||
cfType,
|
||||
DatabaseDescriptor.getComparator(cf_def.comparator_type),
|
||||
cf_def.subcomparator_type == null ? null : DatabaseDescriptor.getComparator(cf_def.subcomparator_type));
|
||||
|
||||
if (cf_def.isSetGc_grace_seconds()) { newCFMD.gcGraceSeconds(cf_def.gc_grace_seconds); }
|
||||
if (cf_def.isSetMin_compaction_threshold()) { newCFMD.minCompactionThreshold(cf_def.min_compaction_threshold); }
|
||||
if (cf_def.isSetMax_compaction_threshold()) { newCFMD.maxCompactionThreshold(cf_def.max_compaction_threshold); }
|
||||
if (cf_def.isSetRow_cache_save_period_in_seconds()) { newCFMD.rowCacheSavePeriod(cf_def.row_cache_save_period_in_seconds); }
|
||||
if (cf_def.isSetKey_cache_save_period_in_seconds()) { newCFMD.keyCacheSavePeriod(cf_def.key_cache_save_period_in_seconds); }
|
||||
if (cf_def.isSetMemtable_flush_after_mins()) { newCFMD.memTime(cf_def.memtable_flush_after_mins); }
|
||||
if (cf_def.isSetMemtable_throughput_in_mb()) { newCFMD.memSize(cf_def.memtable_throughput_in_mb); }
|
||||
if (cf_def.isSetMemtable_operations_in_millions()) { newCFMD.memOps(cf_def.memtable_operations_in_millions); }
|
||||
if (cf_def.isSetMerge_shards_chance()) { newCFMD.mergeShardsChance(cf_def.merge_shards_chance); }
|
||||
if (cf_def.isSetRow_cache_provider()) { newCFMD.rowCacheProvider(FBUtilities.newCacheProvider(cf_def.row_cache_provider)); }
|
||||
|
||||
return newCFMD.comment(cf_def.comment)
|
||||
.rowCacheSize(cf_def.row_cache_size)
|
||||
.keyCacheSize(cf_def.key_cache_size)
|
||||
.readRepairChance(cf_def.read_repair_chance)
|
||||
.replicateOnWrite(cf_def.replicate_on_write)
|
||||
.defaultValidator(DatabaseDescriptor.getComparator(cf_def.default_validation_class))
|
||||
.columnMetadata(ColumnDefinition.fromColumnDef(cf_def.column_metadata));
|
||||
}
|
||||
|
||||
public void truncate(String cfname) throws InvalidRequestException, UnavailableException, TException
|
||||
{
|
||||
logger.debug("truncating {} in {}", cfname, state().getKeyspace());
|
||||
|
|
|
|||
Loading…
Reference in New Issue