mirror of https://github.com/apache/cassandra
tjake
git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1026200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aeb0d5467d
commit
e7a385ac3f
58
build.xml
58
build.xml
|
|
@ -74,8 +74,8 @@
|
|||
<available file="${build.src.java}" type="dir" />
|
||||
</condition>
|
||||
|
||||
<!--
|
||||
Add all the dependencies.
|
||||
<!--
|
||||
Add all the dependencies.
|
||||
-->
|
||||
<path id="autoivy.classpath">
|
||||
<fileset dir="${build.dir.lib}">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
</path>
|
||||
|
||||
<!--
|
||||
Setup the output directories.
|
||||
Setup the output directories.
|
||||
-->
|
||||
<target name="init">
|
||||
<fail unless="is.source.artifact"
|
||||
|
|
@ -126,11 +126,11 @@
|
|||
This generates the CLI grammar files from Cli.g
|
||||
-->
|
||||
<target name="check-gen-cli-grammar">
|
||||
<uptodate property="cliUpToDate"
|
||||
srcfile="${build.src.java}/org/apache/cassandra/cli/Cli.g"
|
||||
<uptodate property="cliUpToDate"
|
||||
srcfile="${build.src.java}/org/apache/cassandra/cli/Cli.g"
|
||||
targetfile="${build.src.gen-java}/org/apache/cassandra/cli/Cli.tokens"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="gen-cli-grammar" depends="check-gen-cli-grammar" unless="cliUpToDate">
|
||||
<echo>Building Grammar ${build.src.java}/org/apache/cassandra/cli/Cli.g ....</echo>
|
||||
<java classname="org.antlr.Tool"
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
<arg value="${build.src.java}/org/apache/cassandra/cli/Cli.g" />
|
||||
<arg value="-fo" />
|
||||
<arg value="${build.src.gen-java}/org/apache/cassandra/cli/" />
|
||||
</java>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
<arg value="@{inputfile}" />
|
||||
<arg value="@{jsondir}/@{protocolname}.avpr" />
|
||||
</java>
|
||||
|
||||
|
||||
<!-- Generate java code from JSON protocol schema -->
|
||||
<avro-protocol destdir="@{outputdir}/gen-java">
|
||||
<fileset file="@{jsondir}/@{protocolname}.avpr" />
|
||||
|
|
@ -254,21 +254,21 @@
|
|||
</target>
|
||||
|
||||
<!-- create properties file with C version -->
|
||||
<target name="createVersionPropFile">
|
||||
<target name="createVersionPropFile">
|
||||
<taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
|
||||
<propertyfile file="${version.properties.dir}/version.properties">
|
||||
<entry key="CassandraVersion" value="${version}"/>
|
||||
<entry key="CassandraVersion" value="${version}"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
The build target builds all the .class files
|
||||
The build target builds all the .class files
|
||||
-->
|
||||
<target name="build"
|
||||
depends="ivy-retrieve-build,avro-generate,build-subprojects,build-project" description="Compile Cassandra classes"/>
|
||||
<target name="build-subprojects" description="Compile Cassandra contrib projects"/>
|
||||
<target name="codecoverage" depends="cobertura-instrument,test,cobertura-report" description="Create code coverage report"/>
|
||||
|
||||
|
||||
<target depends="init,avro-generate,gen-cli-grammar" name="build-project">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.classes}">
|
||||
|
|
@ -277,7 +277,7 @@
|
|||
<src path="${interface.thrift.dir}/gen-java"/>
|
||||
<classpath refid="cassandra.classpath"/>
|
||||
</javac>
|
||||
|
||||
|
||||
<taskdef name="paranamer" classname="com.thoughtworks.paranamer.ant.ParanamerGeneratorTask">
|
||||
<classpath refid="cassandra.classpath" />
|
||||
</taskdef>
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
|
||||
|
||||
<!--
|
||||
The jar target makes cassandra.jar output.
|
||||
The jar target makes cassandra.jar output.
|
||||
-->
|
||||
<target name="jar" depends="build" description="Assemble Cassandra JAR files">
|
||||
<mkdir dir="${build.classes}/META-INF"/>
|
||||
|
|
@ -309,7 +309,7 @@
|
|||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- creates a release tarball -->
|
||||
<!-- creates a release tarball -->
|
||||
<target name="release" depends="jar,javadoc,rat-init" description="Create a full Cassandra binary distribution including tar.gz">
|
||||
<mkdir dir="${dist.dir}"/>
|
||||
<copy todir="${dist.dir}/lib">
|
||||
|
|
@ -326,20 +326,20 @@
|
|||
</copy>
|
||||
<copy todir="${dist.dir}/conf">
|
||||
<fileset dir="conf"/>
|
||||
</copy>
|
||||
</copy>
|
||||
<copy todir="${dist.dir}/interface">
|
||||
<fileset dir="interface">
|
||||
<include name="**/*.thrift" />
|
||||
<include name="cassandra.genavro" />
|
||||
<include name="avro/cassandra.avpr" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</copy>
|
||||
<copy todir="${dist.dir}/">
|
||||
<fileset dir="${basedir}">
|
||||
<include name="*.txt" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
|
||||
<tar compression="gzip" longfile="gnu"
|
||||
destfile="${build.dir}/${final.name}-bin.tar.gz">
|
||||
|
||||
|
|
@ -356,9 +356,9 @@
|
|||
<tarfileset dir="${dist.dir}" prefix="${final.name}" mode="755">
|
||||
<include name="bin/*"/>
|
||||
<not>
|
||||
<filename name="bin/*.in.sh" />
|
||||
<filename name="bin/*.in.sh" />
|
||||
</not>
|
||||
</tarfileset>
|
||||
</tarfileset>
|
||||
</tar>
|
||||
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
|
||||
reportFile="${build.dir}/${final.name}-bin.rat.txt">
|
||||
|
|
@ -392,7 +392,7 @@
|
|||
<include name="bin/*"/>
|
||||
<exclude name="bin/*.in.sh" />
|
||||
<exclude name="bin/*.bat" />
|
||||
</tarfileset>
|
||||
</tarfileset>
|
||||
</tar>
|
||||
|
||||
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
|
||||
|
|
@ -415,7 +415,7 @@
|
|||
<src path="${test.long.src}"/>
|
||||
</javac>
|
||||
|
||||
<!-- Non-java resources needed by the test suite -->
|
||||
<!-- Non-java resources needed by the test suite -->
|
||||
<copy todir="${test.classes}">
|
||||
<fileset dir="${test.resources}"/>
|
||||
</copy>
|
||||
|
|
@ -459,7 +459,7 @@
|
|||
<target name="long-test" depends="build-test" description="Execute functional tests">
|
||||
<testmacro suitename="long" inputdir="${test.long.src}" timeout="300000" />
|
||||
</target>
|
||||
|
||||
|
||||
<!-- instruments the classes to later create code coverage reports -->
|
||||
<target name="cobertura-instrument" depends="build,build-test">
|
||||
<taskdef resource="tasks.properties">
|
||||
|
|
@ -470,12 +470,12 @@
|
|||
</fileset>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
|
||||
<delete file="${cobertura.datafile}"/>
|
||||
|
||||
|
||||
<cobertura-instrument todir="${cobertura.classes.dir}" datafile="${cobertura.datafile}">
|
||||
<ignore regex="org.apache.log4j.*"/>
|
||||
|
||||
|
||||
<fileset dir="${build.classes}">
|
||||
<include name="**/*.class"/>
|
||||
<exclude name="**/*Test.class"/>
|
||||
|
|
@ -483,9 +483,9 @@
|
|||
<exclude name="**/test/*.class"/>
|
||||
<exclude name="${cobertura.excludes}"/>
|
||||
</fileset>
|
||||
|
||||
|
||||
</cobertura-instrument>
|
||||
</target>
|
||||
</target>
|
||||
|
||||
<!-- create both html and xml code coverage reports -->
|
||||
<target name="cobertura-report">
|
||||
|
|
@ -528,7 +528,7 @@
|
|||
<arg value="." />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="javadoc" depends="init" description="Create javadoc">
|
||||
<tstamp>
|
||||
<format property="YEAR" pattern="yyyy"/>
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ service Cassandra {
|
|||
*/
|
||||
ColumnOrSuperColumn get(1:required binary key,
|
||||
2:required ColumnPath column_path,
|
||||
3:required ConsistencyLevel consistency_level=ONE)
|
||||
3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:NotFoundException nfe, 3:UnavailableException ue, 4:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -383,7 +383,7 @@ service Cassandra {
|
|||
list<ColumnOrSuperColumn> get_slice(1:required binary key,
|
||||
2:required ColumnParent column_parent,
|
||||
3:required SlicePredicate predicate,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -393,7 +393,7 @@ service Cassandra {
|
|||
i32 get_count(1:required binary key,
|
||||
2:required ColumnParent column_parent,
|
||||
3:required SlicePredicate predicate,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -402,7 +402,7 @@ service Cassandra {
|
|||
map<binary,list<ColumnOrSuperColumn>> multiget_slice(1:required list<binary> keys,
|
||||
2:required ColumnParent column_parent,
|
||||
3:required SlicePredicate predicate,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -411,7 +411,7 @@ service Cassandra {
|
|||
map<binary, i32> multiget_count(1:required list<binary> keys,
|
||||
2:required ColumnParent column_parent,
|
||||
3:required SlicePredicate predicate,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -420,14 +420,14 @@ service Cassandra {
|
|||
list<KeySlice> get_range_slices(1:required ColumnParent column_parent,
|
||||
2:required SlicePredicate predicate,
|
||||
3:required KeyRange range,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/** Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause */
|
||||
list<KeySlice> get_indexed_slices(1:required ColumnParent column_parent,
|
||||
2:required IndexClause index_clause,
|
||||
3:required SlicePredicate column_predicate,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
# modification methods
|
||||
|
|
@ -438,7 +438,7 @@ service Cassandra {
|
|||
void insert(1:required binary key,
|
||||
2:required ColumnParent column_parent,
|
||||
3:required Column column,
|
||||
4:required ConsistencyLevel consistency_level=ONE)
|
||||
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -449,7 +449,7 @@ service Cassandra {
|
|||
void remove(1:required binary key,
|
||||
2:required ColumnPath column_path,
|
||||
3:required i64 timestamp,
|
||||
4:ConsistencyLevel consistency_level=ONE)
|
||||
4:ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
@ -458,7 +458,7 @@ service Cassandra {
|
|||
mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
|
||||
**/
|
||||
void batch_mutate(1:required map<binary, map<string, list<Mutation>>> mutation_map,
|
||||
2:required ConsistencyLevel consistency_level=ONE)
|
||||
2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
|
||||
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -149,9 +150,9 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
return new AuthenticationException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AuthenticationException clone() {
|
||||
return new AuthenticationException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.why = null;
|
||||
}
|
||||
|
||||
public String getWhy() {
|
||||
|
|
@ -191,10 +192,6 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case WHY:
|
||||
|
|
@ -204,12 +201,12 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case WHY:
|
||||
return isSetWhy();
|
||||
|
|
@ -217,10 +214,6 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -270,7 +263,8 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetWhy()) { lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (isSetWhy()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -278,6 +272,10 @@ public class AuthenticationException extends Exception implements TBase<Authenti
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -163,9 +164,9 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
return new AuthenticationRequest(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AuthenticationRequest clone() {
|
||||
return new AuthenticationRequest(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.credentials = null;
|
||||
}
|
||||
|
||||
public int getCredentialsSize() {
|
||||
|
|
@ -216,10 +217,6 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case CREDENTIALS:
|
||||
|
|
@ -229,12 +226,12 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case CREDENTIALS:
|
||||
return isSetCredentials();
|
||||
|
|
@ -242,10 +239,6 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -295,7 +288,8 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCredentials()) { lastComparison = TBaseHelper.compareTo(this.credentials, typedOther.credentials);
|
||||
if (isSetCredentials()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.credentials, typedOther.credentials);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -303,6 +297,10 @@ public class AuthenticationRequest implements TBase<AuthenticationRequest, Authe
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -149,9 +150,9 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
return new AuthorizationException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AuthorizationException clone() {
|
||||
return new AuthorizationException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.why = null;
|
||||
}
|
||||
|
||||
public String getWhy() {
|
||||
|
|
@ -191,10 +192,6 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case WHY:
|
||||
|
|
@ -204,12 +201,12 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case WHY:
|
||||
return isSetWhy();
|
||||
|
|
@ -217,10 +214,6 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -270,7 +263,8 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetWhy()) { lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (isSetWhy()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -278,6 +272,10 @@ public class AuthorizationException extends Exception implements TBase<Authoriza
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -355,9 +356,44 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
return new CfDef(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public CfDef clone() {
|
||||
return new CfDef(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.keyspace = null;
|
||||
this.name = null;
|
||||
this.column_type = "Standard";
|
||||
|
||||
this.comparator_type = "BytesType";
|
||||
|
||||
this.subcomparator_type = null;
|
||||
this.comment = null;
|
||||
this.row_cache_size = (double)0;
|
||||
|
||||
this.preload_row_cache = false;
|
||||
|
||||
this.key_cache_size = (double)200000;
|
||||
|
||||
this.read_repair_chance = 1;
|
||||
|
||||
this.column_metadata = null;
|
||||
setGc_grace_secondsIsSet(false);
|
||||
this.gc_grace_seconds = 0;
|
||||
this.default_validation_class = null;
|
||||
setIdIsSet(false);
|
||||
this.id = 0;
|
||||
setMin_compaction_thresholdIsSet(false);
|
||||
this.min_compaction_threshold = 0;
|
||||
setMax_compaction_thresholdIsSet(false);
|
||||
this.max_compaction_threshold = 0;
|
||||
setRow_cache_save_period_in_secondsIsSet(false);
|
||||
this.row_cache_save_period_in_seconds = 0;
|
||||
setKey_cache_save_period_in_secondsIsSet(false);
|
||||
this.key_cache_save_period_in_seconds = 0;
|
||||
setMemtable_flush_after_minsIsSet(false);
|
||||
this.memtable_flush_after_mins = 0;
|
||||
setMemtable_throughput_in_mbIsSet(false);
|
||||
this.memtable_throughput_in_mb = 0;
|
||||
setMemtable_operations_in_millionsIsSet(false);
|
||||
this.memtable_operations_in_millions = 0.0;
|
||||
}
|
||||
|
||||
public String getKeyspace() {
|
||||
|
|
@ -1039,10 +1075,6 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEYSPACE:
|
||||
|
|
@ -1112,12 +1144,12 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case KEYSPACE:
|
||||
return isSetKeyspace();
|
||||
|
|
@ -1165,10 +1197,6 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -1498,7 +1526,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKeyspace()) { lastComparison = TBaseHelper.compareTo(this.keyspace, typedOther.keyspace);
|
||||
if (isSetKeyspace()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.keyspace, typedOther.keyspace);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1507,7 +1536,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1516,7 +1546,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_type()) { lastComparison = TBaseHelper.compareTo(this.column_type, typedOther.column_type);
|
||||
if (isSetColumn_type()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_type, typedOther.column_type);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1525,7 +1556,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetComparator_type()) { lastComparison = TBaseHelper.compareTo(this.comparator_type, typedOther.comparator_type);
|
||||
if (isSetComparator_type()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.comparator_type, typedOther.comparator_type);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1534,7 +1566,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSubcomparator_type()) { lastComparison = TBaseHelper.compareTo(this.subcomparator_type, typedOther.subcomparator_type);
|
||||
if (isSetSubcomparator_type()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.subcomparator_type, typedOther.subcomparator_type);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1543,7 +1576,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetComment()) { lastComparison = TBaseHelper.compareTo(this.comment, typedOther.comment);
|
||||
if (isSetComment()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.comment, typedOther.comment);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1552,7 +1586,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRow_cache_size()) { lastComparison = TBaseHelper.compareTo(this.row_cache_size, typedOther.row_cache_size);
|
||||
if (isSetRow_cache_size()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.row_cache_size, typedOther.row_cache_size);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1561,7 +1596,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetPreload_row_cache()) { lastComparison = TBaseHelper.compareTo(this.preload_row_cache, typedOther.preload_row_cache);
|
||||
if (isSetPreload_row_cache()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.preload_row_cache, typedOther.preload_row_cache);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1570,7 +1606,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey_cache_size()) { lastComparison = TBaseHelper.compareTo(this.key_cache_size, typedOther.key_cache_size);
|
||||
if (isSetKey_cache_size()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.key_cache_size, typedOther.key_cache_size);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1579,7 +1616,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRead_repair_chance()) { lastComparison = TBaseHelper.compareTo(this.read_repair_chance, typedOther.read_repair_chance);
|
||||
if (isSetRead_repair_chance()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.read_repair_chance, typedOther.read_repair_chance);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1588,7 +1626,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_metadata()) { lastComparison = TBaseHelper.compareTo(this.column_metadata, typedOther.column_metadata);
|
||||
if (isSetColumn_metadata()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_metadata, typedOther.column_metadata);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1597,7 +1636,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetGc_grace_seconds()) { lastComparison = TBaseHelper.compareTo(this.gc_grace_seconds, typedOther.gc_grace_seconds);
|
||||
if (isSetGc_grace_seconds()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.gc_grace_seconds, typedOther.gc_grace_seconds);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1606,7 +1646,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetDefault_validation_class()) { lastComparison = TBaseHelper.compareTo(this.default_validation_class, typedOther.default_validation_class);
|
||||
if (isSetDefault_validation_class()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.default_validation_class, typedOther.default_validation_class);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1615,7 +1656,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetId()) { lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
|
||||
if (isSetId()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1624,7 +1666,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMin_compaction_threshold()) { lastComparison = TBaseHelper.compareTo(this.min_compaction_threshold, typedOther.min_compaction_threshold);
|
||||
if (isSetMin_compaction_threshold()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.min_compaction_threshold, typedOther.min_compaction_threshold);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1633,7 +1676,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMax_compaction_threshold()) { lastComparison = TBaseHelper.compareTo(this.max_compaction_threshold, typedOther.max_compaction_threshold);
|
||||
if (isSetMax_compaction_threshold()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.max_compaction_threshold, typedOther.max_compaction_threshold);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1642,7 +1686,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRow_cache_save_period_in_seconds()) { lastComparison = TBaseHelper.compareTo(this.row_cache_save_period_in_seconds, typedOther.row_cache_save_period_in_seconds);
|
||||
if (isSetRow_cache_save_period_in_seconds()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.row_cache_save_period_in_seconds, typedOther.row_cache_save_period_in_seconds);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1651,7 +1696,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey_cache_save_period_in_seconds()) { lastComparison = TBaseHelper.compareTo(this.key_cache_save_period_in_seconds, typedOther.key_cache_save_period_in_seconds);
|
||||
if (isSetKey_cache_save_period_in_seconds()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.key_cache_save_period_in_seconds, typedOther.key_cache_save_period_in_seconds);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1660,7 +1706,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMemtable_flush_after_mins()) { lastComparison = TBaseHelper.compareTo(this.memtable_flush_after_mins, typedOther.memtable_flush_after_mins);
|
||||
if (isSetMemtable_flush_after_mins()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.memtable_flush_after_mins, typedOther.memtable_flush_after_mins);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1669,7 +1716,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMemtable_throughput_in_mb()) { lastComparison = TBaseHelper.compareTo(this.memtable_throughput_in_mb, typedOther.memtable_throughput_in_mb);
|
||||
if (isSetMemtable_throughput_in_mb()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.memtable_throughput_in_mb, typedOther.memtable_throughput_in_mb);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1678,7 +1726,8 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMemtable_operations_in_millions()) { lastComparison = TBaseHelper.compareTo(this.memtable_operations_in_millions, typedOther.memtable_operations_in_millions);
|
||||
if (isSetMemtable_operations_in_millions()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.memtable_operations_in_millions, typedOther.memtable_operations_in_millions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -1686,6 +1735,10 @@ public class CfDef implements TBase<CfDef, CfDef._Fields>, java.io.Serializable,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -62,8 +63,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)3);
|
||||
private static final TField TTL_FIELD_DESC = new TField("ttl", TType.I32, (short)4);
|
||||
|
||||
public byte[] name;
|
||||
public byte[] value;
|
||||
public ByteBuffer name;
|
||||
public ByteBuffer value;
|
||||
public long timestamp;
|
||||
public int ttl;
|
||||
|
||||
|
|
@ -158,8 +159,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
}
|
||||
|
||||
public Column(
|
||||
byte[] name,
|
||||
byte[] value,
|
||||
ByteBuffer name,
|
||||
ByteBuffer value,
|
||||
long timestamp)
|
||||
{
|
||||
this();
|
||||
|
|
@ -176,12 +177,12 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
__isset_bit_vector.clear();
|
||||
__isset_bit_vector.or(other.__isset_bit_vector);
|
||||
if (other.isSetName()) {
|
||||
this.name = new byte[other.name.length];
|
||||
System.arraycopy(other.name, 0, name, 0, other.name.length);
|
||||
this.name = TBaseHelper.copyBinary(other.name);
|
||||
;
|
||||
}
|
||||
if (other.isSetValue()) {
|
||||
this.value = new byte[other.value.length];
|
||||
System.arraycopy(other.value, 0, value, 0, other.value.length);
|
||||
this.value = TBaseHelper.copyBinary(other.value);
|
||||
;
|
||||
}
|
||||
this.timestamp = other.timestamp;
|
||||
this.ttl = other.ttl;
|
||||
|
|
@ -191,16 +192,31 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
return new Column(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Column clone() {
|
||||
return new Column(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.value = null;
|
||||
setTimestampIsSet(false);
|
||||
this.timestamp = 0;
|
||||
setTtlIsSet(false);
|
||||
this.ttl = 0;
|
||||
}
|
||||
|
||||
public byte[] getName() {
|
||||
return this.name;
|
||||
setName(TBaseHelper.rightSize(name));
|
||||
return name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Column setName(byte[] name) {
|
||||
setName(ByteBuffer.wrap(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Column setName(ByteBuffer name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -221,10 +237,20 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
}
|
||||
|
||||
public byte[] getValue() {
|
||||
return this.value;
|
||||
setValue(TBaseHelper.rightSize(value));
|
||||
return value.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Column setValue(byte[] value) {
|
||||
setValue(ByteBuffer.wrap(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Column setValue(ByteBuffer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -296,7 +322,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((byte[])value);
|
||||
setName((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -304,7 +330,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((byte[])value);
|
||||
setValue((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -327,10 +353,6 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
|
|
@ -349,12 +371,12 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
|
|
@ -368,10 +390,6 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -390,7 +408,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.name, that.name))
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -399,7 +417,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.value, that.value))
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +481,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -472,7 +491,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetValue()) { lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (isSetValue()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -481,7 +501,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimestamp()) { lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
if (isSetTimestamp()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -490,7 +511,8 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTtl()) { lastComparison = TBaseHelper.compareTo(this.ttl, typedOther.ttl);
|
||||
if (isSetTtl()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.ttl, typedOther.ttl);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -498,6 +520,10 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -587,12 +613,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (this.name == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __name_size = Math.min(this.name.length, 128);
|
||||
for (int i = 0; i < __name_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
|
||||
}
|
||||
if (this.name.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.name, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
@ -600,12 +621,7 @@ public class Column implements TBase<Column, Column._Fields>, java.io.Serializab
|
|||
if (this.value == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __value_size = Math.min(this.value.length, 128);
|
||||
for (int i = 0; i < __value_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
|
||||
}
|
||||
if (this.value.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.value, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -55,7 +56,7 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
private static final TField INDEX_TYPE_FIELD_DESC = new TField("index_type", TType.I32, (short)3);
|
||||
private static final TField INDEX_NAME_FIELD_DESC = new TField("index_name", TType.STRING, (short)4);
|
||||
|
||||
public byte[] name;
|
||||
public ByteBuffer name;
|
||||
public String validation_class;
|
||||
/**
|
||||
*
|
||||
|
|
@ -156,7 +157,7 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
}
|
||||
|
||||
public ColumnDef(
|
||||
byte[] name,
|
||||
ByteBuffer name,
|
||||
String validation_class)
|
||||
{
|
||||
this();
|
||||
|
|
@ -169,8 +170,8 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
*/
|
||||
public ColumnDef(ColumnDef other) {
|
||||
if (other.isSetName()) {
|
||||
this.name = new byte[other.name.length];
|
||||
System.arraycopy(other.name, 0, name, 0, other.name.length);
|
||||
this.name = TBaseHelper.copyBinary(other.name);
|
||||
;
|
||||
}
|
||||
if (other.isSetValidation_class()) {
|
||||
this.validation_class = other.validation_class;
|
||||
|
|
@ -187,16 +188,29 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
return new ColumnDef(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ColumnDef clone() {
|
||||
return new ColumnDef(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.validation_class = null;
|
||||
this.index_type = null;
|
||||
this.index_name = null;
|
||||
}
|
||||
|
||||
public byte[] getName() {
|
||||
return this.name;
|
||||
setName(TBaseHelper.rightSize(name));
|
||||
return name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ColumnDef setName(byte[] name) {
|
||||
setName(ByteBuffer.wrap(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnDef setName(ByteBuffer name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -302,7 +316,7 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((byte[])value);
|
||||
setName((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -333,10 +347,6 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
|
|
@ -355,12 +365,12 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
|
|
@ -374,10 +384,6 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -396,7 +402,7 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.name, that.name))
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -469,7 +475,8 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -478,7 +485,8 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetValidation_class()) { lastComparison = TBaseHelper.compareTo(this.validation_class, typedOther.validation_class);
|
||||
if (isSetValidation_class()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.validation_class, typedOther.validation_class);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -487,7 +495,8 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetIndex_type()) { lastComparison = TBaseHelper.compareTo(this.index_type, typedOther.index_type);
|
||||
if (isSetIndex_type()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.index_type, typedOther.index_type);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -496,7 +505,8 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetIndex_name()) { lastComparison = TBaseHelper.compareTo(this.index_name, typedOther.index_name);
|
||||
if (isSetIndex_name()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.index_name, typedOther.index_name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -504,6 +514,10 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -594,12 +608,7 @@ public class ColumnDef implements TBase<ColumnDef, ColumnDef._Fields>, java.io.S
|
|||
if (this.name == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __name_size = Math.min(this.name.length, 128);
|
||||
for (int i = 0; i < __name_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
|
||||
}
|
||||
if (this.name.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.name, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -159,9 +160,10 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
return new ColumnOrSuperColumn(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ColumnOrSuperColumn clone() {
|
||||
return new ColumnOrSuperColumn(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column = null;
|
||||
this.super_column = null;
|
||||
}
|
||||
|
||||
public Column getColumn() {
|
||||
|
|
@ -233,10 +235,6 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN:
|
||||
|
|
@ -249,12 +247,12 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN:
|
||||
return isSetColumn();
|
||||
|
|
@ -264,10 +262,6 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -331,7 +325,8 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn()) { lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
|
||||
if (isSetColumn()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -340,7 +335,8 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (isSetSuper_column()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -348,6 +344,10 @@ public class ColumnOrSuperColumn implements TBase<ColumnOrSuperColumn, ColumnOrS
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -60,7 +61,7 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
private static final TField SUPER_COLUMN_FIELD_DESC = new TField("super_column", TType.STRING, (short)4);
|
||||
|
||||
public String column_family;
|
||||
public byte[] super_column;
|
||||
public ByteBuffer super_column;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
|
|
@ -154,8 +155,8 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
this.column_family = other.column_family;
|
||||
}
|
||||
if (other.isSetSuper_column()) {
|
||||
this.super_column = new byte[other.super_column.length];
|
||||
System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
|
||||
this.super_column = TBaseHelper.copyBinary(other.super_column);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,9 +164,10 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
return new ColumnParent(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ColumnParent clone() {
|
||||
return new ColumnParent(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column_family = null;
|
||||
this.super_column = null;
|
||||
}
|
||||
|
||||
public String getColumn_family() {
|
||||
|
|
@ -193,10 +195,20 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
}
|
||||
|
||||
public byte[] getSuper_column() {
|
||||
return this.super_column;
|
||||
setSuper_column(TBaseHelper.rightSize(super_column));
|
||||
return super_column.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForSuper_column() {
|
||||
return super_column;
|
||||
}
|
||||
|
||||
public ColumnParent setSuper_column(byte[] super_column) {
|
||||
setSuper_column(ByteBuffer.wrap(super_column));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnParent setSuper_column(ByteBuffer super_column) {
|
||||
this.super_column = super_column;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -230,17 +242,13 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
if (value == null) {
|
||||
unsetSuper_column();
|
||||
} else {
|
||||
setSuper_column((byte[])value);
|
||||
setSuper_column((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN_FAMILY:
|
||||
|
|
@ -253,12 +261,12 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN_FAMILY:
|
||||
return isSetColumn_family();
|
||||
|
|
@ -268,10 +276,6 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -299,7 +303,7 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
if (this_present_super_column || that_present_super_column) {
|
||||
if (!(this_present_super_column && that_present_super_column))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.super_column, that.super_column))
|
||||
if (!this.super_column.equals(that.super_column))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +339,8 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_family()) { lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
|
||||
if (isSetColumn_family()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -344,7 +349,8 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (isSetSuper_column()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -352,6 +358,10 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -425,12 +435,7 @@ public class ColumnParent implements TBase<ColumnParent, ColumnParent._Fields>,
|
|||
if (this.super_column == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __super_column_size = Math.min(this.super_column.length, 128);
|
||||
for (int i = 0; i < __super_column_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
|
||||
}
|
||||
if (this.super_column.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.super_column, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -65,8 +66,8 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRING, (short)5);
|
||||
|
||||
public String column_family;
|
||||
public byte[] super_column;
|
||||
public byte[] column;
|
||||
public ByteBuffer super_column;
|
||||
public ByteBuffer column;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
|
|
@ -165,12 +166,12 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
this.column_family = other.column_family;
|
||||
}
|
||||
if (other.isSetSuper_column()) {
|
||||
this.super_column = new byte[other.super_column.length];
|
||||
System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
|
||||
this.super_column = TBaseHelper.copyBinary(other.super_column);
|
||||
;
|
||||
}
|
||||
if (other.isSetColumn()) {
|
||||
this.column = new byte[other.column.length];
|
||||
System.arraycopy(other.column, 0, column, 0, other.column.length);
|
||||
this.column = TBaseHelper.copyBinary(other.column);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,9 +179,11 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
return new ColumnPath(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ColumnPath clone() {
|
||||
return new ColumnPath(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column_family = null;
|
||||
this.super_column = null;
|
||||
this.column = null;
|
||||
}
|
||||
|
||||
public String getColumn_family() {
|
||||
|
|
@ -208,10 +211,20 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
}
|
||||
|
||||
public byte[] getSuper_column() {
|
||||
return this.super_column;
|
||||
setSuper_column(TBaseHelper.rightSize(super_column));
|
||||
return super_column.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForSuper_column() {
|
||||
return super_column;
|
||||
}
|
||||
|
||||
public ColumnPath setSuper_column(byte[] super_column) {
|
||||
setSuper_column(ByteBuffer.wrap(super_column));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnPath setSuper_column(ByteBuffer super_column) {
|
||||
this.super_column = super_column;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -232,10 +245,20 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
}
|
||||
|
||||
public byte[] getColumn() {
|
||||
return this.column;
|
||||
setColumn(TBaseHelper.rightSize(column));
|
||||
return column.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public ColumnPath setColumn(byte[] column) {
|
||||
setColumn(ByteBuffer.wrap(column));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnPath setColumn(ByteBuffer column) {
|
||||
this.column = column;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -269,7 +292,7 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (value == null) {
|
||||
unsetSuper_column();
|
||||
} else {
|
||||
setSuper_column((byte[])value);
|
||||
setSuper_column((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -277,17 +300,13 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (value == null) {
|
||||
unsetColumn();
|
||||
} else {
|
||||
setColumn((byte[])value);
|
||||
setColumn((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN_FAMILY:
|
||||
|
|
@ -303,12 +322,12 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN_FAMILY:
|
||||
return isSetColumn_family();
|
||||
|
|
@ -320,10 +339,6 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -351,7 +366,7 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (this_present_super_column || that_present_super_column) {
|
||||
if (!(this_present_super_column && that_present_super_column))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.super_column, that.super_column))
|
||||
if (!this.super_column.equals(that.super_column))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -360,7 +375,7 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (this_present_column || that_present_column) {
|
||||
if (!(this_present_column && that_present_column))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.column, that.column))
|
||||
if (!this.column.equals(that.column))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +416,8 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_family()) { lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
|
||||
if (isSetColumn_family()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -410,7 +426,8 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (isSetSuper_column()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -419,7 +436,8 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn()) { lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
|
||||
if (isSetColumn()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -427,6 +445,10 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -514,12 +536,7 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (this.super_column == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __super_column_size = Math.min(this.super_column.length, 128);
|
||||
for (int i = 0; i < __super_column_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
|
||||
}
|
||||
if (this.super_column.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.super_column, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
@ -529,12 +546,7 @@ public class ColumnPath implements TBase<ColumnPath, ColumnPath._Fields>, java.i
|
|||
if (this.column == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __column_size = Math.min(this.column.length, 128);
|
||||
for (int i = 0; i < __column_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
|
||||
}
|
||||
if (this.column.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.column, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -55,7 +56,7 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
private static final TField PREDICATE_FIELD_DESC = new TField("predicate", TType.STRUCT, (short)3);
|
||||
|
||||
public long timestamp;
|
||||
public byte[] super_column;
|
||||
public ByteBuffer super_column;
|
||||
public SlicePredicate predicate;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -158,8 +159,8 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
__isset_bit_vector.or(other.__isset_bit_vector);
|
||||
this.timestamp = other.timestamp;
|
||||
if (other.isSetSuper_column()) {
|
||||
this.super_column = new byte[other.super_column.length];
|
||||
System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
|
||||
this.super_column = TBaseHelper.copyBinary(other.super_column);
|
||||
;
|
||||
}
|
||||
if (other.isSetPredicate()) {
|
||||
this.predicate = new SlicePredicate(other.predicate);
|
||||
|
|
@ -170,9 +171,12 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
return new Deletion(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Deletion clone() {
|
||||
return new Deletion(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
setTimestampIsSet(false);
|
||||
this.timestamp = 0;
|
||||
this.super_column = null;
|
||||
this.predicate = null;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
|
|
@ -199,10 +203,20 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
}
|
||||
|
||||
public byte[] getSuper_column() {
|
||||
return this.super_column;
|
||||
setSuper_column(TBaseHelper.rightSize(super_column));
|
||||
return super_column.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForSuper_column() {
|
||||
return super_column;
|
||||
}
|
||||
|
||||
public Deletion setSuper_column(byte[] super_column) {
|
||||
setSuper_column(ByteBuffer.wrap(super_column));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Deletion setSuper_column(ByteBuffer super_column) {
|
||||
this.super_column = super_column;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -260,7 +274,7 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (value == null) {
|
||||
unsetSuper_column();
|
||||
} else {
|
||||
setSuper_column((byte[])value);
|
||||
setSuper_column((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -275,10 +289,6 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case TIMESTAMP:
|
||||
|
|
@ -294,12 +304,12 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case TIMESTAMP:
|
||||
return isSetTimestamp();
|
||||
|
|
@ -311,10 +321,6 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -342,7 +348,7 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (this_present_super_column || that_present_super_column) {
|
||||
if (!(this_present_super_column && that_present_super_column))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.super_column, that.super_column))
|
||||
if (!this.super_column.equals(that.super_column))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -392,7 +398,8 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimestamp()) { lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
if (isSetTimestamp()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -401,7 +408,8 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (isSetSuper_column()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -410,7 +418,8 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetPredicate()) { lastComparison = TBaseHelper.compareTo(this.predicate, typedOther.predicate);
|
||||
if (isSetPredicate()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.predicate, typedOther.predicate);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -418,6 +427,10 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -504,12 +517,7 @@ public class Deletion implements TBase<Deletion, Deletion._Fields>, java.io.Seri
|
|||
if (this.super_column == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __super_column_size = Math.min(this.super_column.length, 128);
|
||||
for (int i = 0; i < __super_column_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
|
||||
}
|
||||
if (this.super_column.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.super_column, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -55,7 +56,7 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)3);
|
||||
|
||||
public List<IndexExpression> expressions;
|
||||
public byte[] start_key;
|
||||
public ByteBuffer start_key;
|
||||
public int count;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -147,7 +148,7 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
|
||||
public IndexClause(
|
||||
List<IndexExpression> expressions,
|
||||
byte[] start_key,
|
||||
ByteBuffer start_key,
|
||||
int count)
|
||||
{
|
||||
this();
|
||||
|
|
@ -171,8 +172,8 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
this.expressions = __this__expressions;
|
||||
}
|
||||
if (other.isSetStart_key()) {
|
||||
this.start_key = new byte[other.start_key.length];
|
||||
System.arraycopy(other.start_key, 0, start_key, 0, other.start_key.length);
|
||||
this.start_key = TBaseHelper.copyBinary(other.start_key);
|
||||
;
|
||||
}
|
||||
this.count = other.count;
|
||||
}
|
||||
|
|
@ -181,9 +182,12 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
return new IndexClause(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IndexClause clone() {
|
||||
return new IndexClause(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.expressions = null;
|
||||
this.start_key = null;
|
||||
this.count = 100;
|
||||
|
||||
}
|
||||
|
||||
public int getExpressionsSize() {
|
||||
|
|
@ -226,10 +230,20 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
}
|
||||
|
||||
public byte[] getStart_key() {
|
||||
return this.start_key;
|
||||
setStart_key(TBaseHelper.rightSize(start_key));
|
||||
return start_key.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForStart_key() {
|
||||
return start_key;
|
||||
}
|
||||
|
||||
public IndexClause setStart_key(byte[] start_key) {
|
||||
setStart_key(ByteBuffer.wrap(start_key));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndexClause setStart_key(ByteBuffer start_key) {
|
||||
this.start_key = start_key;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -286,7 +300,7 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (value == null) {
|
||||
unsetStart_key();
|
||||
} else {
|
||||
setStart_key((byte[])value);
|
||||
setStart_key((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -301,10 +315,6 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case EXPRESSIONS:
|
||||
|
|
@ -320,12 +330,12 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case EXPRESSIONS:
|
||||
return isSetExpressions();
|
||||
|
|
@ -337,10 +347,6 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -368,7 +374,7 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (this_present_start_key || that_present_start_key) {
|
||||
if (!(this_present_start_key && that_present_start_key))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.start_key, that.start_key))
|
||||
if (!this.start_key.equals(that.start_key))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +424,8 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetExpressions()) { lastComparison = TBaseHelper.compareTo(this.expressions, typedOther.expressions);
|
||||
if (isSetExpressions()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.expressions, typedOther.expressions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -427,7 +434,8 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStart_key()) { lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
|
||||
if (isSetStart_key()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -436,7 +444,8 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (isSetCount()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -444,6 +453,10 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -546,12 +559,7 @@ public class IndexClause implements TBase<IndexClause, IndexClause._Fields>, jav
|
|||
if (this.start_key == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __start_key_size = Math.min(this.start_key.length, 128);
|
||||
for (int i = 0; i < __start_key_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.start_key[i]).length() > 1 ? Integer.toHexString(this.start_key[i]).substring(Integer.toHexString(this.start_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start_key[i]).toUpperCase());
|
||||
}
|
||||
if (this.start_key.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.start_key, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -54,13 +55,13 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
private static final TField OP_FIELD_DESC = new TField("op", TType.I32, (short)2);
|
||||
private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
|
||||
|
||||
public byte[] column_name;
|
||||
public ByteBuffer column_name;
|
||||
/**
|
||||
*
|
||||
* @see IndexOperator
|
||||
*/
|
||||
public IndexOperator op;
|
||||
public byte[] value;
|
||||
public ByteBuffer value;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
|
|
@ -149,9 +150,9 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
}
|
||||
|
||||
public IndexExpression(
|
||||
byte[] column_name,
|
||||
ByteBuffer column_name,
|
||||
IndexOperator op,
|
||||
byte[] value)
|
||||
ByteBuffer value)
|
||||
{
|
||||
this();
|
||||
this.column_name = column_name;
|
||||
|
|
@ -164,15 +165,15 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
*/
|
||||
public IndexExpression(IndexExpression other) {
|
||||
if (other.isSetColumn_name()) {
|
||||
this.column_name = new byte[other.column_name.length];
|
||||
System.arraycopy(other.column_name, 0, column_name, 0, other.column_name.length);
|
||||
this.column_name = TBaseHelper.copyBinary(other.column_name);
|
||||
;
|
||||
}
|
||||
if (other.isSetOp()) {
|
||||
this.op = other.op;
|
||||
}
|
||||
if (other.isSetValue()) {
|
||||
this.value = new byte[other.value.length];
|
||||
System.arraycopy(other.value, 0, value, 0, other.value.length);
|
||||
this.value = TBaseHelper.copyBinary(other.value);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -180,16 +181,28 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
return new IndexExpression(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IndexExpression clone() {
|
||||
return new IndexExpression(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column_name = null;
|
||||
this.op = null;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public byte[] getColumn_name() {
|
||||
return this.column_name;
|
||||
setColumn_name(TBaseHelper.rightSize(column_name));
|
||||
return column_name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForColumn_name() {
|
||||
return column_name;
|
||||
}
|
||||
|
||||
public IndexExpression setColumn_name(byte[] column_name) {
|
||||
setColumn_name(ByteBuffer.wrap(column_name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndexExpression setColumn_name(ByteBuffer column_name) {
|
||||
this.column_name = column_name;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -242,10 +255,20 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
}
|
||||
|
||||
public byte[] getValue() {
|
||||
return this.value;
|
||||
setValue(TBaseHelper.rightSize(value));
|
||||
return value.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public IndexExpression setValue(byte[] value) {
|
||||
setValue(ByteBuffer.wrap(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndexExpression setValue(ByteBuffer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -271,7 +294,7 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (value == null) {
|
||||
unsetColumn_name();
|
||||
} else {
|
||||
setColumn_name((byte[])value);
|
||||
setColumn_name((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -287,17 +310,13 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((byte[])value);
|
||||
setValue((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN_NAME:
|
||||
|
|
@ -313,12 +332,12 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN_NAME:
|
||||
return isSetColumn_name();
|
||||
|
|
@ -330,10 +349,6 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -352,7 +367,7 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (this_present_column_name || that_present_column_name) {
|
||||
if (!(this_present_column_name && that_present_column_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.column_name, that.column_name))
|
||||
if (!this.column_name.equals(that.column_name))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -370,7 +385,7 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.value, that.value))
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +426,8 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_name()) { lastComparison = TBaseHelper.compareTo(this.column_name, typedOther.column_name);
|
||||
if (isSetColumn_name()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_name, typedOther.column_name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -420,7 +436,8 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetOp()) { lastComparison = TBaseHelper.compareTo(this.op, typedOther.op);
|
||||
if (isSetOp()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.op, typedOther.op);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -429,7 +446,8 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetValue()) { lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (isSetValue()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -437,6 +455,10 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -511,12 +533,7 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (this.column_name == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __column_name_size = Math.min(this.column_name.length, 128);
|
||||
for (int i = 0; i < __column_name_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.column_name[i]).length() > 1 ? Integer.toHexString(this.column_name[i]).substring(Integer.toHexString(this.column_name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column_name[i]).toUpperCase());
|
||||
}
|
||||
if (this.column_name.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.column_name, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
@ -532,12 +549,7 @@ public class IndexExpression implements TBase<IndexExpression, IndexExpression._
|
|||
if (this.value == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __value_size = Math.min(this.value.length, 128);
|
||||
for (int i = 0; i < __value_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
|
||||
}
|
||||
if (this.value.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.value, sb);
|
||||
}
|
||||
first = false;
|
||||
sb.append(")");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -150,9 +151,9 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
return new InvalidRequestException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public InvalidRequestException clone() {
|
||||
return new InvalidRequestException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.why = null;
|
||||
}
|
||||
|
||||
public String getWhy() {
|
||||
|
|
@ -192,10 +193,6 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case WHY:
|
||||
|
|
@ -205,12 +202,12 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case WHY:
|
||||
return isSetWhy();
|
||||
|
|
@ -218,10 +215,6 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -271,7 +264,8 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetWhy()) { lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (isSetWhy()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -279,6 +273,10 @@ public class InvalidRequestException extends Exception implements TBase<InvalidR
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -53,7 +54,7 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)2);
|
||||
|
||||
public byte[] key;
|
||||
public ByteBuffer key;
|
||||
public int count;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -136,7 +137,7 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
}
|
||||
|
||||
public KeyCount(
|
||||
byte[] key,
|
||||
ByteBuffer key,
|
||||
int count)
|
||||
{
|
||||
this();
|
||||
|
|
@ -152,8 +153,8 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
__isset_bit_vector.clear();
|
||||
__isset_bit_vector.or(other.__isset_bit_vector);
|
||||
if (other.isSetKey()) {
|
||||
this.key = new byte[other.key.length];
|
||||
System.arraycopy(other.key, 0, key, 0, other.key.length);
|
||||
this.key = TBaseHelper.copyBinary(other.key);
|
||||
;
|
||||
}
|
||||
this.count = other.count;
|
||||
}
|
||||
|
|
@ -162,16 +163,28 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
return new KeyCount(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public KeyCount clone() {
|
||||
return new KeyCount(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.key = null;
|
||||
setCountIsSet(false);
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public byte[] getKey() {
|
||||
return this.key;
|
||||
setKey(TBaseHelper.rightSize(key));
|
||||
return key.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public KeyCount setKey(byte[] key) {
|
||||
setKey(ByteBuffer.wrap(key));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeyCount setKey(ByteBuffer key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -220,7 +233,7 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
if (value == null) {
|
||||
unsetKey();
|
||||
} else {
|
||||
setKey((byte[])value);
|
||||
setKey((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -235,10 +248,6 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
|
|
@ -251,12 +260,12 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case KEY:
|
||||
return isSetKey();
|
||||
|
|
@ -266,10 +275,6 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -288,7 +293,7 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
if (this_present_key || that_present_key) {
|
||||
if (!(this_present_key && that_present_key))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.key, that.key))
|
||||
if (!this.key.equals(that.key))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +338,8 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey()) { lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
|
||||
if (isSetKey()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -342,7 +348,8 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (isSetCount()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -350,6 +357,10 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -414,12 +425,7 @@ public class KeyCount implements TBase<KeyCount, KeyCount._Fields>, java.io.Seri
|
|||
if (this.key == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __key_size = Math.min(this.key.length, 128);
|
||||
for (int i = 0; i < __key_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.key[i]).length() > 1 ? Integer.toHexString(this.key[i]).substring(Integer.toHexString(this.key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.key[i]).toUpperCase());
|
||||
}
|
||||
if (this.key.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.key, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -64,8 +65,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
private static final TField END_TOKEN_FIELD_DESC = new TField("end_token", TType.STRING, (short)4);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)5);
|
||||
|
||||
public byte[] start_key;
|
||||
public byte[] end_key;
|
||||
public ByteBuffer start_key;
|
||||
public ByteBuffer end_key;
|
||||
public String start_token;
|
||||
public String end_token;
|
||||
public int count;
|
||||
|
|
@ -181,12 +182,12 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
__isset_bit_vector.clear();
|
||||
__isset_bit_vector.or(other.__isset_bit_vector);
|
||||
if (other.isSetStart_key()) {
|
||||
this.start_key = new byte[other.start_key.length];
|
||||
System.arraycopy(other.start_key, 0, start_key, 0, other.start_key.length);
|
||||
this.start_key = TBaseHelper.copyBinary(other.start_key);
|
||||
;
|
||||
}
|
||||
if (other.isSetEnd_key()) {
|
||||
this.end_key = new byte[other.end_key.length];
|
||||
System.arraycopy(other.end_key, 0, end_key, 0, other.end_key.length);
|
||||
this.end_key = TBaseHelper.copyBinary(other.end_key);
|
||||
;
|
||||
}
|
||||
if (other.isSetStart_token()) {
|
||||
this.start_token = other.start_token;
|
||||
|
|
@ -201,16 +202,31 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
return new KeyRange(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public KeyRange clone() {
|
||||
return new KeyRange(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.start_key = null;
|
||||
this.end_key = null;
|
||||
this.start_token = null;
|
||||
this.end_token = null;
|
||||
this.count = 100;
|
||||
|
||||
}
|
||||
|
||||
public byte[] getStart_key() {
|
||||
return this.start_key;
|
||||
setStart_key(TBaseHelper.rightSize(start_key));
|
||||
return start_key.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForStart_key() {
|
||||
return start_key;
|
||||
}
|
||||
|
||||
public KeyRange setStart_key(byte[] start_key) {
|
||||
setStart_key(ByteBuffer.wrap(start_key));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeyRange setStart_key(ByteBuffer start_key) {
|
||||
this.start_key = start_key;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -231,10 +247,20 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
}
|
||||
|
||||
public byte[] getEnd_key() {
|
||||
return this.end_key;
|
||||
setEnd_key(TBaseHelper.rightSize(end_key));
|
||||
return end_key.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForEnd_key() {
|
||||
return end_key;
|
||||
}
|
||||
|
||||
public KeyRange setEnd_key(byte[] end_key) {
|
||||
setEnd_key(ByteBuffer.wrap(end_key));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeyRange setEnd_key(ByteBuffer end_key) {
|
||||
this.end_key = end_key;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -331,7 +357,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (value == null) {
|
||||
unsetStart_key();
|
||||
} else {
|
||||
setStart_key((byte[])value);
|
||||
setStart_key((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -339,7 +365,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (value == null) {
|
||||
unsetEnd_key();
|
||||
} else {
|
||||
setEnd_key((byte[])value);
|
||||
setEnd_key((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -370,10 +396,6 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case START_KEY:
|
||||
|
|
@ -395,12 +417,12 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case START_KEY:
|
||||
return isSetStart_key();
|
||||
|
|
@ -416,10 +438,6 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -438,7 +456,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (this_present_start_key || that_present_start_key) {
|
||||
if (!(this_present_start_key && that_present_start_key))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.start_key, that.start_key))
|
||||
if (!this.start_key.equals(that.start_key))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -447,7 +465,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (this_present_end_key || that_present_end_key) {
|
||||
if (!(this_present_end_key && that_present_end_key))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.end_key, that.end_key))
|
||||
if (!this.end_key.equals(that.end_key))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -525,7 +543,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStart_key()) { lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
|
||||
if (isSetStart_key()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -534,7 +553,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetEnd_key()) { lastComparison = TBaseHelper.compareTo(this.end_key, typedOther.end_key);
|
||||
if (isSetEnd_key()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.end_key, typedOther.end_key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -543,7 +563,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStart_token()) { lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
|
||||
if (isSetStart_token()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -552,7 +573,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetEnd_token()) { lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
|
||||
if (isSetEnd_token()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -561,7 +583,8 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (isSetCount()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -569,6 +592,10 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -678,12 +705,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (this.start_key == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __start_key_size = Math.min(this.start_key.length, 128);
|
||||
for (int i = 0; i < __start_key_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.start_key[i]).length() > 1 ? Integer.toHexString(this.start_key[i]).substring(Integer.toHexString(this.start_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start_key[i]).toUpperCase());
|
||||
}
|
||||
if (this.start_key.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.start_key, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
@ -693,12 +715,7 @@ public class KeyRange implements TBase<KeyRange, KeyRange._Fields>, java.io.Seri
|
|||
if (this.end_key == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __end_key_size = Math.min(this.end_key.length, 128);
|
||||
for (int i = 0; i < __end_key_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.end_key[i]).length() > 1 ? Integer.toHexString(this.end_key[i]).substring(Integer.toHexString(this.end_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.end_key[i]).toUpperCase());
|
||||
}
|
||||
if (this.end_key.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.end_key, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -60,7 +61,7 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1);
|
||||
private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
|
||||
|
||||
public byte[] key;
|
||||
public ByteBuffer key;
|
||||
public List<ColumnOrSuperColumn> columns;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -142,7 +143,7 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
}
|
||||
|
||||
public KeySlice(
|
||||
byte[] key,
|
||||
ByteBuffer key,
|
||||
List<ColumnOrSuperColumn> columns)
|
||||
{
|
||||
this();
|
||||
|
|
@ -155,8 +156,8 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
*/
|
||||
public KeySlice(KeySlice other) {
|
||||
if (other.isSetKey()) {
|
||||
this.key = new byte[other.key.length];
|
||||
System.arraycopy(other.key, 0, key, 0, other.key.length);
|
||||
this.key = TBaseHelper.copyBinary(other.key);
|
||||
;
|
||||
}
|
||||
if (other.isSetColumns()) {
|
||||
List<ColumnOrSuperColumn> __this__columns = new ArrayList<ColumnOrSuperColumn>();
|
||||
|
|
@ -171,16 +172,27 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
return new KeySlice(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public KeySlice clone() {
|
||||
return new KeySlice(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.key = null;
|
||||
this.columns = null;
|
||||
}
|
||||
|
||||
public byte[] getKey() {
|
||||
return this.key;
|
||||
setKey(TBaseHelper.rightSize(key));
|
||||
return key.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public KeySlice setKey(byte[] key) {
|
||||
setKey(ByteBuffer.wrap(key));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeySlice setKey(ByteBuffer key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -245,7 +257,7 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
if (value == null) {
|
||||
unsetKey();
|
||||
} else {
|
||||
setKey((byte[])value);
|
||||
setKey((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -260,10 +272,6 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
|
|
@ -276,12 +284,12 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case KEY:
|
||||
return isSetKey();
|
||||
|
|
@ -291,10 +299,6 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -313,7 +317,7 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
if (this_present_key || that_present_key) {
|
||||
if (!(this_present_key && that_present_key))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.key, that.key))
|
||||
if (!this.key.equals(that.key))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +362,8 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey()) { lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
|
||||
if (isSetKey()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -367,7 +372,8 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumns()) { lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
if (isSetColumns()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -375,6 +381,10 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -455,12 +465,7 @@ public class KeySlice implements TBase<KeySlice, KeySlice._Fields>, java.io.Seri
|
|||
if (this.key == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __key_size = Math.min(this.key.length, 128);
|
||||
for (int i = 0; i < __key_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.key[i]).length() > 1 ? Integer.toHexString(this.key[i]).substring(Integer.toHexString(this.key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.key[i]).toUpperCase());
|
||||
}
|
||||
if (this.key.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.key, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -214,9 +215,14 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
return new KsDef(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public KsDef clone() {
|
||||
return new KsDef(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.strategy_class = null;
|
||||
this.strategy_options = null;
|
||||
setReplication_factorIsSet(false);
|
||||
this.replication_factor = 0;
|
||||
this.cf_defs = null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
@ -409,10 +415,6 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
|
|
@ -434,12 +436,12 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
|
|
@ -455,10 +457,6 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -564,7 +562,8 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -573,7 +572,8 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStrategy_class()) { lastComparison = TBaseHelper.compareTo(this.strategy_class, typedOther.strategy_class);
|
||||
if (isSetStrategy_class()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.strategy_class, typedOther.strategy_class);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -582,7 +582,8 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStrategy_options()) { lastComparison = TBaseHelper.compareTo(this.strategy_options, typedOther.strategy_options);
|
||||
if (isSetStrategy_options()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.strategy_options, typedOther.strategy_options);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -591,7 +592,8 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetReplication_factor()) { lastComparison = TBaseHelper.compareTo(this.replication_factor, typedOther.replication_factor);
|
||||
if (isSetReplication_factor()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.replication_factor, typedOther.replication_factor);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -600,7 +602,8 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCf_defs()) { lastComparison = TBaseHelper.compareTo(this.cf_defs, typedOther.cf_defs);
|
||||
if (isSetCf_defs()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.cf_defs, typedOther.cf_defs);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -608,6 +611,10 @@ public class KsDef implements TBase<KsDef, KsDef._Fields>, java.io.Serializable,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -154,9 +155,10 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
return new Mutation(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Mutation clone() {
|
||||
return new Mutation(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column_or_supercolumn = null;
|
||||
this.deletion = null;
|
||||
}
|
||||
|
||||
public ColumnOrSuperColumn getColumn_or_supercolumn() {
|
||||
|
|
@ -228,10 +230,6 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN_OR_SUPERCOLUMN:
|
||||
|
|
@ -244,12 +242,12 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN_OR_SUPERCOLUMN:
|
||||
return isSetColumn_or_supercolumn();
|
||||
|
|
@ -259,10 +257,6 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -326,7 +320,8 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_or_supercolumn()) { lastComparison = TBaseHelper.compareTo(this.column_or_supercolumn, typedOther.column_or_supercolumn);
|
||||
if (isSetColumn_or_supercolumn()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_or_supercolumn, typedOther.column_or_supercolumn);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -335,7 +330,8 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetDeletion()) { lastComparison = TBaseHelper.compareTo(this.deletion, typedOther.deletion);
|
||||
if (isSetDeletion()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.deletion, typedOther.deletion);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -343,6 +339,10 @@ public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Seri
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -130,9 +131,8 @@ public class NotFoundException extends Exception implements TBase<NotFoundExcept
|
|||
return new NotFoundException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public NotFoundException clone() {
|
||||
return new NotFoundException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
|
|
@ -140,31 +140,23 @@ public class NotFoundException extends Exception implements TBase<NotFoundExcept
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -199,6 +191,10 @@ public class NotFoundException extends Exception implements TBase<NotFoundExcept
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -1,548 +0,0 @@
|
|||
/**
|
||||
* Autogenerated by Thrift
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
*/
|
||||
package org.apache.cassandra.thrift;
|
||||
/*
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import java.util.List;
|
||||
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.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
public class RowPredicate implements TBase<RowPredicate, RowPredicate._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("RowPredicate");
|
||||
|
||||
private static final TField KEYS_FIELD_DESC = new TField("keys", TType.LIST, (short)1);
|
||||
private static final TField KEY_RANGE_FIELD_DESC = new TField("key_range", TType.STRUCT, (short)2);
|
||||
private static final TField INDEX_CLAUSE_FIELD_DESC = new TField("index_clause", TType.STRUCT, (short)3);
|
||||
|
||||
public List<byte[]> keys;
|
||||
public KeyRange key_range;
|
||||
public IndexClause index_clause;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
KEYS((short)1, "keys"),
|
||||
KEY_RANGE((short)2, "key_range"),
|
||||
INDEX_CLAUSE((short)3, "index_clause");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
switch(fieldId) {
|
||||
case 1: // KEYS
|
||||
return KEYS;
|
||||
case 2: // KEY_RANGE
|
||||
return KEY_RANGE;
|
||||
case 3: // INDEX_CLAUSE
|
||||
return INDEX_CLAUSE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, throwing an exception
|
||||
* if it is not found.
|
||||
*/
|
||||
public static _Fields findByThriftIdOrThrow(int fieldId) {
|
||||
_Fields fields = findByThriftId(fieldId);
|
||||
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches name, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByName(String name) {
|
||||
return byName.get(name);
|
||||
}
|
||||
|
||||
private final short _thriftId;
|
||||
private final String _fieldName;
|
||||
|
||||
_Fields(short thriftId, String fieldName) {
|
||||
_thriftId = thriftId;
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public short getThriftFieldId() {
|
||||
return _thriftId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return _fieldName;
|
||||
}
|
||||
}
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.KEYS, new FieldMetaData("keys", TFieldRequirementType.OPTIONAL,
|
||||
new ListMetaData(TType.LIST,
|
||||
new FieldValueMetaData(TType.STRING))));
|
||||
tmpMap.put(_Fields.KEY_RANGE, new FieldMetaData("key_range", TFieldRequirementType.OPTIONAL,
|
||||
new StructMetaData(TType.STRUCT, KeyRange.class)));
|
||||
tmpMap.put(_Fields.INDEX_CLAUSE, new FieldMetaData("index_clause", TFieldRequirementType.OPTIONAL,
|
||||
new StructMetaData(TType.STRUCT, IndexClause.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(RowPredicate.class, metaDataMap);
|
||||
}
|
||||
|
||||
public RowPredicate() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public RowPredicate(RowPredicate other) {
|
||||
if (other.isSetKeys()) {
|
||||
List<byte[]> __this__keys = new ArrayList<byte[]>();
|
||||
for (byte[] other_element : other.keys) {
|
||||
byte[] temp_binary_element = new byte[other_element.length];
|
||||
System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
|
||||
__this__keys.add(temp_binary_element);
|
||||
}
|
||||
this.keys = __this__keys;
|
||||
}
|
||||
if (other.isSetKey_range()) {
|
||||
this.key_range = new KeyRange(other.key_range);
|
||||
}
|
||||
if (other.isSetIndex_clause()) {
|
||||
this.index_clause = new IndexClause(other.index_clause);
|
||||
}
|
||||
}
|
||||
|
||||
public RowPredicate deepCopy() {
|
||||
return new RowPredicate(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public RowPredicate clone() {
|
||||
return new RowPredicate(this);
|
||||
}
|
||||
|
||||
public int getKeysSize() {
|
||||
return (this.keys == null) ? 0 : this.keys.size();
|
||||
}
|
||||
|
||||
public java.util.Iterator<byte[]> getKeysIterator() {
|
||||
return (this.keys == null) ? null : this.keys.iterator();
|
||||
}
|
||||
|
||||
public void addToKeys(byte[] elem) {
|
||||
if (this.keys == null) {
|
||||
this.keys = new ArrayList<byte[]>();
|
||||
}
|
||||
this.keys.add(elem);
|
||||
}
|
||||
|
||||
public List<byte[]> getKeys() {
|
||||
return this.keys;
|
||||
}
|
||||
|
||||
public RowPredicate setKeys(List<byte[]> keys) {
|
||||
this.keys = keys;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetKeys() {
|
||||
this.keys = null;
|
||||
}
|
||||
|
||||
/** Returns true if field keys is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSetKeys() {
|
||||
return this.keys != null;
|
||||
}
|
||||
|
||||
public void setKeysIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.keys = null;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyRange getKey_range() {
|
||||
return this.key_range;
|
||||
}
|
||||
|
||||
public RowPredicate setKey_range(KeyRange key_range) {
|
||||
this.key_range = key_range;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetKey_range() {
|
||||
this.key_range = null;
|
||||
}
|
||||
|
||||
/** Returns true if field key_range is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSetKey_range() {
|
||||
return this.key_range != null;
|
||||
}
|
||||
|
||||
public void setKey_rangeIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.key_range = null;
|
||||
}
|
||||
}
|
||||
|
||||
public IndexClause getIndex_clause() {
|
||||
return this.index_clause;
|
||||
}
|
||||
|
||||
public RowPredicate setIndex_clause(IndexClause index_clause) {
|
||||
this.index_clause = index_clause;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetIndex_clause() {
|
||||
this.index_clause = null;
|
||||
}
|
||||
|
||||
/** Returns true if field index_clause is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSetIndex_clause() {
|
||||
return this.index_clause != null;
|
||||
}
|
||||
|
||||
public void setIndex_clauseIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.index_clause = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case KEYS:
|
||||
if (value == null) {
|
||||
unsetKeys();
|
||||
} else {
|
||||
setKeys((List<byte[]>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_RANGE:
|
||||
if (value == null) {
|
||||
unsetKey_range();
|
||||
} else {
|
||||
setKey_range((KeyRange)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case INDEX_CLAUSE:
|
||||
if (value == null) {
|
||||
unsetIndex_clause();
|
||||
} else {
|
||||
setIndex_clause((IndexClause)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEYS:
|
||||
return getKeys();
|
||||
|
||||
case KEY_RANGE:
|
||||
return getKey_range();
|
||||
|
||||
case INDEX_CLAUSE:
|
||||
return getIndex_clause();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
switch (field) {
|
||||
case KEYS:
|
||||
return isSetKeys();
|
||||
case KEY_RANGE:
|
||||
return isSetKey_range();
|
||||
case INDEX_CLAUSE:
|
||||
return isSetIndex_clause();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof RowPredicate)
|
||||
return this.equals((RowPredicate)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(RowPredicate that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
|
||||
boolean this_present_keys = true && this.isSetKeys();
|
||||
boolean that_present_keys = true && that.isSetKeys();
|
||||
if (this_present_keys || that_present_keys) {
|
||||
if (!(this_present_keys && that_present_keys))
|
||||
return false;
|
||||
if (!this.keys.equals(that.keys))
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_key_range = true && this.isSetKey_range();
|
||||
boolean that_present_key_range = true && that.isSetKey_range();
|
||||
if (this_present_key_range || that_present_key_range) {
|
||||
if (!(this_present_key_range && that_present_key_range))
|
||||
return false;
|
||||
if (!this.key_range.equals(that.key_range))
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_index_clause = true && this.isSetIndex_clause();
|
||||
boolean that_present_index_clause = true && that.isSetIndex_clause();
|
||||
if (this_present_index_clause || that_present_index_clause) {
|
||||
if (!(this_present_index_clause && that_present_index_clause))
|
||||
return false;
|
||||
if (!this.index_clause.equals(that.index_clause))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(RowPredicate other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
RowPredicate typedOther = (RowPredicate)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetKeys()).compareTo(typedOther.isSetKeys());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKeys()) { lastComparison = TBaseHelper.compareTo(this.keys, typedOther.keys);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetKey_range()).compareTo(typedOther.isSetKey_range());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey_range()) { lastComparison = TBaseHelper.compareTo(this.key_range, typedOther.key_range);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetIndex_clause()).compareTo(typedOther.isSetIndex_clause());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetIndex_clause()) { lastComparison = TBaseHelper.compareTo(this.index_clause, typedOther.index_clause);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
while (true)
|
||||
{
|
||||
field = iprot.readFieldBegin();
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
switch (field.id) {
|
||||
case 1: // KEYS
|
||||
if (field.type == TType.LIST) {
|
||||
{
|
||||
TList _list12 = iprot.readListBegin();
|
||||
this.keys = new ArrayList<byte[]>(_list12.size);
|
||||
for (int _i13 = 0; _i13 < _list12.size; ++_i13)
|
||||
{
|
||||
byte[] _elem14;
|
||||
_elem14 = iprot.readBinary();
|
||||
this.keys.add(_elem14);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // KEY_RANGE
|
||||
if (field.type == TType.STRUCT) {
|
||||
this.key_range = new KeyRange();
|
||||
this.key_range.read(iprot);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 3: // INDEX_CLAUSE
|
||||
if (field.type == TType.STRUCT) {
|
||||
this.index_clause = new IndexClause();
|
||||
this.index_clause.read(iprot);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
// check for required fields of primitive type, which can't be checked in the validate method
|
||||
validate();
|
||||
}
|
||||
|
||||
public void write(TProtocol oprot) throws TException {
|
||||
validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (this.keys != null) {
|
||||
if (isSetKeys()) {
|
||||
oprot.writeFieldBegin(KEYS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new TList(TType.STRING, this.keys.size()));
|
||||
for (byte[] _iter15 : this.keys)
|
||||
{
|
||||
oprot.writeBinary(_iter15);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (this.key_range != null) {
|
||||
if (isSetKey_range()) {
|
||||
oprot.writeFieldBegin(KEY_RANGE_FIELD_DESC);
|
||||
this.key_range.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (this.index_clause != null) {
|
||||
if (isSetIndex_clause()) {
|
||||
oprot.writeFieldBegin(INDEX_CLAUSE_FIELD_DESC);
|
||||
this.index_clause.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("RowPredicate(");
|
||||
boolean first = true;
|
||||
|
||||
if (isSetKeys()) {
|
||||
sb.append("keys:");
|
||||
if (this.keys == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.keys);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetKey_range()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("key_range:");
|
||||
if (this.key_range == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.key_range);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetIndex_clause()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("index_clause:");
|
||||
if (this.index_clause == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.index_clause);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void validate() throws TException {
|
||||
// check for required fields
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -65,7 +66,7 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
private static final TField COLUMN_NAMES_FIELD_DESC = new TField("column_names", TType.LIST, (short)1);
|
||||
private static final TField SLICE_RANGE_FIELD_DESC = new TField("slice_range", TType.STRUCT, (short)2);
|
||||
|
||||
public List<byte[]> column_names;
|
||||
public List<ByteBuffer> column_names;
|
||||
public SliceRange slice_range;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -151,10 +152,10 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
*/
|
||||
public SlicePredicate(SlicePredicate other) {
|
||||
if (other.isSetColumn_names()) {
|
||||
List<byte[]> __this__column_names = new ArrayList<byte[]>();
|
||||
for (byte[] other_element : other.column_names) {
|
||||
byte[] temp_binary_element = new byte[other_element.length];
|
||||
System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
|
||||
List<ByteBuffer> __this__column_names = new ArrayList<ByteBuffer>();
|
||||
for (ByteBuffer other_element : other.column_names) {
|
||||
ByteBuffer temp_binary_element = TBaseHelper.copyBinary(other_element);
|
||||
;
|
||||
__this__column_names.add(temp_binary_element);
|
||||
}
|
||||
this.column_names = __this__column_names;
|
||||
|
|
@ -168,31 +169,32 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
return new SlicePredicate(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public SlicePredicate clone() {
|
||||
return new SlicePredicate(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.column_names = null;
|
||||
this.slice_range = null;
|
||||
}
|
||||
|
||||
public int getColumn_namesSize() {
|
||||
return (this.column_names == null) ? 0 : this.column_names.size();
|
||||
}
|
||||
|
||||
public java.util.Iterator<byte[]> getColumn_namesIterator() {
|
||||
public java.util.Iterator<ByteBuffer> getColumn_namesIterator() {
|
||||
return (this.column_names == null) ? null : this.column_names.iterator();
|
||||
}
|
||||
|
||||
public void addToColumn_names(byte[] elem) {
|
||||
public void addToColumn_names(ByteBuffer elem) {
|
||||
if (this.column_names == null) {
|
||||
this.column_names = new ArrayList<byte[]>();
|
||||
this.column_names = new ArrayList<ByteBuffer>();
|
||||
}
|
||||
this.column_names.add(elem);
|
||||
}
|
||||
|
||||
public List<byte[]> getColumn_names() {
|
||||
public List<ByteBuffer> getColumn_names() {
|
||||
return this.column_names;
|
||||
}
|
||||
|
||||
public SlicePredicate setColumn_names(List<byte[]> column_names) {
|
||||
public SlicePredicate setColumn_names(List<ByteBuffer> column_names) {
|
||||
this.column_names = column_names;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -242,7 +244,7 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
if (value == null) {
|
||||
unsetColumn_names();
|
||||
} else {
|
||||
setColumn_names((List<byte[]>)value);
|
||||
setColumn_names((List<ByteBuffer>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -257,10 +259,6 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case COLUMN_NAMES:
|
||||
|
|
@ -273,12 +271,12 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case COLUMN_NAMES:
|
||||
return isSetColumn_names();
|
||||
|
|
@ -288,10 +286,6 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -355,7 +349,8 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumn_names()) { lastComparison = TBaseHelper.compareTo(this.column_names, typedOther.column_names);
|
||||
if (isSetColumn_names()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column_names, typedOther.column_names);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -364,7 +359,8 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSlice_range()) { lastComparison = TBaseHelper.compareTo(this.slice_range, typedOther.slice_range);
|
||||
if (isSetSlice_range()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.slice_range, typedOther.slice_range);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -372,6 +368,10 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -386,10 +386,10 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
if (field.type == TType.LIST) {
|
||||
{
|
||||
TList _list4 = iprot.readListBegin();
|
||||
this.column_names = new ArrayList<byte[]>(_list4.size);
|
||||
this.column_names = new ArrayList<ByteBuffer>(_list4.size);
|
||||
for (int _i5 = 0; _i5 < _list4.size; ++_i5)
|
||||
{
|
||||
byte[] _elem6;
|
||||
ByteBuffer _elem6;
|
||||
_elem6 = iprot.readBinary();
|
||||
this.column_names.add(_elem6);
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ public class SlicePredicate implements TBase<SlicePredicate, SlicePredicate._Fie
|
|||
oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new TList(TType.STRING, this.column_names.size()));
|
||||
for (byte[] _iter7 : this.column_names)
|
||||
for (ByteBuffer _iter7 : this.column_names)
|
||||
{
|
||||
oprot.writeBinary(_iter7);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -71,8 +72,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
private static final TField REVERSED_FIELD_DESC = new TField("reversed", TType.BOOL, (short)3);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)4);
|
||||
|
||||
public byte[] start;
|
||||
public byte[] finish;
|
||||
public ByteBuffer start;
|
||||
public ByteBuffer finish;
|
||||
public boolean reversed;
|
||||
public int count;
|
||||
|
||||
|
|
@ -171,8 +172,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
}
|
||||
|
||||
public SliceRange(
|
||||
byte[] start,
|
||||
byte[] finish,
|
||||
ByteBuffer start,
|
||||
ByteBuffer finish,
|
||||
boolean reversed,
|
||||
int count)
|
||||
{
|
||||
|
|
@ -192,12 +193,12 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
__isset_bit_vector.clear();
|
||||
__isset_bit_vector.or(other.__isset_bit_vector);
|
||||
if (other.isSetStart()) {
|
||||
this.start = new byte[other.start.length];
|
||||
System.arraycopy(other.start, 0, start, 0, other.start.length);
|
||||
this.start = TBaseHelper.copyBinary(other.start);
|
||||
;
|
||||
}
|
||||
if (other.isSetFinish()) {
|
||||
this.finish = new byte[other.finish.length];
|
||||
System.arraycopy(other.finish, 0, finish, 0, other.finish.length);
|
||||
this.finish = TBaseHelper.copyBinary(other.finish);
|
||||
;
|
||||
}
|
||||
this.reversed = other.reversed;
|
||||
this.count = other.count;
|
||||
|
|
@ -207,16 +208,31 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
return new SliceRange(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public SliceRange clone() {
|
||||
return new SliceRange(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.start = null;
|
||||
this.finish = null;
|
||||
this.reversed = false;
|
||||
|
||||
this.count = 100;
|
||||
|
||||
}
|
||||
|
||||
public byte[] getStart() {
|
||||
return this.start;
|
||||
setStart(TBaseHelper.rightSize(start));
|
||||
return start.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public SliceRange setStart(byte[] start) {
|
||||
setStart(ByteBuffer.wrap(start));
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceRange setStart(ByteBuffer start) {
|
||||
this.start = start;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -237,10 +253,20 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
}
|
||||
|
||||
public byte[] getFinish() {
|
||||
return this.finish;
|
||||
setFinish(TBaseHelper.rightSize(finish));
|
||||
return finish.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForFinish() {
|
||||
return finish;
|
||||
}
|
||||
|
||||
public SliceRange setFinish(byte[] finish) {
|
||||
setFinish(ByteBuffer.wrap(finish));
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceRange setFinish(ByteBuffer finish) {
|
||||
this.finish = finish;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -312,7 +338,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (value == null) {
|
||||
unsetStart();
|
||||
} else {
|
||||
setStart((byte[])value);
|
||||
setStart((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -320,7 +346,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (value == null) {
|
||||
unsetFinish();
|
||||
} else {
|
||||
setFinish((byte[])value);
|
||||
setFinish((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -343,10 +369,6 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case START:
|
||||
|
|
@ -365,12 +387,12 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case START:
|
||||
return isSetStart();
|
||||
|
|
@ -384,10 +406,6 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -406,7 +424,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (this_present_start || that_present_start) {
|
||||
if (!(this_present_start && that_present_start))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.start, that.start))
|
||||
if (!this.start.equals(that.start))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +433,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (this_present_finish || that_present_finish) {
|
||||
if (!(this_present_finish && that_present_finish))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.finish, that.finish))
|
||||
if (!this.finish.equals(that.finish))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +497,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStart()) { lastComparison = TBaseHelper.compareTo(this.start, typedOther.start);
|
||||
if (isSetStart()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.start, typedOther.start);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -488,7 +507,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetFinish()) { lastComparison = TBaseHelper.compareTo(this.finish, typedOther.finish);
|
||||
if (isSetFinish()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.finish, typedOther.finish);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -497,7 +517,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetReversed()) { lastComparison = TBaseHelper.compareTo(this.reversed, typedOther.reversed);
|
||||
if (isSetReversed()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.reversed, typedOther.reversed);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -506,7 +527,8 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (isSetCount()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -514,6 +536,10 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -604,12 +630,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (this.start == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __start_size = Math.min(this.start.length, 128);
|
||||
for (int i = 0; i < __start_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.start[i]).length() > 1 ? Integer.toHexString(this.start[i]).substring(Integer.toHexString(this.start[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start[i]).toUpperCase());
|
||||
}
|
||||
if (this.start.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.start, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
@ -617,12 +638,7 @@ public class SliceRange implements TBase<SliceRange, SliceRange._Fields>, java.i
|
|||
if (this.finish == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __finish_size = Math.min(this.finish.length, 128);
|
||||
for (int i = 0; i < __finish_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.finish[i]).length() > 1 ? Integer.toHexString(this.finish[i]).substring(Integer.toHexString(this.finish[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.finish[i]).toUpperCase());
|
||||
}
|
||||
if (this.finish.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.finish, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -59,7 +60,7 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
|
||||
private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
|
||||
|
||||
public byte[] name;
|
||||
public ByteBuffer name;
|
||||
public List<Column> columns;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
|
|
@ -141,7 +142,7 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
}
|
||||
|
||||
public SuperColumn(
|
||||
byte[] name,
|
||||
ByteBuffer name,
|
||||
List<Column> columns)
|
||||
{
|
||||
this();
|
||||
|
|
@ -154,8 +155,8 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
*/
|
||||
public SuperColumn(SuperColumn other) {
|
||||
if (other.isSetName()) {
|
||||
this.name = new byte[other.name.length];
|
||||
System.arraycopy(other.name, 0, name, 0, other.name.length);
|
||||
this.name = TBaseHelper.copyBinary(other.name);
|
||||
;
|
||||
}
|
||||
if (other.isSetColumns()) {
|
||||
List<Column> __this__columns = new ArrayList<Column>();
|
||||
|
|
@ -170,16 +171,27 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
return new SuperColumn(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public SuperColumn clone() {
|
||||
return new SuperColumn(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.columns = null;
|
||||
}
|
||||
|
||||
public byte[] getName() {
|
||||
return this.name;
|
||||
setName(TBaseHelper.rightSize(name));
|
||||
return name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public SuperColumn setName(byte[] name) {
|
||||
setName(ByteBuffer.wrap(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperColumn setName(ByteBuffer name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -244,7 +256,7 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((byte[])value);
|
||||
setName((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -259,10 +271,6 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
|
|
@ -275,12 +283,12 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
|
|
@ -290,10 +298,6 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -312,7 +316,7 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.name, that.name))
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -357,7 +361,8 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -366,7 +371,8 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumns()) { lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
if (isSetColumns()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -374,6 +380,10 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
@ -454,12 +464,7 @@ public class SuperColumn implements TBase<SuperColumn, SuperColumn._Fields>, jav
|
|||
if (this.name == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
int __name_size = Math.min(this.name.length, 128);
|
||||
for (int i = 0; i < __name_size; i++) {
|
||||
if (i != 0) sb.append(" ");
|
||||
sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
|
||||
}
|
||||
if (this.name.length > 128) sb.append(" ...");
|
||||
TBaseHelper.toString(this.name, sb);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -130,9 +131,8 @@ public class TimedOutException extends Exception implements TBase<TimedOutExcept
|
|||
return new TimedOutException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TimedOutException clone() {
|
||||
return new TimedOutException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
|
|
@ -140,31 +140,23 @@ public class TimedOutException extends Exception implements TBase<TimedOutExcept
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -199,6 +191,10 @@ public class TimedOutException extends Exception implements TBase<TimedOutExcept
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -175,9 +176,11 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
return new TokenRange(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TokenRange clone() {
|
||||
return new TokenRange(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.start_token = null;
|
||||
this.end_token = null;
|
||||
this.endpoints = null;
|
||||
}
|
||||
|
||||
public String getStart_token() {
|
||||
|
|
@ -296,10 +299,6 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case START_TOKEN:
|
||||
|
|
@ -315,12 +314,12 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case START_TOKEN:
|
||||
return isSetStart_token();
|
||||
|
|
@ -332,10 +331,6 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -413,7 +408,8 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStart_token()) { lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
|
||||
if (isSetStart_token()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -422,7 +418,8 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetEnd_token()) { lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
|
||||
if (isSetEnd_token()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -431,7 +428,8 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetEndpoints()) { lastComparison = TBaseHelper.compareTo(this.endpoints, typedOther.endpoints);
|
||||
if (isSetEndpoints()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.endpoints, typedOther.endpoints);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
|
@ -439,6 +437,10 @@ public class TokenRange implements TBase<TokenRange, TokenRange._Fields>, java.i
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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;
|
||||
|
|
@ -130,9 +131,8 @@ public class UnavailableException extends Exception implements TBase<Unavailable
|
|||
return new UnavailableException(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public UnavailableException clone() {
|
||||
return new UnavailableException(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
|
|
@ -140,31 +140,23 @@ public class UnavailableException extends Exception implements TBase<Unavailable
|
|||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
|
|
@ -199,6 +191,10 @@ public class UnavailableException extends Exception implements TBase<Unavailable
|
|||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package org.apache.cassandra.auth;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
|
@ -42,7 +43,7 @@ public final class Resources
|
|||
{
|
||||
buff.append("/");
|
||||
if (component instanceof byte[])
|
||||
buff.append(FBUtilities.bytesToHex((byte[])component));
|
||||
buff.append(FBUtilities.bytesToHex(ByteBuffer.wrap((byte[])component)));
|
||||
else
|
||||
buff.append(component.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,10 +104,9 @@ public class AvroRecordFactory
|
|||
return entry;
|
||||
}
|
||||
|
||||
public static KeySlice newKeySlice(byte[] key, List<ColumnOrSuperColumn> columns) {
|
||||
public static KeySlice newKeySlice(ByteBuffer key, List<ColumnOrSuperColumn> columns) {
|
||||
KeySlice slice = new KeySlice();
|
||||
ByteBuffer wrappedKey = (key != null) ? ByteBuffer.wrap(key) : null;
|
||||
slice.key = wrappedKey;
|
||||
slice.key = key;
|
||||
slice.columns = columns;
|
||||
return slice;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,21 +48,17 @@ import static org.apache.cassandra.avro.AvroRecordFactory.newColumnPath;
|
|||
*/
|
||||
public class AvroValidation
|
||||
{
|
||||
static void validateKey(byte[] key) throws InvalidRequestException
|
||||
static void validateKey(ByteBuffer key) throws InvalidRequestException
|
||||
{
|
||||
if (key == null || key.length == 0)
|
||||
if (key == null || key.remaining() == 0)
|
||||
throw newInvalidRequestException("Key may not be empty");
|
||||
|
||||
// check that key can be handled by FBUtilities.writeShortByteArray
|
||||
if (key.length > FBUtilities.MAX_UNSIGNED_SHORT)
|
||||
throw newInvalidRequestException("Key length of " + key.length +
|
||||
if (key.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
|
||||
throw newInvalidRequestException("Key length of " + key.remaining() +
|
||||
" is longer than maximum of " + FBUtilities.MAX_UNSIGNED_SHORT);
|
||||
}
|
||||
|
||||
static void validateKey(ByteBuffer key) throws InvalidRequestException
|
||||
{
|
||||
validateKey(key.array());
|
||||
}
|
||||
|
||||
// FIXME: could use method in ThriftValidation
|
||||
static void validateKeyspace(String keyspace) throws KeyspaceNotDefinedException
|
||||
|
|
@ -90,27 +86,24 @@ public class AvroValidation
|
|||
String column_family = cp.column_family.toString();
|
||||
ColumnFamilyType cfType = validateColumnFamily(keyspace, column_family);
|
||||
|
||||
byte[] column = null, super_column = null;
|
||||
if (cp.super_column != null) super_column = cp.super_column.array();
|
||||
if (cp.column != null) column = cp.column.array();
|
||||
|
||||
|
||||
if (cfType == ColumnFamilyType.Standard)
|
||||
{
|
||||
if (super_column != null)
|
||||
if (cp.super_column != null)
|
||||
throw newInvalidRequestException("supercolumn parameter is invalid for standard CF " + column_family);
|
||||
|
||||
if (column == null)
|
||||
if (cp.column == null)
|
||||
throw newInvalidRequestException("column parameter is not optional for standard CF " + column_family);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (super_column == null)
|
||||
if (cp.super_column == null)
|
||||
throw newInvalidRequestException("supercolumn parameter is not optional for super CF " + column_family);
|
||||
}
|
||||
|
||||
if (column != null)
|
||||
validateColumns(keyspace, column_family, super_column, Arrays.asList(cp.column));
|
||||
if (super_column != null)
|
||||
if (cp.column != null)
|
||||
validateColumns(keyspace, column_family, cp.super_column, Arrays.asList(cp.column));
|
||||
if (cp.super_column != null)
|
||||
validateColumns(keyspace, column_family, null, Arrays.asList(cp.super_column));
|
||||
}
|
||||
|
||||
|
|
@ -128,14 +121,14 @@ public class AvroValidation
|
|||
}
|
||||
|
||||
// FIXME: could use method in ThriftValidation
|
||||
static void validateColumns(String keyspace, String cfName, byte[] superColumnName, Iterable<ByteBuffer> columnNames)
|
||||
static void validateColumns(String keyspace, String cfName, ByteBuffer superColumnName, Iterable<ByteBuffer> columnNames)
|
||||
throws InvalidRequestException
|
||||
{
|
||||
if (superColumnName != null)
|
||||
{
|
||||
if (superColumnName.length > IColumn.MAX_NAME_LENGTH)
|
||||
if (superColumnName.remaining() > IColumn.MAX_NAME_LENGTH)
|
||||
throw newInvalidRequestException("supercolumn name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
|
||||
if (superColumnName.length == 0)
|
||||
if (superColumnName.remaining() == 0)
|
||||
throw newInvalidRequestException("supercolumn name must not be empty");
|
||||
if (DatabaseDescriptor.getColumnFamilyType(keyspace, cfName) == ColumnFamilyType.Standard)
|
||||
throw newInvalidRequestException("supercolumn specified to ColumnFamily " + cfName + " containing normal columns");
|
||||
|
|
@ -144,16 +137,15 @@ public class AvroValidation
|
|||
AbstractType comparator = ColumnFamily.getComparatorFor(keyspace, cfName, superColumnName);
|
||||
for (ByteBuffer buff : columnNames)
|
||||
{
|
||||
byte[] name = buff.array();
|
||||
|
||||
if (name.length > IColumn.MAX_NAME_LENGTH)
|
||||
|
||||
if (buff.remaining() > IColumn.MAX_NAME_LENGTH)
|
||||
throw newInvalidRequestException("column name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
|
||||
if (name.length == 0)
|
||||
if (buff.remaining() == 0)
|
||||
throw newInvalidRequestException("column name must not be empty");
|
||||
|
||||
try
|
||||
{
|
||||
comparator.validate(name);
|
||||
comparator.validate(buff);
|
||||
}
|
||||
catch (MarshalException e)
|
||||
{
|
||||
|
|
@ -167,7 +159,7 @@ public class AvroValidation
|
|||
{
|
||||
validateColumns(keyspace,
|
||||
parent.column_family.toString(),
|
||||
parent.super_column == null ? null : parent.super_column.array(),
|
||||
parent.super_column,
|
||||
columnNames);
|
||||
}
|
||||
|
||||
|
|
@ -192,17 +184,16 @@ public class AvroValidation
|
|||
throw newInvalidRequestException("ColumnOrSuperColumn must have one or both of Column or SuperColumn");
|
||||
}
|
||||
|
||||
static void validateRange(String keyspace, String cfName, byte[] superName, SliceRange range)
|
||||
static void validateRange(String keyspace, String cfName, ByteBuffer superName, SliceRange range)
|
||||
throws InvalidRequestException
|
||||
{
|
||||
AbstractType comparator = ColumnFamily.getComparatorFor(keyspace, cfName, superName);
|
||||
byte[] start = range.start.array();
|
||||
byte[] finish = range.finish.array();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
comparator.validate(start);
|
||||
comparator.validate(finish);
|
||||
comparator.validate(range.start);
|
||||
comparator.validate(range.finish);
|
||||
}
|
||||
catch (MarshalException me)
|
||||
{
|
||||
|
|
@ -212,18 +203,17 @@ public class AvroValidation
|
|||
if (range.count < 0)
|
||||
throw newInvalidRequestException("Ranges require a non-negative count.");
|
||||
|
||||
Comparator<byte[]> orderedComparator = range.reversed ? comparator.getReverseComparator() : comparator;
|
||||
if (start.length > 0 && finish.length > 0 && orderedComparator.compare(start, finish) > 0)
|
||||
Comparator<ByteBuffer> orderedComparator = range.reversed ? comparator.getReverseComparator() : comparator;
|
||||
if (range.start.remaining() > 0 && range.finish.remaining() > 0 && orderedComparator.compare(range.start, range.finish) > 0)
|
||||
throw newInvalidRequestException("range finish must come after start in the order of traversal");
|
||||
}
|
||||
|
||||
static void validateRange(String keyspace, ColumnParent cp, SliceRange range) throws InvalidRequestException
|
||||
{
|
||||
byte[] superName = cp.super_column == null ? null : cp.super_column.array();
|
||||
validateRange(keyspace, cp.column_family.toString(), superName, range);
|
||||
validateRange(keyspace, cp.column_family.toString(), cp.super_column, range);
|
||||
}
|
||||
|
||||
static void validateSlicePredicate(String keyspace, String cfName, byte[] superName, SlicePredicate predicate)
|
||||
static void validateSlicePredicate(String keyspace, String cfName, ByteBuffer superName, SlicePredicate predicate)
|
||||
throws InvalidRequestException
|
||||
{
|
||||
if (predicate.column_names == null && predicate.slice_range == null)
|
||||
|
|
@ -244,8 +234,7 @@ public class AvroValidation
|
|||
|
||||
if (del.predicate != null)
|
||||
{
|
||||
byte[] superName = del.super_column == null ? null : del.super_column.array();
|
||||
validateSlicePredicate(keyspace, cfName, superName, del.predicate);
|
||||
validateSlicePredicate(keyspace, cfName, del.super_column, del.predicate);
|
||||
if (del.predicate.slice_range != null)
|
||||
throw newInvalidRequestException("Deletion does not yet support SliceRange predicates.");
|
||||
}
|
||||
|
|
@ -313,8 +302,8 @@ public class AvroValidation
|
|||
if (range.start_key != null)
|
||||
{
|
||||
IPartitioner p = StorageService.getPartitioner();
|
||||
Token startToken = p.getToken(range.start_key.array());
|
||||
Token endToken = p.getToken(range.end_key.array());
|
||||
Token startToken = p.getToken(range.start_key);
|
||||
Token endToken = p.getToken(range.end_key);
|
||||
if (startToken.compareTo(endToken) > 0 && !endToken.equals(p.getMinimumToken()))
|
||||
{
|
||||
if (p instanceof RandomPartitioner)
|
||||
|
|
@ -335,7 +324,7 @@ public class AvroValidation
|
|||
{
|
||||
if (index_clause.expressions.isEmpty())
|
||||
throw newInvalidRequestException("index clause list may not be empty");
|
||||
Set<byte[]> indexedColumns = Table.open(keyspace).getColumnFamilyStore(columnFamily).getIndexedColumns();
|
||||
Set<ByteBuffer> indexedColumns = Table.open(keyspace).getColumnFamilyStore(columnFamily).getIndexedColumns();
|
||||
for (IndexExpression expression : index_clause.expressions)
|
||||
{
|
||||
if (expression.op.equals(IndexOperator.EQ) && indexedColumns.contains(expression.column_name.array()))
|
||||
|
|
|
|||
|
|
@ -141,14 +141,14 @@ public class CassandraServer implements Cassandra {
|
|||
AvroValidation.validateColumnPath(state().getKeyspace(), columnPath);
|
||||
|
||||
// FIXME: This is repetitive.
|
||||
byte[] column, super_column;
|
||||
column = columnPath.column == null ? null : columnPath.column.array();
|
||||
super_column = columnPath.super_column == null ? null : columnPath.super_column.array();
|
||||
ByteBuffer column, super_column;
|
||||
column = columnPath.column == null ? null : columnPath.column;
|
||||
super_column = columnPath.super_column == null ? null : columnPath.super_column;
|
||||
|
||||
QueryPath path = new QueryPath(columnPath.column_family.toString(), column == null ? null : super_column);
|
||||
List<byte[]> nameAsList = Arrays.asList(column == null ? super_column : column);
|
||||
AvroValidation.validateKey(key.array());
|
||||
ReadCommand command = new SliceByNamesReadCommand(state().getKeyspace(), key.array(), path, nameAsList);
|
||||
List<ByteBuffer> nameAsList = Arrays.asList(column == null ? super_column : column);
|
||||
AvroValidation.validateKey(key);
|
||||
ReadCommand command = new SliceByNamesReadCommand(state().getKeyspace(), key, path, nameAsList);
|
||||
|
||||
Map<DecoratedKey<?>, ColumnFamily> cfamilies = readColumnFamily(Arrays.asList(command), consistencyLevel);
|
||||
ColumnFamily cf = cfamilies.get(StorageService.getPartitioner().decorateKey(command.key));
|
||||
|
|
@ -320,8 +320,7 @@ public class CassandraServer implements Cassandra {
|
|||
AvroValidation.validateColumnParent(keyspace, columnParent);
|
||||
AvroValidation.validatePredicate(keyspace, columnParent, predicate);
|
||||
|
||||
byte[] superName = columnParent.super_column == null ? null : columnParent.super_column.array();
|
||||
QueryPath queryPath = new QueryPath(columnParent.column_family.toString(), superName);
|
||||
QueryPath queryPath = new QueryPath(columnParent.column_family.toString(), columnParent.super_column);
|
||||
|
||||
List<ReadCommand> commands = new ArrayList<ReadCommand>();
|
||||
if (predicate.column_names != null)
|
||||
|
|
@ -329,13 +328,8 @@ public class CassandraServer implements Cassandra {
|
|||
for (ByteBuffer key : keys)
|
||||
{
|
||||
AvroValidation.validateKey(key);
|
||||
|
||||
// FIXME: Copying the collection for the sake of SliceByNamesReadCommands
|
||||
Collection<byte[]> column_names = new ArrayList<byte[]>();
|
||||
for (ByteBuffer name : predicate.column_names)
|
||||
column_names.add(name.array());
|
||||
|
||||
commands.add(new SliceByNamesReadCommand(keyspace, key.array(), queryPath, column_names));
|
||||
|
||||
commands.add(new SliceByNamesReadCommand(keyspace, key, queryPath, predicate.column_names));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -344,7 +338,7 @@ public class CassandraServer implements Cassandra {
|
|||
for (ByteBuffer key : keys)
|
||||
{
|
||||
AvroValidation.validateKey(key);
|
||||
commands.add(new SliceFromReadCommand(keyspace, key.array(), queryPath, range.start.array(), range.finish.array(), range.reversed, range.count));
|
||||
commands.add(new SliceFromReadCommand(keyspace, key, queryPath, range.start, range.finish, range.reversed, range.count));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +357,7 @@ public class CassandraServer implements Cassandra {
|
|||
ColumnFamily cf = columnFamilies.get(StorageService.getPartitioner().decorateKey(cmd.key));
|
||||
boolean reverseOrder = cmd instanceof SliceFromReadCommand && ((SliceFromReadCommand)cmd).reversed;
|
||||
GenericArray<ColumnOrSuperColumn> avroColumns = avronateColumnFamily(cf, cmd.queryPath.superColumnName != null, reverseOrder);
|
||||
columnFamiliesList.add(newCoscsMapEntry(ByteBuffer.wrap(cmd.key), avroColumns));
|
||||
columnFamiliesList.add(newCoscsMapEntry(cmd.key, avroColumns));
|
||||
}
|
||||
|
||||
return columnFamiliesList;
|
||||
|
|
@ -394,17 +388,17 @@ public class CassandraServer implements Cassandra {
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("insert");
|
||||
|
||||
AvroValidation.validateKey(key.array());
|
||||
AvroValidation.validateKey(key);
|
||||
AvroValidation.validateColumnParent(state().getKeyspace(), parent);
|
||||
AvroValidation.validateColumn(state().getKeyspace(), parent, column);
|
||||
|
||||
RowMutation rm = new RowMutation(state().getKeyspace(), key.array());
|
||||
RowMutation rm = new RowMutation(state().getKeyspace(), key);
|
||||
try
|
||||
{
|
||||
rm.add(new QueryPath(parent.column_family.toString(),
|
||||
parent.super_column == null ? null : parent.super_column.array(),
|
||||
column.name.array()),
|
||||
column.value.array(),
|
||||
parent.super_column,
|
||||
column.name),
|
||||
column.value,
|
||||
column.timestamp,
|
||||
column.ttl == null ? 0 : column.ttl);
|
||||
}
|
||||
|
|
@ -423,12 +417,11 @@ public class CassandraServer implements Cassandra {
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("remove");
|
||||
|
||||
AvroValidation.validateKey(key.array());
|
||||
AvroValidation.validateKey(key);
|
||||
AvroValidation.validateColumnPath(state().getKeyspace(), columnPath);
|
||||
|
||||
RowMutation rm = new RowMutation(state().getKeyspace(), key.array());
|
||||
byte[] superName = columnPath.super_column == null ? null : columnPath.super_column.array();
|
||||
rm.delete(new QueryPath(columnPath.column_family.toString(), superName), timestamp);
|
||||
RowMutation rm = new RowMutation(state().getKeyspace(), key);
|
||||
rm.delete(new QueryPath(columnPath.column_family.toString(), columnPath.super_column), timestamp);
|
||||
|
||||
doInsert(consistencyLevel, rm);
|
||||
|
||||
|
|
@ -466,7 +459,7 @@ public class CassandraServer implements Cassandra {
|
|||
|
||||
for (MutationsMapEntry pair: mutationMap)
|
||||
{
|
||||
AvroValidation.validateKey(pair.key.array());
|
||||
AvroValidation.validateKey(pair.key);
|
||||
Map<CharSequence, List<Mutation>> cfToMutations = pair.mutations;
|
||||
|
||||
for (Map.Entry<CharSequence, List<Mutation>> cfMutations : cfToMutations.entrySet())
|
||||
|
|
@ -476,7 +469,7 @@ public class CassandraServer implements Cassandra {
|
|||
for (Mutation mutation : cfMutations.getValue())
|
||||
AvroValidation.validateMutation(state().getKeyspace(), cfName, mutation);
|
||||
}
|
||||
rowMutations.add(getRowMutationFromMutations(state().getKeyspace(), pair.key.array(), cfToMutations));
|
||||
rowMutations.add(getRowMutationFromMutations(state().getKeyspace(), pair.key, cfToMutations));
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -502,7 +495,7 @@ public class CassandraServer implements Cassandra {
|
|||
}
|
||||
|
||||
// FIXME: This is copypasta from o.a.c.db.RowMutation, (RowMutation.getRowMutation uses Thrift types directly).
|
||||
private static RowMutation getRowMutationFromMutations(String keyspace, byte[] key, Map<CharSequence, List<Mutation>> cfMap)
|
||||
private static RowMutation getRowMutationFromMutations(String keyspace, ByteBuffer key, Map<CharSequence, List<Mutation>> cfMap)
|
||||
{
|
||||
RowMutation rm = new RowMutation(keyspace, key);
|
||||
|
||||
|
|
@ -528,32 +521,31 @@ public class CassandraServer implements Cassandra {
|
|||
if (cosc.column == null)
|
||||
{
|
||||
for (Column column : cosc.super_column.columns)
|
||||
rm.add(new QueryPath(cfName, cosc.super_column.name.array(), column.name.array()), column.value.array(), column.timestamp);
|
||||
rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
rm.add(new QueryPath(cfName, null, cosc.column.name.array()), cosc.column.value.array(), cosc.column.timestamp);
|
||||
rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: This is copypasta from o.a.c.db.RowMutation, (RowMutation.getRowMutation uses Thrift types directly).
|
||||
private static void deleteColumnOrSuperColumnToRowMutation(RowMutation rm, String cfName, Deletion del)
|
||||
{
|
||||
byte[] superName = del.super_column == null ? null : del.super_column.array();
|
||||
|
||||
if (del.predicate != null && del.predicate.column_names != null)
|
||||
{
|
||||
for (ByteBuffer col : del.predicate.column_names)
|
||||
{
|
||||
if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.getTable(), cfName) == ColumnFamilyType.Super)
|
||||
rm.delete(new QueryPath(cfName, col.array()), del.timestamp);
|
||||
rm.delete(new QueryPath(cfName, col), del.timestamp);
|
||||
else
|
||||
rm.delete(new QueryPath(cfName, superName, col.array()), del.timestamp);
|
||||
rm.delete(new QueryPath(cfName, del.super_column, col), del.timestamp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rm.delete(new QueryPath(cfName, superName), del.timestamp);
|
||||
rm.delete(new QueryPath(cfName, del.super_column), del.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1031,7 @@ public class CassandraServer implements Cassandra {
|
|||
}
|
||||
else
|
||||
{
|
||||
bounds = new Bounds(p.getToken(range.start_key.array()), p.getToken(range.end_key.array()));
|
||||
bounds = new Bounds(p.getToken(range.start_key), p.getToken(range.end_key));
|
||||
}
|
||||
try
|
||||
{
|
||||
|
|
@ -1129,31 +1121,22 @@ public class CassandraServer implements Cassandra {
|
|||
{
|
||||
org.apache.cassandra.thrift.ColumnParent cp = new org.apache.cassandra.thrift.ColumnParent(avro_column_parent.column_family.toString());
|
||||
if (avro_column_parent.super_column != null)
|
||||
cp.super_column = avro_column_parent.super_column.array();
|
||||
cp.super_column = avro_column_parent.super_column;
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
private org.apache.cassandra.thrift.SlicePredicate thriftSlicePredicate(SlicePredicate avro_pred) {
|
||||
// One or the other are set, so check for nulls of either
|
||||
|
||||
List<byte[]> bufs = null;
|
||||
if (avro_pred.column_names != null)
|
||||
{
|
||||
bufs = new ArrayList<byte[]>();
|
||||
for(ByteBuffer buf : avro_pred.column_names)
|
||||
bufs.add(buf.array());
|
||||
}
|
||||
|
||||
org.apache.cassandra.thrift.SliceRange slice_range = (avro_pred.slice_range != null)
|
||||
? thriftSliceRange(avro_pred.slice_range)
|
||||
: null;
|
||||
|
||||
return new org.apache.cassandra.thrift.SlicePredicate().setColumn_names(bufs).setSlice_range(slice_range);
|
||||
return new org.apache.cassandra.thrift.SlicePredicate().setColumn_names(avro_pred.column_names).setSlice_range(slice_range);
|
||||
}
|
||||
|
||||
private org.apache.cassandra.thrift.SliceRange thriftSliceRange(SliceRange avro_range) {
|
||||
return new org.apache.cassandra.thrift.SliceRange(avro_range.start.array(), avro_range.finish.array(), avro_range.reversed, avro_range.count);
|
||||
return new org.apache.cassandra.thrift.SliceRange(avro_range.start, avro_range.finish, avro_range.reversed, avro_range.count);
|
||||
}
|
||||
|
||||
private org.apache.cassandra.thrift.IndexClause thriftIndexClause(IndexClause avro_clause) {
|
||||
|
|
@ -1161,11 +1144,11 @@ public class CassandraServer implements Cassandra {
|
|||
for(IndexExpression exp : avro_clause.expressions)
|
||||
expressions.add(thriftIndexExpression(exp));
|
||||
|
||||
return new org.apache.cassandra.thrift.IndexClause(expressions, avro_clause.start_key.array(), avro_clause.count);
|
||||
return new org.apache.cassandra.thrift.IndexClause(expressions, avro_clause.start_key, avro_clause.count);
|
||||
}
|
||||
|
||||
private org.apache.cassandra.thrift.IndexExpression thriftIndexExpression(IndexExpression avro_exp) {
|
||||
return new org.apache.cassandra.thrift.IndexExpression(avro_exp.column_name.array(), thriftIndexOperator(avro_exp.op), avro_exp.value.array());
|
||||
return new org.apache.cassandra.thrift.IndexExpression(avro_exp.column_name, thriftIndexOperator(avro_exp.op), avro_exp.value);
|
||||
}
|
||||
|
||||
private org.apache.cassandra.thrift.IndexOperator thriftIndexOperator(IndexOperator avro_op) {
|
||||
|
|
|
|||
|
|
@ -19,19 +19,59 @@ package org.apache.cassandra.cli;
|
|||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.utils.UUIDGen;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.antlr.runtime.tree.CommonTree;
|
||||
import org.antlr.runtime.tree.Tree;
|
||||
import org.apache.cassandra.auth.SimpleAuthenticator;
|
||||
import org.apache.cassandra.db.marshal.*;
|
||||
import org.apache.cassandra.thrift.*;
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.db.marshal.AsciiType;
|
||||
import org.apache.cassandra.db.marshal.BytesType;
|
||||
import org.apache.cassandra.db.marshal.IntegerType;
|
||||
import org.apache.cassandra.db.marshal.LexicalUUIDType;
|
||||
import org.apache.cassandra.db.marshal.LongType;
|
||||
import org.apache.cassandra.db.marshal.TimeUUIDType;
|
||||
import org.apache.cassandra.db.marshal.UTF8Type;
|
||||
import org.apache.cassandra.thrift.AuthenticationException;
|
||||
import org.apache.cassandra.thrift.AuthenticationRequest;
|
||||
import org.apache.cassandra.thrift.AuthorizationException;
|
||||
import org.apache.cassandra.thrift.Cassandra;
|
||||
import org.apache.cassandra.thrift.CfDef;
|
||||
import org.apache.cassandra.thrift.Column;
|
||||
import org.apache.cassandra.thrift.ColumnDef;
|
||||
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
|
||||
import org.apache.cassandra.thrift.ColumnParent;
|
||||
import org.apache.cassandra.thrift.ColumnPath;
|
||||
import org.apache.cassandra.thrift.ConsistencyLevel;
|
||||
import org.apache.cassandra.thrift.IndexClause;
|
||||
import org.apache.cassandra.thrift.IndexExpression;
|
||||
import org.apache.cassandra.thrift.IndexOperator;
|
||||
import org.apache.cassandra.thrift.IndexType;
|
||||
import org.apache.cassandra.thrift.InvalidRequestException;
|
||||
import org.apache.cassandra.thrift.KeyRange;
|
||||
import org.apache.cassandra.thrift.KeySlice;
|
||||
import org.apache.cassandra.thrift.KsDef;
|
||||
import org.apache.cassandra.thrift.NotFoundException;
|
||||
import org.apache.cassandra.thrift.SlicePredicate;
|
||||
import org.apache.cassandra.thrift.SliceRange;
|
||||
import org.apache.cassandra.thrift.SuperColumn;
|
||||
import org.apache.cassandra.thrift.TimedOutException;
|
||||
import org.apache.cassandra.thrift.UnavailableException;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.UUIDGen;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.thrift.TException;
|
||||
|
||||
// Cli Client Side Library
|
||||
|
|
@ -515,7 +555,7 @@ public class CliClient
|
|||
|
||||
if (columnSpecCnt == 0)
|
||||
{
|
||||
colParent = new ColumnParent(columnFamily).setSuper_column(null);
|
||||
colParent = new ColumnParent(columnFamily).setSuper_column((ByteBuffer)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -523,10 +563,10 @@ public class CliClient
|
|||
colParent = new ColumnParent(columnFamily).setSuper_column(CliCompiler.getColumn(columnFamilySpec, 0).getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
SliceRange range = new SliceRange(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, Integer.MAX_VALUE);
|
||||
SliceRange range = new SliceRange(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE);
|
||||
SlicePredicate predicate = new SlicePredicate().setColumn_names(null).setSlice_range(range);
|
||||
|
||||
int count = thriftClient_.get_count(key.getBytes(), colParent, predicate, ConsistencyLevel.ONE);
|
||||
int count = thriftClient_.get_count(ByteBuffer.wrap(key.getBytes("UTF-8")), colParent, predicate, ConsistencyLevel.ONE);
|
||||
css_.out.printf("%d columns\n", count);
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +624,14 @@ public class CliClient
|
|||
columnName = CliCompiler.getColumn(columnFamilySpec, 1).getBytes("UTF-8");
|
||||
}
|
||||
|
||||
thriftClient_.remove(key.getBytes(), new ColumnPath(columnFamily).setSuper_column(superColumnName).setColumn(columnName),
|
||||
ColumnPath path = new ColumnPath(columnFamily);
|
||||
if(superColumnName != null)
|
||||
path.setSuper_column(superColumnName);
|
||||
|
||||
if(columnName != null)
|
||||
path.setColumn(columnName);
|
||||
|
||||
thriftClient_.remove(ByteBuffer.wrap(key.getBytes("UTF-8")), path,
|
||||
FBUtilities.timestampMicros(), ConsistencyLevel.ONE);
|
||||
css_.out.println(String.format("%s removed.", (columnSpecCnt == 0) ? "row" : "column"));
|
||||
}
|
||||
|
|
@ -592,9 +639,13 @@ public class CliClient
|
|||
private void doSlice(String keyspace, String key, String columnFamily, byte[] superColumnName)
|
||||
throws InvalidRequestException, UnavailableException, TimedOutException, TException, UnsupportedEncodingException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException
|
||||
{
|
||||
SliceRange range = new SliceRange(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 1000000);
|
||||
List<ColumnOrSuperColumn> columns = thriftClient_.get_slice(key.getBytes(),
|
||||
new ColumnParent(columnFamily).setSuper_column(superColumnName),
|
||||
|
||||
ColumnParent parent = new ColumnParent(columnFamily);
|
||||
if(superColumnName != null)
|
||||
parent.setSuper_column(superColumnName);
|
||||
|
||||
SliceRange range = new SliceRange(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 1000000);
|
||||
List<ColumnOrSuperColumn> columns = thriftClient_.get_slice(ByteBuffer.wrap(key.getBytes("UTF-8")),parent,
|
||||
new SlicePredicate().setColumn_names(null).setSlice_range(range), ConsistencyLevel.ONE);
|
||||
int size = columns.size();
|
||||
|
||||
|
|
@ -623,7 +674,7 @@ public class CliClient
|
|||
Column column = cosc.column;
|
||||
validator = getValidatorForValue(cfDef, column.getName());
|
||||
css_.out.printf("=> (column=%s, value=%s, timestamp=%d)\n", formatColumnName(keyspace, columnFamily, column),
|
||||
validator.getString(column.value), column.timestamp);
|
||||
validator.getString(column.value), column.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -720,15 +771,16 @@ public class CliClient
|
|||
return;
|
||||
}
|
||||
|
||||
byte[] columnNameInBytes = columnNameAsByteArray(columnName, columnFamily);
|
||||
AbstractType validator = getValidatorForValue(columnFamilyDef, columnNameInBytes);
|
||||
ByteBuffer columnNameInBytes = columnNameAsByteArray(columnName, columnFamily);
|
||||
AbstractType validator = getValidatorForValue(columnFamilyDef, columnNameInBytes.array());
|
||||
|
||||
// Perform a get()
|
||||
ColumnPath path = new ColumnPath(columnFamily).setSuper_column(superColumnName).setColumn(columnNameInBytes);
|
||||
Column column = thriftClient_.get(key.getBytes(), path, ConsistencyLevel.ONE).column;
|
||||
ColumnPath path = new ColumnPath(columnFamily);
|
||||
if(superColumnName != null) path.setSuper_column(superColumnName);
|
||||
if(columnNameInBytes != null) path.setColumn(columnNameInBytes);
|
||||
Column column = thriftClient_.get(ByteBuffer.wrap(key.getBytes("UTF-8")), path, ConsistencyLevel.ONE).column;
|
||||
|
||||
byte[] columnValue = column.getValue();
|
||||
|
||||
byte[] columnValue = column.getValue();
|
||||
String valueAsString;
|
||||
|
||||
// we have ^(CONVERT_TO_TYPE <type>) inside of GET statement
|
||||
|
|
@ -744,13 +796,13 @@ public class CliClient
|
|||
AbstractType valueValidator = getFormatTypeForColumn(typeName);
|
||||
|
||||
// setting value for output
|
||||
valueAsString = valueValidator.getString(columnValue);
|
||||
valueAsString = valueValidator.getString(ByteBuffer.wrap(columnValue));
|
||||
// updating column value validator class
|
||||
updateColumnMetaData(columnFamilyDef, columnNameInBytes, valueValidator.getClass().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
valueAsString = (validator == null) ? new String(columnValue, "UTF-8") : validator.getString(columnValue);
|
||||
valueAsString = (validator == null) ? new String(columnValue, "UTF-8") : validator.getString(ByteBuffer.wrap(columnValue));
|
||||
}
|
||||
|
||||
// print results
|
||||
|
|
@ -795,8 +847,8 @@ public class CliClient
|
|||
|
||||
try
|
||||
{
|
||||
byte[] value;
|
||||
byte[] columnName = columnNameAsByteArray(columnNameString, columnFamily);
|
||||
ByteBuffer value;
|
||||
ByteBuffer columnName = columnNameAsByteArray(columnNameString, columnFamily);
|
||||
|
||||
if (valueTree.getType() == CliParser.FUNCTION_CALL)
|
||||
{
|
||||
|
|
@ -894,8 +946,8 @@ public class CliClient
|
|||
}
|
||||
|
||||
|
||||
byte[] columnNameInBytes = columnNameAsByteArray(columnName, columnFamily);
|
||||
byte[] columnValueInBytes;
|
||||
ByteBuffer columnNameInBytes = columnNameAsByteArray(columnName, columnFamily);
|
||||
ByteBuffer columnValueInBytes;
|
||||
|
||||
switch (valueTree.getType())
|
||||
{
|
||||
|
|
@ -906,8 +958,12 @@ public class CliClient
|
|||
columnValueInBytes = columnValueAsByteArray(columnNameInBytes, columnFamily, value);
|
||||
}
|
||||
|
||||
ColumnParent parent = new ColumnParent(columnFamily);
|
||||
if(superColumnName != null)
|
||||
parent.setSuper_column(superColumnName);
|
||||
|
||||
// do the insert
|
||||
thriftClient_.insert(key.getBytes(), new ColumnParent(columnFamily).setSuper_column(superColumnName),
|
||||
thriftClient_.insert(ByteBuffer.wrap(key.getBytes("UTF-8")), parent,
|
||||
new Column(columnNameInBytes, columnValueInBytes, FBUtilities.timestampMicros()), ConsistencyLevel.ONE);
|
||||
|
||||
css_.out.println("Value inserted.");
|
||||
|
|
@ -1275,6 +1331,7 @@ public class CliClient
|
|||
|
||||
if (limitCount < keySlices.size())
|
||||
{
|
||||
|
||||
// limitCount could be Integer.MAX_VALUE
|
||||
toIndex = limitCount;
|
||||
}
|
||||
|
|
@ -1452,7 +1509,7 @@ public class CliClient
|
|||
css_.out.println(leftSpace + "Column Metadata:");
|
||||
for (ColumnDef columnDef : cf_def.getColumn_metadata())
|
||||
{
|
||||
String columnName = columnNameValidator.getString(columnDef.getName());
|
||||
String columnName = columnNameValidator.getString(columnDef.name);
|
||||
|
||||
css_.out.println(leftSpace + " Column Name: " + columnName);
|
||||
css_.out.println(columnLeftSpace + "Validation Class: " + columnDef.getValidation_class());
|
||||
|
|
@ -1656,7 +1713,7 @@ public class CliClient
|
|||
* @return byte[] - object in the byte array representation
|
||||
* @throws UnsupportedEncodingException - raised but String.getBytes(encoding)
|
||||
*/
|
||||
private byte[] getBytesAccordingToType(String object, AbstractType comparator) throws UnsupportedEncodingException
|
||||
private ByteBuffer getBytesAccordingToType(String object, AbstractType comparator) throws UnsupportedEncodingException
|
||||
{
|
||||
if (comparator instanceof LongType)
|
||||
{
|
||||
|
|
@ -1679,7 +1736,7 @@ public class CliClient
|
|||
if (comparator instanceof TimeUUIDType && uuid.version() != 1)
|
||||
throw new IllegalArgumentException("TimeUUID supports only version 1 UUIDs");
|
||||
|
||||
return UUIDGen.decompose(uuid);
|
||||
return ByteBuffer.wrap(UUIDGen.decompose(uuid));
|
||||
}
|
||||
else if (comparator instanceof IntegerType)
|
||||
{
|
||||
|
|
@ -1694,15 +1751,15 @@ public class CliClient
|
|||
throw new RuntimeException("'" + object + "' could not be translated into an IntegerType.");
|
||||
}
|
||||
|
||||
return integerType.toByteArray();
|
||||
return ByteBuffer.wrap(integerType.toByteArray());
|
||||
}
|
||||
else if (comparator instanceof AsciiType)
|
||||
{
|
||||
return object.getBytes("US-ASCII");
|
||||
return ByteBuffer.wrap(object.getBytes("US-ASCII"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return object.getBytes("UTF-8");
|
||||
return ByteBuffer.wrap(object.getBytes("UTF-8"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1716,7 +1773,7 @@ public class CliClient
|
|||
* @throws IllegalAccessException - raised from getFormatTypeForColumn call
|
||||
* @throws UnsupportedEncodingException - raised from getBytes() calls
|
||||
*/
|
||||
private byte[] columnNameAsByteArray(String column, String columnFamily) throws NoSuchFieldException, InstantiationException, IllegalAccessException, UnsupportedEncodingException
|
||||
private ByteBuffer columnNameAsByteArray(String column, String columnFamily) throws NoSuchFieldException, InstantiationException, IllegalAccessException, UnsupportedEncodingException
|
||||
{
|
||||
CfDef columnFamilyDef = getCfDef(columnFamily);
|
||||
String comparatorClass = columnFamilyDef.comparator_type;
|
||||
|
|
@ -1731,7 +1788,7 @@ public class CliClient
|
|||
* @param columnValue - actual column value
|
||||
* @return byte[] - value in byte array representation
|
||||
*/
|
||||
private byte[] columnValueAsByteArray(byte[] columnName, String columnFamilyName, String columnValue)
|
||||
private ByteBuffer columnValueAsByteArray(ByteBuffer columnName, String columnFamilyName, String columnValue)
|
||||
{
|
||||
CfDef columnFamilyDef = getCfDef(columnFamilyName);
|
||||
|
||||
|
|
@ -1739,7 +1796,7 @@ public class CliClient
|
|||
{
|
||||
byte[] currentColumnName = columnDefinition.getName();
|
||||
|
||||
if (Arrays.equals(currentColumnName, columnName))
|
||||
if (ByteBufferUtil.compare(currentColumnName,columnName)==0)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -1754,7 +1811,7 @@ public class CliClient
|
|||
}
|
||||
|
||||
// if no validation were set returning simple .getBytes()
|
||||
return columnValue.getBytes();
|
||||
return ByteBuffer.wrap(columnValue.getBytes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1771,7 +1828,7 @@ public class CliClient
|
|||
{
|
||||
byte[] nameInBytes = columnDefinition.getName();
|
||||
|
||||
if (Arrays.equals(nameInBytes, columnNameInBytes))
|
||||
if (nameInBytes.equals(columnNameInBytes))
|
||||
{
|
||||
return getFormatTypeForColumn(columnDefinition.getValidation_class());
|
||||
}
|
||||
|
|
@ -1825,7 +1882,7 @@ public class CliClient
|
|||
* @param columnName - also updates column family metadata for given column
|
||||
* @return byte[] - string value as byte[]
|
||||
*/
|
||||
private byte[] convertValueByFunction(Tree functionCall, CfDef columnFamily, byte[] columnName)
|
||||
private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName)
|
||||
{
|
||||
return convertValueByFunction(functionCall, columnFamily, columnName, false);
|
||||
}
|
||||
|
|
@ -1838,7 +1895,7 @@ public class CliClient
|
|||
* @param withUpdate - also updates column family metadata for given column
|
||||
* @return byte[] - string value as byte[]
|
||||
*/
|
||||
private byte[] convertValueByFunction(Tree functionCall, CfDef columnFamily, byte[] columnName, boolean withUpdate)
|
||||
private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName, boolean withUpdate)
|
||||
{
|
||||
String functionName = functionCall.getChild(0).getText();
|
||||
String functionArg = CliUtils.unescapeSQLString(functionCall.getChild(1).getText());
|
||||
|
|
@ -1858,7 +1915,7 @@ public class CliClient
|
|||
try
|
||||
{
|
||||
AbstractType validator = function.getValidator();
|
||||
byte[] value = getBytesAccordingToType(functionArg, validator);
|
||||
ByteBuffer value = getBytesAccordingToType(functionArg, validator);
|
||||
|
||||
// performing ColumnDef local validator update
|
||||
if (withUpdate)
|
||||
|
|
@ -1880,7 +1937,7 @@ public class CliClient
|
|||
* @param columnName - column name represented as byte[]
|
||||
* @param validationClass - value validation class
|
||||
*/
|
||||
private void updateColumnMetaData(CfDef columnFamily, byte[] columnName, String validationClass)
|
||||
private void updateColumnMetaData(CfDef columnFamily, ByteBuffer columnName, String validationClass)
|
||||
{
|
||||
List<ColumnDef> columnMetaData = columnFamily.getColumn_metadata();
|
||||
ColumnDef column = getColumnDefByName(columnFamily, columnName);
|
||||
|
|
@ -1906,13 +1963,13 @@ public class CliClient
|
|||
* @param columnName - column name represented as byte[]
|
||||
* @return ColumnDef - found column definition
|
||||
*/
|
||||
private ColumnDef getColumnDefByName(CfDef columnFamily, byte[] columnName)
|
||||
private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName)
|
||||
{
|
||||
for (ColumnDef columnDef : columnFamily.getColumn_metadata())
|
||||
{
|
||||
byte[] currName = columnDef.getName();
|
||||
|
||||
if (Arrays.equals(currName, columnName))
|
||||
if (ByteBufferUtil.compare(currName, columnName) == 0)
|
||||
{
|
||||
return columnDef;
|
||||
}
|
||||
|
|
@ -1941,7 +1998,7 @@ public class CliClient
|
|||
for (KeySlice ks : slices)
|
||||
{
|
||||
css_.out.printf("-------------------\n");
|
||||
css_.out.printf("RowKey: %s\n", new String(ks.key, "UTF-8"));
|
||||
css_.out.printf("RowKey: %s\n", new String(ks.key.array(),ks.key.position(),ks.key.remaining(), "UTF-8"));
|
||||
|
||||
Iterator<ColumnOrSuperColumn> iterator = ks.getColumnsIterator();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,30 +17,29 @@
|
|||
*/
|
||||
package org.apache.cassandra.client;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.dht.Range;
|
||||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.locator.AbstractReplicationStrategy;
|
||||
import org.apache.cassandra.locator.TokenMetadata;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.apache.cassandra.thrift.Cassandra;
|
||||
import org.apache.cassandra.thrift.InvalidRequestException;
|
||||
import org.apache.cassandra.thrift.TokenRange;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
/**
|
||||
* A class for caching the ring map at the client. For usage example, see
|
||||
|
|
@ -120,12 +119,12 @@ public class RingCache
|
|||
return (List<InetAddress>) rangeMap.get(range);
|
||||
}
|
||||
|
||||
public List<InetAddress> getEndpoint(byte[] key)
|
||||
public List<InetAddress> getEndpoint(ByteBuffer key)
|
||||
{
|
||||
return getEndpoint(getRange(key));
|
||||
}
|
||||
|
||||
public Range getRange(byte[] key)
|
||||
public Range getRange(ByteBuffer key)
|
||||
{
|
||||
// TODO: naive linear search of the token map
|
||||
Token<?> t = partitioner_.getToken(key);
|
||||
|
|
|
|||
|
|
@ -19,18 +19,20 @@
|
|||
package org.apache.cassandra.config;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
import org.apache.avro.util.Utf8;
|
||||
import org.apache.cassandra.avro.ColumnDef;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.ColumnFamilyType;
|
||||
import org.apache.cassandra.db.HintedHandOffManager;
|
||||
import org.apache.cassandra.db.SystemTable;
|
||||
import org.apache.cassandra.db.Table;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.db.marshal.BytesType;
|
||||
import org.apache.cassandra.db.marshal.TimeUUIDType;
|
||||
|
|
@ -39,6 +41,12 @@ import org.apache.cassandra.db.migration.Migration;
|
|||
import org.apache.cassandra.io.SerDeUtils;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
|
||||
public final class CFMetaData
|
||||
|
|
@ -90,7 +98,7 @@ public final class CFMetaData
|
|||
DEFAULT_MEMTABLE_THROUGHPUT_IN_MB,
|
||||
DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS,
|
||||
cfId,
|
||||
Collections.<byte[], ColumnDefinition>emptyMap());
|
||||
Collections.<ByteBuffer, ColumnDefinition>emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -141,7 +149,7 @@ public final class CFMetaData
|
|||
public final double memtableOperationsInMillions; // default based on throughput
|
||||
// NOTE: if you find yourself adding members to this class, make sure you keep the convert methods in lockstep.
|
||||
|
||||
public final Map<byte[], ColumnDefinition> column_metadata;
|
||||
public final Map<ByteBuffer, ColumnDefinition> column_metadata;
|
||||
|
||||
private CFMetaData(String tableName,
|
||||
String cfName,
|
||||
|
|
@ -163,7 +171,7 @@ public final class CFMetaData
|
|||
Integer memtableThroughputInMb,
|
||||
Double memtableOperationsInMillions,
|
||||
Integer cfId,
|
||||
Map<byte[], ColumnDefinition> column_metadata)
|
||||
Map<ByteBuffer, ColumnDefinition> column_metadata)
|
||||
|
||||
{
|
||||
assert column_metadata != null;
|
||||
|
|
@ -230,7 +238,7 @@ public final class CFMetaData
|
|||
Integer memSize,
|
||||
Double memOps,
|
||||
//This constructor generates the id!
|
||||
Map<byte[], ColumnDefinition> column_metadata)
|
||||
Map<ByteBuffer, ColumnDefinition> column_metadata)
|
||||
{
|
||||
this(tableName,
|
||||
cfName,
|
||||
|
|
@ -276,7 +284,7 @@ public final class CFMetaData
|
|||
DEFAULT_MEMTABLE_LIFETIME_IN_MINS,
|
||||
DEFAULT_MEMTABLE_THROUGHPUT_IN_MB,
|
||||
DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS,
|
||||
Collections.<byte[], ColumnDefinition>emptyMap());
|
||||
Collections.<ByteBuffer, ColumnDefinition>emptyMap());
|
||||
}
|
||||
|
||||
/** clones an existing CFMetaData using the same id. */
|
||||
|
|
@ -386,7 +394,7 @@ public final class CFMetaData
|
|||
{
|
||||
throw new RuntimeException("Could not inflate CFMetaData for " + cf, ex);
|
||||
}
|
||||
Map<byte[], ColumnDefinition> column_metadata = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
|
||||
Map<ByteBuffer, ColumnDefinition> column_metadata = new TreeMap<ByteBuffer, ColumnDefinition>(BytesType.instance);
|
||||
for (ColumnDef aColumn_metadata : cf.column_metadata)
|
||||
{
|
||||
ColumnDefinition cd = ColumnDefinition.inflate(aColumn_metadata);
|
||||
|
|
@ -491,7 +499,7 @@ public final class CFMetaData
|
|||
return idGen.getAndIncrement();
|
||||
}
|
||||
|
||||
public AbstractType getValueValidator(byte[] column)
|
||||
public AbstractType getValueValidator(ByteBuffer column)
|
||||
{
|
||||
AbstractType validator = defaultValidator;
|
||||
ColumnDefinition columnDefinition = column_metadata.get(column);
|
||||
|
|
@ -574,7 +582,7 @@ public final class CFMetaData
|
|||
validateMinMaxCompactionThresholds(cf_def);
|
||||
validateMemtableSettings(cf_def);
|
||||
|
||||
Map<byte[], ColumnDefinition> metadata = new HashMap<byte[], ColumnDefinition>();
|
||||
Map<ByteBuffer, ColumnDefinition> metadata = new HashMap<ByteBuffer, ColumnDefinition>();
|
||||
if (cf_def.column_metadata == null)
|
||||
{
|
||||
metadata = column_metadata;
|
||||
|
|
@ -685,7 +693,7 @@ public final class CFMetaData
|
|||
org.apache.cassandra.avro.ColumnDef tcd = new org.apache.cassandra.avro.ColumnDef();
|
||||
tcd.index_name = cd.index_name;
|
||||
tcd.index_type = org.apache.cassandra.avro.IndexType.valueOf(cd.index_type.name());
|
||||
tcd.name = ByteBuffer.wrap(cd.name);
|
||||
tcd.name = cd.name;
|
||||
tcd.validation_class = cd.validator.getClass().getName();
|
||||
column_meta.add(tcd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,24 +22,24 @@ package org.apache.cassandra.config;
|
|||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.avro.util.Utf8;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.thrift.ColumnDef;
|
||||
import org.apache.cassandra.thrift.IndexType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class ColumnDefinition {
|
||||
public final byte[] name;
|
||||
public final ByteBuffer name;
|
||||
public final AbstractType validator;
|
||||
public final IndexType index_type;
|
||||
public final String index_name;
|
||||
|
||||
public ColumnDefinition(byte[] name, String validation_class, IndexType index_type, String index_name) throws ConfigurationException
|
||||
public ColumnDefinition(ByteBuffer name, String validation_class, IndexType index_type, String index_name) throws ConfigurationException
|
||||
{
|
||||
this.name = name;
|
||||
this.index_type = index_type;
|
||||
|
|
@ -60,7 +60,7 @@ public class ColumnDefinition {
|
|||
return false;
|
||||
if (index_type != null ? !index_type.equals(that.index_type) : that.index_type != null)
|
||||
return false;
|
||||
if (!Arrays.equals(name, that.name))
|
||||
if (!name.equals(that.name))
|
||||
return false;
|
||||
return !(validator != null ? !validator.equals(that.validator) : that.validator != null);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class ColumnDefinition {
|
|||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = name != null ? Arrays.hashCode(name) : 0;
|
||||
int result = name != null ? name.hashCode() : 0;
|
||||
result = 31 * result + (validator != null ? validator.hashCode() : 0);
|
||||
result = 31 * result + (index_type != null ? index_type.hashCode() : 0);
|
||||
result = 31 * result + (index_name != null ? index_name.hashCode() : 0);
|
||||
|
|
@ -78,7 +78,7 @@ public class ColumnDefinition {
|
|||
public org.apache.cassandra.avro.ColumnDef deflate()
|
||||
{
|
||||
org.apache.cassandra.avro.ColumnDef cd = new org.apache.cassandra.avro.ColumnDef();
|
||||
cd.name = ByteBuffer.wrap(name);
|
||||
cd.name = name;
|
||||
cd.validation_class = new Utf8(validator.getClass().getName());
|
||||
cd.index_type = index_type == null ? null :
|
||||
Enum.valueOf(org.apache.cassandra.avro.IndexType.class, index_type.name());
|
||||
|
|
@ -88,14 +88,12 @@ public class ColumnDefinition {
|
|||
|
||||
public static ColumnDefinition inflate(org.apache.cassandra.avro.ColumnDef cd)
|
||||
{
|
||||
byte[] name = new byte[cd.name.remaining()];
|
||||
cd.name.get(name, 0, name.length);
|
||||
IndexType index_type = cd.index_type == null ? null :
|
||||
Enum.valueOf(IndexType.class, cd.index_type.name());
|
||||
String index_name = cd.index_name == null ? null : cd.index_name.toString();
|
||||
try
|
||||
{
|
||||
return new ColumnDefinition(name, cd.validation_class.toString(), index_type, index_name);
|
||||
return new ColumnDefinition(cd.name, cd.validation_class.toString(), index_type, index_name);
|
||||
}
|
||||
catch (ConfigurationException e)
|
||||
{
|
||||
|
|
@ -110,18 +108,18 @@ public class ColumnDefinition {
|
|||
|
||||
public static ColumnDefinition fromColumnDef(org.apache.cassandra.avro.ColumnDef cd) throws ConfigurationException
|
||||
{
|
||||
return new ColumnDefinition(cd.name.array(),
|
||||
return new ColumnDefinition(cd.name,
|
||||
cd.validation_class.toString(),
|
||||
IndexType.valueOf(cd.index_type == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXTYPE : cd.index_type.name()),
|
||||
cd.index_name == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXNAME : cd.index_name.toString());
|
||||
}
|
||||
|
||||
public static Map<byte[], ColumnDefinition> fromColumnDef(List<ColumnDef> thriftDefs) throws ConfigurationException
|
||||
public static Map<ByteBuffer, ColumnDefinition> fromColumnDef(List<ColumnDef> thriftDefs) throws ConfigurationException
|
||||
{
|
||||
if (thriftDefs == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
Map<byte[], ColumnDefinition> cds = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
|
||||
Map<ByteBuffer, ColumnDefinition> cds = new TreeMap<ByteBuffer, ColumnDefinition>();
|
||||
for (ColumnDef thriftColumnDef : thriftDefs)
|
||||
{
|
||||
cds.put(thriftColumnDef.name, fromColumnDef(thriftColumnDef));
|
||||
|
|
@ -130,15 +128,15 @@ public class ColumnDefinition {
|
|||
return Collections.unmodifiableMap(cds);
|
||||
}
|
||||
|
||||
public static Map<byte[], ColumnDefinition> fromColumnDefs(Iterable<org.apache.cassandra.avro.ColumnDef> avroDefs) throws ConfigurationException
|
||||
public static Map<ByteBuffer, ColumnDefinition> fromColumnDefs(Iterable<org.apache.cassandra.avro.ColumnDef> avroDefs) throws ConfigurationException
|
||||
{
|
||||
if (avroDefs == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
Map<byte[], ColumnDefinition> cds = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
|
||||
Map<ByteBuffer, ColumnDefinition> cds = new TreeMap<ByteBuffer, ColumnDefinition>();
|
||||
for (org.apache.cassandra.avro.ColumnDef avroColumnDef : avroDefs)
|
||||
{
|
||||
cds.put(avroColumnDef.name.array(), fromColumnDef(avroColumnDef));
|
||||
cds.put(avroColumnDef.name, fromColumnDef(avroColumnDef));
|
||||
}
|
||||
|
||||
return Collections.unmodifiableMap(cds);
|
||||
|
|
|
|||
|
|
@ -18,16 +18,27 @@
|
|||
|
||||
package org.apache.cassandra.config;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.cassandra.auth.AllowAllAuthenticator;
|
||||
import org.apache.cassandra.auth.AllowAllAuthority;
|
||||
|
|
@ -43,12 +54,18 @@ import org.apache.cassandra.db.migration.Migration;
|
|||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.io.sstable.Descriptor;
|
||||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.locator.*;
|
||||
import org.apache.cassandra.locator.AbstractReplicationStrategy;
|
||||
import org.apache.cassandra.locator.DynamicEndpointSnitch;
|
||||
import org.apache.cassandra.locator.EndpointSnitchInfo;
|
||||
import org.apache.cassandra.locator.IEndpointSnitch;
|
||||
import org.apache.cassandra.locator.LocalStrategy;
|
||||
import org.apache.cassandra.scheduler.IRequestScheduler;
|
||||
import org.apache.cassandra.scheduler.NoScheduler;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yaml.snakeyaml.Loader;
|
||||
import org.yaml.snakeyaml.TypeDescription;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
|
@ -574,13 +591,13 @@ public class DatabaseDescriptor
|
|||
throw new ConfigurationException("memtable_operations_in_millions must be a positive double");
|
||||
}
|
||||
|
||||
Map<byte[], ColumnDefinition> metadata = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
|
||||
Map<ByteBuffer, ColumnDefinition> metadata = new TreeMap<ByteBuffer, ColumnDefinition>();
|
||||
|
||||
for (RawColumnDefinition rcd : cf.column_metadata)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] columnName = rcd.name.getBytes("UTF-8");
|
||||
ByteBuffer columnName = ByteBuffer.wrap(rcd.name.getBytes("UTF-8"));
|
||||
metadata.put(columnName, new ColumnDefinition(columnName, rcd.validator_class, rcd.index_type, rcd.index_name));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
|
|
@ -1069,7 +1086,7 @@ public class DatabaseDescriptor
|
|||
return conf.hinted_handoff_enabled;
|
||||
}
|
||||
|
||||
public static AbstractType getValueValidator(String keyspace, String cf, byte[] column)
|
||||
public static AbstractType getValueValidator(String keyspace, String cf, ByteBuffer column)
|
||||
{
|
||||
return getCFMetaData(keyspace, cf).getValueValidator(column);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@
|
|||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
|
@ -27,16 +31,15 @@ import java.util.concurrent.locks.Condition;
|
|||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.io.sstable.SSTableWriter;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.sstable.SSTableWriter;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.WrappedRunnable;
|
||||
import org.cliffc.high_scale_lib.NonBlockingHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class BinaryMemtable implements IFlushable
|
||||
{
|
||||
|
|
@ -46,7 +49,7 @@ public class BinaryMemtable implements IFlushable
|
|||
|
||||
/* Table and ColumnFamily name are used to determine the ColumnFamilyStore */
|
||||
private boolean isFrozen = false;
|
||||
private final Map<DecoratedKey, byte[]> columnFamilies = new NonBlockingHashMap<DecoratedKey, byte[]>();
|
||||
private final Map<DecoratedKey, ByteBuffer> columnFamilies = new NonBlockingHashMap<DecoratedKey, ByteBuffer>();
|
||||
/* Lock and Condition for notifying new clients about Memtable switches */
|
||||
private final Lock lock = new ReentrantLock();
|
||||
Condition condition;
|
||||
|
|
@ -69,7 +72,7 @@ public class BinaryMemtable implements IFlushable
|
|||
* the memtable. This version will respect the threshold and flush
|
||||
* the memtable to disk when the size exceeds the threshold.
|
||||
*/
|
||||
void put(DecoratedKey key, byte[] buffer)
|
||||
void put(DecoratedKey key, ByteBuffer buffer)
|
||||
{
|
||||
if (isThresholdViolated())
|
||||
{
|
||||
|
|
@ -103,10 +106,10 @@ public class BinaryMemtable implements IFlushable
|
|||
return columnFamilies.isEmpty();
|
||||
}
|
||||
|
||||
private void resolve(DecoratedKey key, byte[] buffer)
|
||||
private void resolve(DecoratedKey key, ByteBuffer buffer)
|
||||
{
|
||||
columnFamilies.put(key, buffer);
|
||||
currentSize.addAndGet(buffer.length + key.key.length);
|
||||
currentSize.addAndGet(buffer.remaining() + key.key.remaining());
|
||||
}
|
||||
|
||||
private List<DecoratedKey> getSortedKeys()
|
||||
|
|
@ -126,8 +129,8 @@ public class BinaryMemtable implements IFlushable
|
|||
|
||||
for (DecoratedKey key : sortedKeys)
|
||||
{
|
||||
byte[] bytes = columnFamilies.get(key);
|
||||
assert bytes.length > 0;
|
||||
ByteBuffer bytes = columnFamilies.get(key);
|
||||
assert bytes.remaining() > 0;
|
||||
writer.append(key, bytes);
|
||||
}
|
||||
SSTableReader sstable = writer.closeAndOpenReader();
|
||||
|
|
|
|||
|
|
@ -18,18 +18,17 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.security.MessageDigest;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -47,41 +46,41 @@ public class Column implements IColumn
|
|||
return new ColumnSerializer();
|
||||
}
|
||||
|
||||
protected final byte[] name;
|
||||
protected final byte[] value;
|
||||
protected final ByteBuffer name;
|
||||
protected final ByteBuffer value;
|
||||
protected final long timestamp;
|
||||
|
||||
Column(byte[] name)
|
||||
Column(ByteBuffer name)
|
||||
{
|
||||
this(name, ArrayUtils.EMPTY_BYTE_ARRAY);
|
||||
this(name, FBUtilities.EMPTY_BYTE_BUFFER);
|
||||
}
|
||||
|
||||
public Column(byte[] name, byte[] value)
|
||||
public Column(ByteBuffer name, ByteBuffer value)
|
||||
{
|
||||
this(name, value, 0);
|
||||
}
|
||||
|
||||
public Column(byte[] name, byte[] value, long timestamp)
|
||||
public Column(ByteBuffer name, ByteBuffer value, long timestamp)
|
||||
{
|
||||
assert name != null;
|
||||
assert value != null;
|
||||
assert name.length <= IColumn.MAX_NAME_LENGTH;
|
||||
assert name.remaining() <= IColumn.MAX_NAME_LENGTH;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public byte[] name()
|
||||
public ByteBuffer name()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public Column getSubColumn(byte[] columnName)
|
||||
public Column getSubColumn(ByteBuffer columnName)
|
||||
{
|
||||
throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
|
||||
}
|
||||
|
||||
public byte[] value()
|
||||
public ByteBuffer value()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
|
@ -121,7 +120,7 @@ public class Column implements IColumn
|
|||
* + 4 bytes which basically indicates the size of the byte array
|
||||
* + entire byte array.
|
||||
*/
|
||||
return DBConstants.shortSize_ + name.length + DBConstants.boolSize_ + DBConstants.tsSize_ + DBConstants.intSize_ + value.length;
|
||||
return DBConstants.shortSize_ + name.remaining() + DBConstants.boolSize_ + DBConstants.tsSize_ + DBConstants.intSize_ + value.remaining();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -149,8 +148,9 @@ public class Column implements IColumn
|
|||
|
||||
public void updateDigest(MessageDigest digest)
|
||||
{
|
||||
digest.update(name);
|
||||
digest.update(value);
|
||||
digest.update(name.array(),name.position()+name.arrayOffset(),name.remaining());
|
||||
digest.update(value.array(),value.position()+name.arrayOffset(),value.remaining());
|
||||
|
||||
DataOutputBuffer buffer = new DataOutputBuffer();
|
||||
try
|
||||
{
|
||||
|
|
@ -178,7 +178,7 @@ public class Column implements IColumn
|
|||
return timestamp() > column.timestamp() ? this : column;
|
||||
// break ties by comparing values.
|
||||
if (timestamp() == column.timestamp())
|
||||
return FBUtilities.compareByteArrays(value(), column.value()) < 0 ? column : this;
|
||||
return value().compareTo(column.value()) < 0 ? column : this;
|
||||
// neither is tombstoned and timestamps are different
|
||||
return timestamp() < column.timestamp() ? column : this;
|
||||
}
|
||||
|
|
@ -195,17 +195,17 @@ public class Column implements IColumn
|
|||
|
||||
if (timestamp != column.timestamp)
|
||||
return false;
|
||||
if (!Arrays.equals(name, column.name))
|
||||
if (!name.equals(column.name))
|
||||
return false;
|
||||
|
||||
return Arrays.equals(value, column.value);
|
||||
return value.equals(column.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = name != null ? Arrays.hashCode(name) : 0;
|
||||
result = 31 * result + (value != null ? Arrays.hashCode(value) : 0);
|
||||
int result = name != null ? name.hashCode() : 0;
|
||||
result = 31 * result + (value != null ? value.hashCode() : 0);
|
||||
result = 31 * result + (int)(timestamp ^ (timestamp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ public class Column implements IColumn
|
|||
sb.append(":");
|
||||
sb.append(isMarkedForDelete());
|
||||
sb.append(":");
|
||||
sb.append(value.length);
|
||||
sb.append(value.remaining());
|
||||
sb.append("@");
|
||||
sb.append(timestamp());
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -18,21 +18,23 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.dht.BytesToken;
|
||||
import org.apache.cassandra.dht.LocalPartitioner;
|
||||
import org.apache.cassandra.io.ICompactSerializer2;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.ICompactSerializer2;
|
||||
import org.apache.cassandra.io.util.IIterableColumns;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -72,13 +74,13 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
private transient ICompactSerializer2<IColumn> columnSerializer;
|
||||
final AtomicLong markedForDeleteAt = new AtomicLong(Long.MIN_VALUE);
|
||||
final AtomicInteger localDeletionTime = new AtomicInteger(Integer.MIN_VALUE);
|
||||
private ConcurrentSkipListMap<byte[], IColumn> columns;
|
||||
|
||||
private ConcurrentSkipListMap<ByteBuffer, IColumn> columns;
|
||||
|
||||
public ColumnFamily(ColumnFamilyType type, AbstractType comparator, AbstractType subcolumnComparator, Integer cfid)
|
||||
{
|
||||
this.type = type;
|
||||
columnSerializer = type == ColumnFamilyType.Standard ? Column.serializer() : SuperColumn.serializer(subcolumnComparator);
|
||||
columns = new ConcurrentSkipListMap<byte[], IColumn>(comparator);
|
||||
columns = new ConcurrentSkipListMap<ByteBuffer, IColumn>(comparator);
|
||||
this.cfid = cfid;
|
||||
}
|
||||
|
||||
|
|
@ -151,13 +153,13 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
return type == ColumnFamilyType.Super;
|
||||
}
|
||||
|
||||
public void addColumn(QueryPath path, byte[] value, long timestamp)
|
||||
public void addColumn(QueryPath path, ByteBuffer value, long timestamp)
|
||||
{
|
||||
assert path.columnName != null : path;
|
||||
addColumn(path.superColumnName, new Column(path.columnName, value, timestamp));
|
||||
}
|
||||
|
||||
public void addColumn(QueryPath path, byte[] value, long timestamp, int timeToLive)
|
||||
public void addColumn(QueryPath path, ByteBuffer value, long timestamp, int timeToLive)
|
||||
{
|
||||
assert path.columnName != null : path;
|
||||
Column column;
|
||||
|
|
@ -168,7 +170,7 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
addColumn(path.superColumnName, column);
|
||||
}
|
||||
|
||||
public void addTombstone(QueryPath path, byte[] localDeletionTime, long timestamp)
|
||||
public void addTombstone(QueryPath path, ByteBuffer localDeletionTime, long timestamp)
|
||||
{
|
||||
assert path.columnName != null : path;
|
||||
addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, timestamp));
|
||||
|
|
@ -180,12 +182,12 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, timestamp));
|
||||
}
|
||||
|
||||
public void addTombstone(byte[] name, int localDeletionTime, long timestamp)
|
||||
public void addTombstone(ByteBuffer name, int localDeletionTime, long timestamp)
|
||||
{
|
||||
addColumn(null, new DeletedColumn(name, localDeletionTime, timestamp));
|
||||
}
|
||||
|
||||
public void addColumn(byte[] superColumnName, Column column)
|
||||
public void addColumn(ByteBuffer superColumnName, Column column)
|
||||
{
|
||||
IColumn c;
|
||||
if (superColumnName == null)
|
||||
|
|
@ -212,7 +214,7 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
*/
|
||||
public void addColumn(IColumn column)
|
||||
{
|
||||
byte[] name = column.name();
|
||||
ByteBuffer name = column.name();
|
||||
IColumn oldColumn = columns.putIfAbsent(name, column);
|
||||
if (oldColumn != null)
|
||||
{
|
||||
|
|
@ -236,12 +238,12 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
}
|
||||
}
|
||||
|
||||
public IColumn getColumn(byte[] name)
|
||||
public IColumn getColumn(ByteBuffer name)
|
||||
{
|
||||
return columns.get(name);
|
||||
}
|
||||
|
||||
public SortedSet<byte[]> getColumnNames()
|
||||
public SortedSet<ByteBuffer> getColumnNames()
|
||||
{
|
||||
return columns.keySet();
|
||||
}
|
||||
|
|
@ -256,12 +258,12 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
return columns.descendingMap().values();
|
||||
}
|
||||
|
||||
public Map<byte[], IColumn> getColumnsMap()
|
||||
public Map<ByteBuffer, IColumn> getColumnsMap()
|
||||
{
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void remove(byte[] columnName)
|
||||
public void remove(ByteBuffer columnName)
|
||||
{
|
||||
columns.remove(columnName);
|
||||
}
|
||||
|
|
@ -299,9 +301,9 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
// (don't need to worry about cfNew containing IColumns that are shadowed by
|
||||
// the delete tombstone, since cfNew was generated by CF.resolve, which
|
||||
// takes care of those for us.)
|
||||
Map<byte[], IColumn> columns = cfComposite.getColumnsMap();
|
||||
Set<byte[]> cNames = columns.keySet();
|
||||
for (byte[] cName : cNames)
|
||||
Map<ByteBuffer, IColumn> columns = cfComposite.getColumnsMap();
|
||||
Set<ByteBuffer> cNames = columns.keySet();
|
||||
for (ByteBuffer cName : cNames)
|
||||
{
|
||||
IColumn columnInternal = this.columns.get(cName);
|
||||
IColumn columnExternal = columns.get(cName);
|
||||
|
|
@ -362,7 +364,7 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public static byte[] digest(ColumnFamily cf)
|
||||
public static ByteBuffer digest(ColumnFamily cf)
|
||||
{
|
||||
MessageDigest digest;
|
||||
try
|
||||
|
|
@ -376,7 +378,7 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
if (cf != null)
|
||||
cf.updateDigest(digest);
|
||||
|
||||
return digest.digest();
|
||||
return ByteBuffer.wrap(digest.digest());
|
||||
}
|
||||
|
||||
public void updateDigest(MessageDigest digest)
|
||||
|
|
@ -395,7 +397,7 @@ public class ColumnFamily implements IColumnContainer, IIterableColumns
|
|||
return localDeletionTime.get();
|
||||
}
|
||||
|
||||
public static AbstractType getComparatorFor(String table, String columnFamilyName, byte[] superColumnName)
|
||||
public static AbstractType getComparatorFor(String table, String columnFamilyName, ByteBuffer superColumnName)
|
||||
{
|
||||
return superColumnName == null
|
||||
? DatabaseDescriptor.getComparator(table, columnFamilyName)
|
||||
|
|
|
|||
|
|
@ -18,22 +18,46 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
|
||||
import org.apache.cassandra.concurrent.NamedThreadFactory;
|
||||
import org.apache.cassandra.concurrent.RetryingScheduledThreadPoolExecutor;
|
||||
|
|
@ -45,22 +69,46 @@ import org.apache.cassandra.db.columniterator.IColumnIterator;
|
|||
import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
|
||||
import org.apache.cassandra.db.commitlog.CommitLog;
|
||||
import org.apache.cassandra.db.commitlog.CommitLogSegment;
|
||||
import org.apache.cassandra.db.filter.*;
|
||||
import org.apache.cassandra.db.filter.IFilter;
|
||||
import org.apache.cassandra.db.filter.NamesQueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.db.filter.SliceQueryFilter;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.db.marshal.BytesType;
|
||||
import org.apache.cassandra.db.marshal.LocalByPartionerType;
|
||||
import org.apache.cassandra.dht.*;
|
||||
import org.apache.cassandra.io.sstable.*;
|
||||
import org.apache.cassandra.dht.AbstractBounds;
|
||||
import org.apache.cassandra.dht.Bounds;
|
||||
import org.apache.cassandra.dht.ByteOrderedPartitioner;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.dht.LocalPartitioner;
|
||||
import org.apache.cassandra.dht.LocalToken;
|
||||
import org.apache.cassandra.dht.OrderPreservingPartitioner;
|
||||
import org.apache.cassandra.dht.Range;
|
||||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.io.sstable.Component;
|
||||
import org.apache.cassandra.io.sstable.Descriptor;
|
||||
import org.apache.cassandra.io.sstable.ReducingKeyIterator;
|
||||
import org.apache.cassandra.io.sstable.SSTable;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.sstable.SSTableTracker;
|
||||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.thrift.IndexClause;
|
||||
import org.apache.cassandra.thrift.IndexExpression;
|
||||
import org.apache.cassandra.thrift.IndexOperator;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.EstimatedHistogram;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.LatencyTracker;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
import org.apache.cassandra.utils.WrappedRunnable;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
||||
{
|
||||
|
|
@ -117,7 +165,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
/* active memtable associated with this ColumnFamilyStore. */
|
||||
private Memtable memtable;
|
||||
|
||||
private final SortedMap<byte[], ColumnFamilyStore> indexedColumns;
|
||||
private final SortedMap<ByteBuffer, ColumnFamilyStore> indexedColumns;
|
||||
|
||||
// TODO binarymemtable ops are not threadsafe (do they need to be?)
|
||||
private AtomicReference<BinaryMemtable> binaryMemtable;
|
||||
|
|
@ -197,7 +245,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
ssTables.add(sstables);
|
||||
|
||||
// create the private ColumnFamilyStores for the secondary column indexes
|
||||
indexedColumns = new ConcurrentSkipListMap<byte[], ColumnFamilyStore>(getComparator());
|
||||
indexedColumns = new ConcurrentSkipListMap<ByteBuffer, ColumnFamilyStore>(getComparator());
|
||||
for (ColumnDefinition info : metadata.column_metadata.values())
|
||||
{
|
||||
if (info.index_type != null)
|
||||
|
|
@ -236,7 +284,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
int size = in.readInt();
|
||||
byte[] bytes = new byte[size];
|
||||
in.readFully(bytes);
|
||||
keys.add(StorageService.getPartitioner().decorateKey(bytes));
|
||||
keys.add(StorageService.getPartitioner().decorateKey(ByteBuffer.wrap(bytes)));
|
||||
}
|
||||
in.close();
|
||||
if (logger.isDebugEnabled())
|
||||
|
|
@ -287,7 +335,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
}
|
||||
}
|
||||
|
||||
public void buildSecondaryIndexes(Collection<SSTableReader> sstables, SortedSet<byte[]> columns)
|
||||
public void buildSecondaryIndexes(Collection<SSTableReader> sstables, SortedSet<ByteBuffer> columns)
|
||||
{
|
||||
logger.debug("Submitting index build to compactionmanager");
|
||||
Table.IndexBuilder builder = table.createIndexBuilder(this, columns, new ReducingKeyIterator(sstables));
|
||||
|
|
@ -295,7 +343,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
try
|
||||
{
|
||||
future.get();
|
||||
for (byte[] column : columns)
|
||||
for (ByteBuffer column : columns)
|
||||
getIndexedColumnFamilyStore(column).forceBlockingFlush();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
|
|
@ -621,7 +669,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
}
|
||||
}
|
||||
|
||||
void switchBinaryMemtable(DecoratedKey key, byte[] buffer)
|
||||
void switchBinaryMemtable(DecoratedKey key, ByteBuffer buffer)
|
||||
{
|
||||
binaryMemtable.set(new BinaryMemtable(this));
|
||||
binaryMemtable.get().put(key, buffer);
|
||||
|
|
@ -682,7 +730,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
* needs to be used. param @ key - key for update/insert param @
|
||||
* columnFamily - columnFamily changes
|
||||
*/
|
||||
void applyBinary(DecoratedKey key, byte[] buffer)
|
||||
void applyBinary(DecoratedKey key, ByteBuffer buffer)
|
||||
{
|
||||
long start = System.nanoTime();
|
||||
binaryMemtable.get().put(key, buffer);
|
||||
|
|
@ -725,9 +773,9 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
|
||||
private static void removeDeletedStandard(ColumnFamily cf, int gcBefore)
|
||||
{
|
||||
for (Map.Entry<byte[], IColumn> entry : cf.getColumnsMap().entrySet())
|
||||
for (Map.Entry<ByteBuffer, IColumn> entry : cf.getColumnsMap().entrySet())
|
||||
{
|
||||
byte[] cname = entry.getKey();
|
||||
ByteBuffer cname = entry.getKey();
|
||||
IColumn c = entry.getValue();
|
||||
// remove columns if
|
||||
// (a) the column itself is tombstoned or
|
||||
|
|
@ -746,7 +794,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
// TODO assume deletion means "most are deleted?" and add to clone, instead of remove from original?
|
||||
// this could be improved by having compaction, or possibly even removeDeleted, r/m the tombstone
|
||||
// once gcBefore has passed, so if new stuff is added in it doesn't used the wrong algorithm forever
|
||||
for (Map.Entry<byte[], IColumn> entry : cf.getColumnsMap().entrySet())
|
||||
for (Map.Entry<ByteBuffer, IColumn> entry : cf.getColumnsMap().entrySet())
|
||||
{
|
||||
SuperColumn c = (SuperColumn) entry.getValue();
|
||||
long minTimestamp = Math.max(c.getMarkedForDeleteAt(), cf.getMarkedForDeleteAt());
|
||||
|
|
@ -988,7 +1036,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
return writeStats.getRecentLatencyHistogramMicros();
|
||||
}
|
||||
|
||||
public ColumnFamily getColumnFamily(DecoratedKey key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int limit)
|
||||
public ColumnFamily getColumnFamily(DecoratedKey key, QueryPath path, ByteBuffer start, ByteBuffer finish, boolean reversed, int limit)
|
||||
{
|
||||
return getColumnFamily(QueryFilter.getSliceFilter(key, path, start, finish, reversed, limit));
|
||||
}
|
||||
|
|
@ -1031,6 +1079,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
if (ssTables.getRowCache().getCapacity() == 0)
|
||||
{
|
||||
ColumnFamily cf = getTopLevelColumns(filter, gcBefore);
|
||||
|
||||
// TODO this is necessary because when we collate supercolumns together, we don't check
|
||||
// their subcolumns for relevance, so we need to do a second prune post facto here.
|
||||
return cf.isSuper() ? removeDeleted(cf, gcBefore) : removeDeletedCF(cf, gcBefore);
|
||||
|
|
@ -1039,7 +1088,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
ColumnFamily cached = cacheRow(filter.key);
|
||||
if (cached == null)
|
||||
return null;
|
||||
|
||||
|
||||
return filterColumnFamily(cached, filter, gcBefore);
|
||||
}
|
||||
finally
|
||||
|
|
@ -1062,7 +1111,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
if (filter.filter instanceof SliceQueryFilter)
|
||||
{
|
||||
SliceQueryFilter sliceFilter = (SliceQueryFilter) filter.filter;
|
||||
if (sliceFilter.start.length == 0 && sliceFilter.finish.length == 0)
|
||||
if (sliceFilter.start.remaining() == 0 && sliceFilter.finish.remaining() == 0)
|
||||
{
|
||||
if (cached.isSuper() && filter.path.superColumnName != null)
|
||||
{
|
||||
|
|
@ -1081,7 +1130,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
// top-level columns
|
||||
if (sliceFilter.count >= cached.getColumnCount())
|
||||
{
|
||||
removeDeletedColumnsOnly(cached, gcBefore);
|
||||
removeDeletedColumnsOnly(cached, gcBefore);
|
||||
return removeDeletedCF(cached, gcBefore);
|
||||
}
|
||||
}
|
||||
|
|
@ -1118,6 +1167,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
if (iter != null)
|
||||
{
|
||||
returnCF.delete(iter.getColumnFamily());
|
||||
|
||||
iterators.add(iter);
|
||||
}
|
||||
|
||||
|
|
@ -1149,7 +1199,11 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
|
||||
Comparator<IColumn> comparator = filter.filter.getColumnComparator(getComparator());
|
||||
Iterator collated = IteratorUtils.collatedIterator(comparator, iterators);
|
||||
|
||||
|
||||
filter.collectCollatedColumns(returnCF, collated, gcBefore);
|
||||
|
||||
|
||||
// Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
|
||||
// we need to distinguish between "there is no data at all for this row" (BF will let us rebuild that efficiently)
|
||||
// and "there used to be data, but it's gone now" (we should cache the empty CF so we don't need to rebuild that slower)
|
||||
|
|
@ -1185,7 +1239,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
* @param columnFilter description of the columns we're interested in for each row
|
||||
* @return true if we found all keys we were looking for, otherwise false
|
||||
*/
|
||||
public List<Row> getRangeSlice(byte[] superColumn, final AbstractBounds range, int maxResults, IFilter columnFilter)
|
||||
public List<Row> getRangeSlice(ByteBuffer superColumn, final AbstractBounds range, int maxResults, IFilter columnFilter)
|
||||
throws ExecutionException, InterruptedException
|
||||
{
|
||||
assert range instanceof Bounds
|
||||
|
|
@ -1193,8 +1247,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
: range;
|
||||
|
||||
List<Row> rows = new ArrayList<Row>();
|
||||
DecoratedKey startWith = new DecoratedKey(range.left, (byte[])null);
|
||||
DecoratedKey stopAt = new DecoratedKey(range.right, (byte[])null);
|
||||
DecoratedKey startWith = new DecoratedKey(range.left, null);
|
||||
DecoratedKey stopAt = new DecoratedKey(range.right, null);
|
||||
|
||||
QueryFilter filter = new QueryFilter(null, new QueryPath(columnFamily, superColumn, null), columnFilter);
|
||||
Collection<Memtable> memtables = new ArrayList<Memtable>();
|
||||
|
|
@ -1268,14 +1322,14 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
// otherwise, create an extraFilter to fetch by name the columns referenced by the additional expressions.
|
||||
if (getMaxRowSize() < DatabaseDescriptor.getColumnIndexSize())
|
||||
{
|
||||
firstFilter = new SliceQueryFilter(ArrayUtils.EMPTY_BYTE_ARRAY,
|
||||
ArrayUtils.EMPTY_BYTE_ARRAY,
|
||||
firstFilter = new SliceQueryFilter(FBUtilities.EMPTY_BYTE_BUFFER,
|
||||
FBUtilities.EMPTY_BYTE_BUFFER,
|
||||
((SliceQueryFilter) dataFilter).reversed,
|
||||
Integer.MAX_VALUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SortedSet<byte[]> columns = new TreeSet<byte[]>(getComparator());
|
||||
SortedSet<ByteBuffer> columns = new TreeSet<ByteBuffer>(getComparator());
|
||||
for (IndexExpression expr : clause.expressions)
|
||||
{
|
||||
if (expr == primary)
|
||||
|
|
@ -1289,7 +1343,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
{
|
||||
// just add in columns that are not part of the resultset
|
||||
assert dataFilter instanceof NamesQueryFilter;
|
||||
SortedSet<byte[]> columns = new TreeSet<byte[]>(getComparator());
|
||||
SortedSet<ByteBuffer> columns = new TreeSet<ByteBuffer>(getComparator());
|
||||
for (IndexExpression expr : clause.expressions)
|
||||
{
|
||||
if (expr == primary || ((NamesQueryFilter) dataFilter).columns.contains(expr.column_name))
|
||||
|
|
@ -1305,7 +1359,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
}
|
||||
|
||||
List<Row> rows = new ArrayList<Row>();
|
||||
byte[] startKey = clause.start_key;
|
||||
ByteBuffer startKey = clause.start_key;
|
||||
QueryPath path = new QueryPath(columnFamily);
|
||||
|
||||
// fetch row keys matching the primary expression, fetch the slice predicate for each
|
||||
|
|
@ -1320,14 +1374,14 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
QueryFilter indexFilter = QueryFilter.getSliceFilter(indexKey,
|
||||
new QueryPath(indexCFS.getColumnFamilyName()),
|
||||
startKey,
|
||||
ArrayUtils.EMPTY_BYTE_ARRAY,
|
||||
FBUtilities.EMPTY_BYTE_BUFFER,
|
||||
false,
|
||||
clause.count);
|
||||
ColumnFamily indexRow = indexCFS.getColumnFamily(indexFilter);
|
||||
if (indexRow == null)
|
||||
break;
|
||||
|
||||
byte[] dataKey = null;
|
||||
ByteBuffer dataKey = null;
|
||||
int n = 0;
|
||||
for (IColumn column : indexRow.getSortedColumns())
|
||||
{
|
||||
|
|
@ -1375,7 +1429,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
if (rows.size() == clause.count)
|
||||
break outer;
|
||||
}
|
||||
if (n < clause.count || Arrays.equals(startKey, dataKey))
|
||||
if (n < clause.count || ByteBufferUtil.equals(startKey, dataKey))
|
||||
break;
|
||||
startKey = dataKey;
|
||||
}
|
||||
|
|
@ -1743,22 +1797,22 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
return (double) falseCount / (trueCount + falseCount);
|
||||
}
|
||||
|
||||
public SortedSet<byte[]> getIndexedColumns()
|
||||
public SortedSet<ByteBuffer> getIndexedColumns()
|
||||
{
|
||||
return (SortedSet<byte[]>) indexedColumns.keySet();
|
||||
return (SortedSet<ByteBuffer>) indexedColumns.keySet();
|
||||
}
|
||||
|
||||
public ColumnFamilyStore getIndexedColumnFamilyStore(byte[] column)
|
||||
public ColumnFamilyStore getIndexedColumnFamilyStore(ByteBuffer column)
|
||||
{
|
||||
return indexedColumns.get(column);
|
||||
}
|
||||
|
||||
public ColumnFamily newIndexedColumnFamily(byte[] column)
|
||||
public ColumnFamily newIndexedColumnFamily(ByteBuffer column)
|
||||
{
|
||||
return ColumnFamily.create(indexedColumns.get(column).metadata);
|
||||
}
|
||||
|
||||
public DecoratedKey<LocalToken> getIndexKeyFor(byte[] name, byte[] value)
|
||||
public DecoratedKey<LocalToken> getIndexKeyFor(ByteBuffer name, ByteBuffer value)
|
||||
{
|
||||
return indexedColumns.get(name).partitioner.decorateKey(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,21 +56,22 @@ public class ColumnSerializer implements ICompactSerializer2<IColumn>
|
|||
|
||||
public Column deserialize(DataInput dis) throws IOException
|
||||
{
|
||||
byte[] name = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer name = FBUtilities.readShortByteArray(dis);
|
||||
int b = dis.readUnsignedByte();
|
||||
if ((b & EXPIRATION_MASK) != 0)
|
||||
{
|
||||
int ttl = dis.readInt();
|
||||
int expiration = dis.readInt();
|
||||
long ts = dis.readLong();
|
||||
byte[] value = FBUtilities.readByteArray(dis);
|
||||
ByteBuffer value = FBUtilities.readByteArray(dis);
|
||||
if ((int) (System.currentTimeMillis() / 1000 ) > expiration)
|
||||
{
|
||||
// the column is now expired, we can safely return a simple
|
||||
// tombstone
|
||||
ByteBuffer bytes = ByteBuffer.allocate(4);
|
||||
bytes.putInt(expiration);
|
||||
return new DeletedColumn(name, bytes.array(), ts);
|
||||
bytes.rewind();
|
||||
return new DeletedColumn(name, bytes, ts);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -81,7 +82,7 @@ public class ColumnSerializer implements ICompactSerializer2<IColumn>
|
|||
{
|
||||
boolean delete = (b & DELETION_MASK) != 0;
|
||||
long ts = dis.readLong();
|
||||
byte[] value = FBUtilities.readByteArray(dis);
|
||||
ByteBuffer value = FBUtilities.readByteArray(dis);
|
||||
if ((b & DELETION_MASK) != 0) {
|
||||
return new DeletedColumn(name, value, ts);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
|
|
@ -47,9 +48,9 @@ public class DecoratedKey<T extends Token> implements Comparable<DecoratedKey>
|
|||
};
|
||||
|
||||
public final T token;
|
||||
public final byte[] key;
|
||||
public final ByteBuffer key;
|
||||
|
||||
public DecoratedKey(T token, byte[] key)
|
||||
public DecoratedKey(T token, ByteBuffer key)
|
||||
{
|
||||
super();
|
||||
assert token != null;
|
||||
|
|
|
|||
|
|
@ -18,42 +18,39 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import org.apache.avro.Schema;
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.config.KSMetaData;
|
||||
import org.apache.cassandra.db.commitlog.CommitLog;
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.db.filter.SliceQueryFilter;
|
||||
import org.apache.cassandra.db.migration.Migration;
|
||||
import org.apache.cassandra.io.SerDeUtils;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.UUIDGen;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
import org.apache.avro.Schema;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.config.KSMetaData;
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.db.migration.Migration;
|
||||
import org.apache.cassandra.io.SerDeUtils;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.UUIDGen;
|
||||
|
||||
public class DefsTable
|
||||
{
|
||||
// column name for the schema storing serialized keyspace definitions
|
||||
// NB: must be an invalid keyspace name
|
||||
public static final byte[] DEFINITION_SCHEMA_COLUMN_NAME = "Avro/Schema".getBytes(UTF_8);
|
||||
public static final ByteBuffer DEFINITION_SCHEMA_COLUMN_NAME = ByteBuffer.wrap("Avro/Schema".getBytes(UTF_8));
|
||||
|
||||
/** dumps current keyspace definitions to storage */
|
||||
public static synchronized void dumpToStorage(UUID version) throws IOException
|
||||
{
|
||||
final byte[] versionKey = Migration.toUTF8Bytes(version);
|
||||
final ByteBuffer versionKey = Migration.toUTF8Bytes(version);
|
||||
|
||||
// build a list of keyspaces
|
||||
Collection<String> ksnames = DatabaseDescriptor.getNonSystemTables();
|
||||
|
|
@ -64,20 +61,20 @@ public class DefsTable
|
|||
for (String ksname : ksnames)
|
||||
{
|
||||
KSMetaData ksm = DatabaseDescriptor.getTableDefinition(ksname);
|
||||
rm.add(new QueryPath(Migration.SCHEMA_CF, null, ksm.name.getBytes(UTF_8)), SerDeUtils.serialize(ksm.deflate()), now);
|
||||
rm.add(new QueryPath(Migration.SCHEMA_CF, null, ByteBuffer.wrap(ksm.name.getBytes(UTF_8))), SerDeUtils.serialize(ksm.deflate()), now);
|
||||
}
|
||||
// add the schema
|
||||
rm.add(new QueryPath(Migration.SCHEMA_CF,
|
||||
null,
|
||||
DEFINITION_SCHEMA_COLUMN_NAME),
|
||||
org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
|
||||
ByteBuffer.wrap(org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
|
||||
now);
|
||||
rm.apply();
|
||||
|
||||
// apply new version
|
||||
rm = new RowMutation(Table.SYSTEM_TABLE, Migration.LAST_MIGRATION_KEY);
|
||||
rm.add(new QueryPath(Migration.SCHEMA_CF, null, Migration.LAST_MIGRATION_KEY),
|
||||
UUIDGen.decompose(version),
|
||||
ByteBuffer.wrap(UUIDGen.decompose(version)),
|
||||
now);
|
||||
rm.apply();
|
||||
}
|
||||
|
|
@ -94,13 +91,13 @@ public class DefsTable
|
|||
if (avroschema == null)
|
||||
// TODO: more polite way to handle this?
|
||||
throw new RuntimeException("Cannot read system table! Are you upgrading a pre-release version?");
|
||||
Schema schema = Schema.parse(new String(avroschema.value()));
|
||||
Schema schema = Schema.parse(new String(avroschema.value().array(),avroschema.value().position()+avroschema.value().arrayOffset(),avroschema.value().remaining()));
|
||||
|
||||
// deserialize keyspaces using schema
|
||||
Collection<KSMetaData> keyspaces = new ArrayList<KSMetaData>();
|
||||
for (IColumn column : cf.getSortedColumns())
|
||||
{
|
||||
if (Arrays.equals(column.name(), DEFINITION_SCHEMA_COLUMN_NAME))
|
||||
if (column.name().equals(DEFINITION_SCHEMA_COLUMN_NAME))
|
||||
continue;
|
||||
org.apache.cassandra.avro.KsDef ks = SerDeUtils.deserialize(schema, column.value(), new org.apache.cassandra.avro.KsDef());
|
||||
keyspaces.add(KSMetaData.inflate(ks));
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.cassandra.db;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -28,12 +29,12 @@ public class DeletedColumn extends Column
|
|||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(DeletedColumn.class);
|
||||
|
||||
public DeletedColumn(byte[] name, int localDeletionTime, long timestamp)
|
||||
public DeletedColumn(ByteBuffer name, int localDeletionTime, long timestamp)
|
||||
{
|
||||
this(name, FBUtilities.toByteArray(localDeletionTime), timestamp);
|
||||
}
|
||||
|
||||
public DeletedColumn(byte[] name, byte[] value, long timestamp)
|
||||
public DeletedColumn(ByteBuffer name, ByteBuffer value, long timestamp)
|
||||
{
|
||||
super(name, value, timestamp);
|
||||
}
|
||||
|
|
@ -53,6 +54,6 @@ public class DeletedColumn extends Column
|
|||
@Override
|
||||
public int getLocalDeletionTime()
|
||||
{
|
||||
return ByteBuffer.wrap(value()).getInt();
|
||||
return value.getInt(value.position()+value.arrayOffset() );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Alternative to Column that have an expiring time.
|
||||
|
|
@ -43,12 +43,12 @@ public class ExpiringColumn extends Column
|
|||
private final int localExpirationTime;
|
||||
private final int timeToLive;
|
||||
|
||||
public ExpiringColumn(byte[] name, byte[] value, long timestamp, int timeToLive)
|
||||
public ExpiringColumn(ByteBuffer name, ByteBuffer value, long timestamp, int timeToLive)
|
||||
{
|
||||
this(name, value, timestamp, timeToLive, (int) (System.currentTimeMillis() / 1000) + timeToLive);
|
||||
}
|
||||
|
||||
public ExpiringColumn(byte[] name, byte[] value, long timestamp, int timeToLive, int localExpirationTime)
|
||||
public ExpiringColumn(ByteBuffer name, ByteBuffer value, long timestamp, int timeToLive, int localExpirationTime)
|
||||
{
|
||||
super(name, value, timestamp);
|
||||
assert timeToLive > 0;
|
||||
|
|
|
|||
|
|
@ -18,18 +18,16 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
|
|
@ -43,8 +41,12 @@ import org.apache.cassandra.service.IWriteResponseHandler;
|
|||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.service.WriteResponseHandler;
|
||||
import org.apache.cassandra.thrift.InvalidRequestException;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.WrappedRunnable;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.cliffc.high_scale_lib.NonBlockingHashSet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -87,7 +89,7 @@ public class HintedHandOffManager
|
|||
|
||||
private final ExecutorService executor_ = new JMXEnabledThreadPoolExecutor("HintedHandoff", DatabaseDescriptor.getCompactionThreadPriority());
|
||||
|
||||
private static boolean sendMessage(InetAddress endpoint, String tableName, String cfName, byte[] key) throws IOException
|
||||
private static boolean sendMessage(InetAddress endpoint, String tableName, String cfName, ByteBuffer key) throws IOException
|
||||
{
|
||||
if (!Gossiper.instance.isKnownEndpoint(endpoint))
|
||||
{
|
||||
|
|
@ -102,10 +104,10 @@ public class HintedHandOffManager
|
|||
Table table = Table.open(tableName);
|
||||
DecoratedKey dkey = StorageService.getPartitioner().decorateKey(key);
|
||||
ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
|
||||
byte[] startColumn = ArrayUtils.EMPTY_BYTE_ARRAY;
|
||||
ByteBuffer startColumn = FBUtilities.EMPTY_BYTE_BUFFER;
|
||||
while (true)
|
||||
{
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(dkey, new QueryPath(cfs.getColumnFamilyName()), startColumn, ArrayUtils.EMPTY_BYTE_ARRAY, false, PAGE_SIZE);
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(dkey, new QueryPath(cfs.getColumnFamilyName()), startColumn, FBUtilities.EMPTY_BYTE_BUFFER, false, PAGE_SIZE);
|
||||
ColumnFamily cf = cfs.getColumnFamily(filter);
|
||||
if (pagingFinished(cf, startColumn))
|
||||
break;
|
||||
|
|
@ -133,7 +135,7 @@ public class HintedHandOffManager
|
|||
return true;
|
||||
}
|
||||
|
||||
private static void deleteHintKey(byte[] endpointAddress, byte[] key, byte[] tableCF, long timestamp) throws IOException
|
||||
private static void deleteHintKey(ByteBuffer endpointAddress, ByteBuffer key, ByteBuffer tableCF, long timestamp) throws IOException
|
||||
{
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, endpointAddress);
|
||||
rm.delete(new QueryPath(HINTS_CF, key, tableCF), timestamp);
|
||||
|
|
@ -143,7 +145,7 @@ public class HintedHandOffManager
|
|||
public static void deleteHintsForEndPoint(InetAddress endpoint)
|
||||
{
|
||||
ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, endpoint.getAddress());
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(endpoint.getAddress()));
|
||||
rm.delete(new QueryPath(HINTS_CF), System.currentTimeMillis());
|
||||
try {
|
||||
logger_.info("Deleting any stored hints for " + endpoint);
|
||||
|
|
@ -157,28 +159,28 @@ public class HintedHandOffManager
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean pagingFinished(ColumnFamily hintColumnFamily, byte[] startColumn)
|
||||
private static boolean pagingFinished(ColumnFamily hintColumnFamily, ByteBuffer startColumn)
|
||||
{
|
||||
// done if no hints found or the start column (same as last column processed in previous iteration) is the only one
|
||||
return hintColumnFamily == null
|
||||
|| (hintColumnFamily.getSortedColumns().size() == 1 && hintColumnFamily.getColumn(startColumn) != null);
|
||||
}
|
||||
|
||||
public static byte[] makeCombinedName(String tableName, String columnFamily)
|
||||
public static ByteBuffer makeCombinedName(String tableName, String columnFamily)
|
||||
{
|
||||
byte[] withsep = ArrayUtils.addAll(tableName.getBytes(UTF_8), SEPARATOR.getBytes());
|
||||
return ArrayUtils.addAll(withsep, columnFamily.getBytes(UTF_8));
|
||||
return ByteBuffer.wrap(ArrayUtils.addAll(withsep, columnFamily.getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
private static String[] getTableAndCFNames(byte[] joined)
|
||||
private static String[] getTableAndCFNames(ByteBuffer joined)
|
||||
{
|
||||
int index;
|
||||
index = ArrayUtils.lastIndexOf(joined, SEPARATOR.getBytes()[0]);
|
||||
index = ArrayUtils.lastIndexOf(joined.array(), SEPARATOR.getBytes()[0],joined.position()+joined.arrayOffset());
|
||||
if (index < 1)
|
||||
throw new RuntimeException("Corrupted hint name " + joined.toString());
|
||||
String[] parts = new String[2];
|
||||
parts[0] = new String(ArrayUtils.subarray(joined, 0, index));
|
||||
parts[1] = new String(ArrayUtils.subarray(joined, index+1, joined.length));
|
||||
parts[0] = new String(ArrayUtils.subarray(joined.array(), joined.position()+joined.arrayOffset(), index));
|
||||
parts[1] = new String(ArrayUtils.subarray(joined.array(), index+1, joined.limit()));
|
||||
return parts;
|
||||
|
||||
}
|
||||
|
|
@ -193,14 +195,14 @@ public class HintedHandOffManager
|
|||
// 3. Delete the subcolumn if the write was successful
|
||||
// 4. Force a flush
|
||||
// 5. Do major compaction to clean up all deletes etc.
|
||||
DecoratedKey epkey = StorageService.getPartitioner().decorateKey(endpoint.getHostAddress().getBytes(UTF_8));
|
||||
DecoratedKey epkey = StorageService.getPartitioner().decorateKey(ByteBuffer.wrap(endpoint.getHostAddress().getBytes(UTF_8)));
|
||||
int rowsReplayed = 0;
|
||||
ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
|
||||
byte[] startColumn = ArrayUtils.EMPTY_BYTE_ARRAY;
|
||||
ByteBuffer startColumn = FBUtilities.EMPTY_BYTE_BUFFER;
|
||||
delivery:
|
||||
while (true)
|
||||
{
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(epkey, new QueryPath(HINTS_CF), startColumn, ArrayUtils.EMPTY_BYTE_ARRAY, false, PAGE_SIZE);
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(epkey, new QueryPath(HINTS_CF), startColumn, FBUtilities.EMPTY_BYTE_BUFFER, false, PAGE_SIZE);
|
||||
ColumnFamily hintColumnFamily = ColumnFamilyStore.removeDeleted(hintStore.getColumnFamily(filter), Integer.MAX_VALUE);
|
||||
if (pagingFinished(hintColumnFamily, startColumn))
|
||||
break;
|
||||
|
|
@ -214,7 +216,7 @@ public class HintedHandOffManager
|
|||
String[] parts = getTableAndCFNames(tableCF.name());
|
||||
if (sendMessage(endpoint, parts[0], parts[1], keyColumn.name()))
|
||||
{
|
||||
deleteHintKey(endpoint.getHostAddress().getBytes(UTF_8), keyColumn.name(), tableCF.name(), tableCF.timestamp());
|
||||
deleteHintKey(ByteBuffer.wrap(endpoint.getHostAddress().getBytes(UTF_8)), keyColumn.name(), tableCF.name(), tableCF.timestamp());
|
||||
rowsReplayed++;
|
||||
}
|
||||
else
|
||||
|
|
@ -248,26 +250,26 @@ public class HintedHandOffManager
|
|||
/** called when a keyspace is dropped or rename. newTable==null in the case of a drop. */
|
||||
public static void renameHints(String oldTable, String newTable) throws IOException
|
||||
{
|
||||
DecoratedKey oldTableKey = StorageService.getPartitioner().decorateKey(oldTable.getBytes(UTF_8));
|
||||
DecoratedKey oldTableKey = StorageService.getPartitioner().decorateKey(ByteBuffer.wrap(oldTable.getBytes(UTF_8)));
|
||||
// we're basically going to fetch, drop and add the scf for the old and new table. we need to do it piecemeal
|
||||
// though since there could be GB of data.
|
||||
ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
|
||||
byte[] startCol = ArrayUtils.EMPTY_BYTE_ARRAY;
|
||||
ByteBuffer startCol = FBUtilities.EMPTY_BYTE_BUFFER;
|
||||
long now = System.currentTimeMillis();
|
||||
while (true)
|
||||
{
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(oldTableKey, new QueryPath(HINTS_CF), startCol, ArrayUtils.EMPTY_BYTE_ARRAY, false, PAGE_SIZE);
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(oldTableKey, new QueryPath(HINTS_CF), startCol, FBUtilities.EMPTY_BYTE_BUFFER, false, PAGE_SIZE);
|
||||
ColumnFamily cf = ColumnFamilyStore.removeDeleted(hintStore.getColumnFamily(filter), Integer.MAX_VALUE);
|
||||
if (pagingFinished(cf, startCol))
|
||||
break;
|
||||
if (newTable != null)
|
||||
{
|
||||
RowMutation insert = new RowMutation(Table.SYSTEM_TABLE, newTable.getBytes(UTF_8));
|
||||
RowMutation insert = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(newTable.getBytes(UTF_8)));
|
||||
insert.add(cf);
|
||||
insert.apply();
|
||||
}
|
||||
RowMutation drop = new RowMutation(Table.SYSTEM_TABLE, oldTableKey.key);
|
||||
for (byte[] key : cf.getColumnNames())
|
||||
for (ByteBuffer key : cf.getColumnNames())
|
||||
{
|
||||
drop.delete(new QueryPath(HINTS_CF, key), now);
|
||||
startCol = key;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
|
@ -31,13 +32,13 @@ public interface IColumn
|
|||
public boolean isMarkedForDelete();
|
||||
public long getMarkedForDeleteAt();
|
||||
public long mostRecentLiveChangeAt();
|
||||
public byte[] name();
|
||||
public ByteBuffer name();
|
||||
public int size();
|
||||
public int serializedSize();
|
||||
public long timestamp();
|
||||
public byte[] value();
|
||||
public ByteBuffer value();
|
||||
public Collection<IColumn> getSubColumns();
|
||||
public IColumn getSubColumn(byte[] columnName);
|
||||
public IColumn getSubColumn(ByteBuffer columnName);
|
||||
public void addColumn(IColumn column);
|
||||
public IColumn diff(IColumn column);
|
||||
public IColumn reconcile(IColumn column);
|
||||
|
|
|
|||
|
|
@ -19,27 +19,31 @@
|
|||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentNavigableMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.PeekingIterator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.columniterator.IColumnIterator;
|
||||
import org.apache.cassandra.db.columniterator.SimpleAbstractColumnIterator;
|
||||
import org.apache.cassandra.db.filter.*;
|
||||
import org.apache.cassandra.db.filter.AbstractColumnIterator;
|
||||
import org.apache.cassandra.db.filter.NamesQueryFilter;
|
||||
import org.apache.cassandra.db.filter.SliceQueryFilter;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.sstable.SSTableWriter;
|
||||
import org.apache.cassandra.utils.WrappedRunnable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.PeekingIterator;
|
||||
|
||||
public class Memtable implements Comparable<Memtable>, IFlushable
|
||||
{
|
||||
|
|
@ -211,7 +215,7 @@ public class Memtable implements Comparable<Memtable>, IFlushable
|
|||
Comparator<IColumn> comparator = filter.getColumnComparator(typeComparator);
|
||||
|
||||
final PeekingIterator<IColumn> filteredIter = Iterators.peekingIterator(filteredColumns.iterator());
|
||||
if (!filter.reversed || filter.start.length != 0)
|
||||
if (!filter.reversed || filter.start.remaining() != 0)
|
||||
{
|
||||
while (filteredIter.hasNext() && comparator.compare(filteredIter.peek(), startColumn) < 0)
|
||||
{
|
||||
|
|
@ -238,7 +242,7 @@ public class Memtable implements Comparable<Memtable>, IFlushable
|
|||
|
||||
public IColumn next()
|
||||
{
|
||||
return filteredIter.next();
|
||||
return filteredIter.next();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -250,8 +254,8 @@ public class Memtable implements Comparable<Memtable>, IFlushable
|
|||
|
||||
return new SimpleAbstractColumnIterator()
|
||||
{
|
||||
private Iterator<byte[]> iter = filter.columns.iterator();
|
||||
private byte[] current;
|
||||
private Iterator<ByteBuffer> iter = filter.columns.iterator();
|
||||
private ByteBuffer current;
|
||||
|
||||
public ColumnFamily getColumnFamily()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,12 +36,16 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import org.apache.cassandra.concurrent.Stage;
|
||||
import org.apache.cassandra.concurrent.StageManager;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.cassandra.dht.AbstractBounds;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.io.ICompactSerializer;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.net.Message;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.thrift.ColumnParent;
|
||||
|
|
@ -51,12 +55,6 @@ import org.apache.thrift.TDeserializer;
|
|||
import org.apache.thrift.TSerializer;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RangeSliceCommand
|
||||
{
|
||||
private static final RangeSliceCommandSerializer serializer = new RangeSliceCommandSerializer();
|
||||
|
|
@ -64,7 +62,7 @@ public class RangeSliceCommand
|
|||
public final String keyspace;
|
||||
|
||||
public final String column_family;
|
||||
public final byte[] super_column;
|
||||
public final ByteBuffer super_column;
|
||||
|
||||
public final SlicePredicate predicate;
|
||||
|
||||
|
|
@ -73,10 +71,10 @@ public class RangeSliceCommand
|
|||
|
||||
public RangeSliceCommand(String keyspace, ColumnParent column_parent, SlicePredicate predicate, AbstractBounds range, int max_keys)
|
||||
{
|
||||
this(keyspace, column_parent.getColumn_family(), column_parent.getSuper_column(), predicate, range, max_keys);
|
||||
this(keyspace, column_parent.getColumn_family(), column_parent.super_column, predicate, range, max_keys);
|
||||
}
|
||||
|
||||
public RangeSliceCommand(String keyspace, String column_family, byte[] super_column, SlicePredicate predicate, AbstractBounds range, int max_keys)
|
||||
public RangeSliceCommand(String keyspace, String column_family, ByteBuffer super_column, SlicePredicate predicate, AbstractBounds range, int max_keys)
|
||||
{
|
||||
this.keyspace = keyspace;
|
||||
this.column_family = column_family;
|
||||
|
|
@ -122,9 +120,9 @@ class RangeSliceCommandSerializer implements ICompactSerializer<RangeSliceComman
|
|||
{
|
||||
dos.writeUTF(sliceCommand.keyspace);
|
||||
dos.writeUTF(sliceCommand.column_family);
|
||||
dos.writeInt(sliceCommand.super_column == null ? 0 : sliceCommand.super_column.length);
|
||||
dos.writeInt(sliceCommand.super_column == null ? 0 : sliceCommand.super_column.remaining());
|
||||
if (sliceCommand.super_column != null)
|
||||
dos.write(sliceCommand.super_column);
|
||||
dos.write(sliceCommand.super_column.array(),sliceCommand.super_column.position()+sliceCommand.super_column.arrayOffset(),sliceCommand.super_column.remaining());
|
||||
|
||||
TSerializer ser = new TSerializer(new TBinaryProtocol.Factory());
|
||||
FBUtilities.serialize(ser, sliceCommand.predicate, dos);
|
||||
|
|
@ -138,9 +136,9 @@ class RangeSliceCommandSerializer implements ICompactSerializer<RangeSliceComman
|
|||
String column_family = dis.readUTF();
|
||||
|
||||
int scLength = dis.readInt();
|
||||
byte[] super_column = null;
|
||||
ByteBuffer super_column = null;
|
||||
if (scLength > 0)
|
||||
super_column = readBuf(scLength, dis);
|
||||
super_column = ByteBuffer.wrap(readBuf(scLength, dis));
|
||||
|
||||
TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory());
|
||||
SlicePredicate pred = new SlicePredicate();
|
||||
|
|
|
|||
|
|
@ -22,17 +22,16 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cassandra.concurrent.Stage;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.ICompactSerializer;
|
||||
import org.apache.cassandra.net.Message;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.concurrent.StageManager;
|
||||
|
||||
|
||||
public abstract class ReadCommand
|
||||
|
|
@ -58,11 +57,11 @@ public abstract class ReadCommand
|
|||
|
||||
public final QueryPath queryPath;
|
||||
public final String table;
|
||||
public final byte[] key;
|
||||
public final ByteBuffer key;
|
||||
private boolean isDigestQuery = false;
|
||||
protected final byte commandType;
|
||||
|
||||
protected ReadCommand(String table, byte[] key, QueryPath queryPath, byte cmdType)
|
||||
protected ReadCommand(String table, ByteBuffer key, QueryPath queryPath, byte cmdType)
|
||||
{
|
||||
this.table = table;
|
||||
this.key = key;
|
||||
|
|
|
|||
|
|
@ -18,17 +18,13 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.concurrent.StageManager;
|
||||
import org.apache.cassandra.io.ICompactSerializer;
|
||||
import org.apache.cassandra.net.Message;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
|
||||
|
|
@ -52,10 +48,10 @@ private static ICompactSerializer<ReadResponse> serializer_;
|
|||
}
|
||||
|
||||
private Row row_;
|
||||
private byte[] digest_ = ArrayUtils.EMPTY_BYTE_ARRAY;
|
||||
private ByteBuffer digest_ = FBUtilities.EMPTY_BYTE_BUFFER;
|
||||
private boolean isDigestQuery_ = false;
|
||||
|
||||
public ReadResponse(byte[] digest )
|
||||
public ReadResponse(ByteBuffer digest )
|
||||
{
|
||||
assert digest != null;
|
||||
digest_= digest;
|
||||
|
|
@ -71,7 +67,7 @@ private static ICompactSerializer<ReadResponse> serializer_;
|
|||
return row_;
|
||||
}
|
||||
|
||||
public byte[] digest()
|
||||
public ByteBuffer digest()
|
||||
{
|
||||
return digest_;
|
||||
}
|
||||
|
|
@ -91,8 +87,8 @@ class ReadResponseSerializer implements ICompactSerializer<ReadResponse>
|
|||
{
|
||||
public void serialize(ReadResponse rm, DataOutputStream dos) throws IOException
|
||||
{
|
||||
dos.writeInt(rm.digest().length);
|
||||
dos.write(rm.digest());
|
||||
dos.writeInt(rm.digest().remaining());
|
||||
dos.write(rm.digest().array(),rm.digest().position()+rm.digest().arrayOffset(),rm.digest().remaining());
|
||||
dos.writeBoolean(rm.isDigestQuery());
|
||||
|
||||
if( !rm.isDigestQuery() && rm.row() != null )
|
||||
|
|
@ -114,7 +110,7 @@ class ReadResponseSerializer implements ICompactSerializer<ReadResponse>
|
|||
row = Row.serializer().deserialize(dis);
|
||||
}
|
||||
|
||||
ReadResponse rmsg = isDigest ? new ReadResponse(digest) : new ReadResponse(row);
|
||||
ReadResponse rmsg = isDigest ? new ReadResponse(ByteBuffer.wrap(digest)) : new ReadResponse(row);
|
||||
rmsg.setIsDigestQuery(isDigest);
|
||||
return rmsg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import java.util.List;
|
|||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.net.IVerbHandler;
|
||||
import org.apache.cassandra.net.Message;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
|
|
|
|||
|
|
@ -22,23 +22,27 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.io.ICompactSerializer;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.net.Message;
|
||||
import org.apache.cassandra.service.*;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
|
||||
import org.apache.cassandra.thrift.Deletion;
|
||||
import org.apache.cassandra.thrift.Mutation;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class RowMutation
|
||||
{
|
||||
|
|
@ -56,11 +60,11 @@ public class RowMutation
|
|||
}
|
||||
|
||||
private String table_;
|
||||
private byte[] key_;
|
||||
private ByteBuffer key_;
|
||||
// map of column family id to mutations for that column family.
|
||||
protected Map<Integer, ColumnFamily> modifications_ = new HashMap<Integer, ColumnFamily>();
|
||||
|
||||
public RowMutation(String table, byte[] key)
|
||||
public RowMutation(String table, ByteBuffer key)
|
||||
{
|
||||
table_ = table;
|
||||
key_ = key;
|
||||
|
|
@ -73,7 +77,7 @@ public class RowMutation
|
|||
add(row.cf);
|
||||
}
|
||||
|
||||
protected RowMutation(String table, byte[] key, Map<Integer, ColumnFamily> modifications)
|
||||
protected RowMutation(String table, ByteBuffer key, Map<Integer, ColumnFamily> modifications)
|
||||
{
|
||||
table_ = table;
|
||||
key_ = key;
|
||||
|
|
@ -85,7 +89,7 @@ public class RowMutation
|
|||
return table_;
|
||||
}
|
||||
|
||||
public byte[] key()
|
||||
public ByteBuffer key()
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
|
|
@ -99,9 +103,9 @@ public class RowMutation
|
|||
{
|
||||
for (ColumnFamily cf : rm.getColumnFamilies())
|
||||
{
|
||||
byte[] combined = HintedHandOffManager.makeCombinedName(rm.getTable(), cf.metadata().cfName);
|
||||
ByteBuffer combined = HintedHandOffManager.makeCombinedName(rm.getTable(), cf.metadata().cfName);
|
||||
QueryPath path = new QueryPath(HintedHandOffManager.HINTS_CF, rm.key(), combined);
|
||||
add(path, ArrayUtils.EMPTY_BYTE_ARRAY, System.currentTimeMillis(), cf.metadata().gcGraceSeconds);
|
||||
add(path, FBUtilities.EMPTY_BYTE_BUFFER, System.currentTimeMillis(), cf.metadata().gcGraceSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +142,7 @@ public class RowMutation
|
|||
* param @ timestamp - timestamp associated with this data.
|
||||
* param @ timeToLive - ttl for the column, 0 for standard (non expiring) columns
|
||||
*/
|
||||
public void add(QueryPath path, byte[] value, long timestamp, int timeToLive)
|
||||
public void add(QueryPath path, ByteBuffer value, long timestamp, int timeToLive)
|
||||
{
|
||||
Integer id = CFMetaData.getId(table_, path.columnFamilyName);
|
||||
ColumnFamily columnFamily = modifications_.get(id);
|
||||
|
|
@ -150,7 +154,7 @@ public class RowMutation
|
|||
columnFamily.addColumn(path, value, timestamp, timeToLive);
|
||||
}
|
||||
|
||||
public void add(QueryPath path, byte[] value, long timestamp)
|
||||
public void add(QueryPath path, ByteBuffer value, long timestamp)
|
||||
{
|
||||
add(path, value, timestamp, 0);
|
||||
}
|
||||
|
|
@ -215,7 +219,7 @@ public class RowMutation
|
|||
return new Message(FBUtilities.getLocalAddress(), verb, bos.toByteArray());
|
||||
}
|
||||
|
||||
public static RowMutation getRowMutationFromMutations(String keyspace, byte[] key, Map<String, List<Mutation>> cfmap)
|
||||
public static RowMutation getRowMutationFromMutations(String keyspace, ByteBuffer key, Map<String, List<Mutation>> cfmap)
|
||||
{
|
||||
RowMutation rm = new RowMutation(keyspace, key);
|
||||
for (Map.Entry<String, List<Mutation>> entry : cfmap.entrySet())
|
||||
|
|
@ -236,7 +240,7 @@ public class RowMutation
|
|||
return rm;
|
||||
}
|
||||
|
||||
public static RowMutation getRowMutation(String table, byte[] key, Map<String, List<ColumnOrSuperColumn>> cfmap)
|
||||
public static RowMutation getRowMutation(String table, ByteBuffer key, Map<String, List<ColumnOrSuperColumn>> cfmap)
|
||||
{
|
||||
RowMutation rm = new RowMutation(table, key);
|
||||
for (Map.Entry<String, List<ColumnOrSuperColumn>> entry : cfmap.entrySet())
|
||||
|
|
@ -314,7 +318,7 @@ public class RowMutation
|
|||
{
|
||||
if (del.predicate != null && del.predicate.column_names != null)
|
||||
{
|
||||
for(byte[] c : del.predicate.column_names)
|
||||
for(ByteBuffer c : del.predicate.column_names)
|
||||
{
|
||||
if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.table_, cfName) == ColumnFamilyType.Super)
|
||||
rm.delete(new QueryPath(cfName, c), del.timestamp);
|
||||
|
|
@ -370,7 +374,7 @@ class RowMutationSerializer implements ICompactSerializer<RowMutation>
|
|||
public RowMutation deserialize(DataInputStream dis) throws IOException
|
||||
{
|
||||
String table = dis.readUTF();
|
||||
byte[] key = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer key = FBUtilities.readShortByteArray(dis);
|
||||
Map<Integer, ColumnFamily> modifications = defreezeTheMaps(dis);
|
||||
return new RowMutation(table, key, modifications);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ public class RowMutationVerbHandler implements IVerbHandler
|
|||
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(hintedBytes));
|
||||
while (dis.available() > 0)
|
||||
{
|
||||
byte[] addressBytes = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer addressBytes = FBUtilities.readShortByteArray(dis);
|
||||
if (logger_.isDebugEnabled())
|
||||
logger_.debug("Adding hint for " + InetAddress.getByName(new String(addressBytes)));
|
||||
logger_.debug("Adding hint for " + InetAddress.getByName(new String(addressBytes.array(),addressBytes.position()+addressBytes.arrayOffset(),addressBytes.remaining())));
|
||||
RowMutation hintedMutation = new RowMutation(Table.SYSTEM_TABLE, addressBytes);
|
||||
hintedMutation.addHints(rm);
|
||||
hintedMutation.apply();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@ package org.apache.cassandra.db;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
|
|
@ -30,17 +35,17 @@ import org.apache.cassandra.utils.FBUtilities;
|
|||
|
||||
public class SliceByNamesReadCommand extends ReadCommand
|
||||
{
|
||||
public final SortedSet<byte[]> columnNames;
|
||||
public final SortedSet<ByteBuffer> columnNames;
|
||||
|
||||
public SliceByNamesReadCommand(String table, byte[] key, ColumnParent column_parent, Collection<byte[]> columnNames)
|
||||
public SliceByNamesReadCommand(String table, ByteBuffer key, ColumnParent column_parent, Collection<ByteBuffer> columnNames)
|
||||
{
|
||||
this(table, key, new QueryPath(column_parent), columnNames);
|
||||
}
|
||||
|
||||
public SliceByNamesReadCommand(String table, byte[] key, QueryPath path, Collection<byte[]> columnNames)
|
||||
public SliceByNamesReadCommand(String table, ByteBuffer key, QueryPath path, Collection<ByteBuffer> columnNames)
|
||||
{
|
||||
super(table, key, path, CMD_TYPE_GET_SLICE_BY_NAMES);
|
||||
this.columnNames = new TreeSet<byte[]>(getComparator());
|
||||
this.columnNames = new TreeSet<ByteBuffer>(getComparator());
|
||||
this.columnNames.addAll(columnNames);
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +90,7 @@ class SliceByNamesReadCommandSerializer extends ReadCommandSerializer
|
|||
dos.writeInt(realRM.columnNames.size());
|
||||
if (realRM.columnNames.size() > 0)
|
||||
{
|
||||
for (byte[] cName : realRM.columnNames)
|
||||
for (ByteBuffer cName : realRM.columnNames)
|
||||
{
|
||||
FBUtilities.writeShortByteArray(cName, dos);
|
||||
}
|
||||
|
|
@ -97,11 +102,11 @@ class SliceByNamesReadCommandSerializer extends ReadCommandSerializer
|
|||
{
|
||||
boolean isDigest = dis.readBoolean();
|
||||
String table = dis.readUTF();
|
||||
byte[] key = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer key = FBUtilities.readShortByteArray(dis);
|
||||
QueryPath columnParent = QueryPath.deserialize(dis);
|
||||
|
||||
int size = dis.readInt();
|
||||
List<byte[]> columns = new ArrayList<byte[]>();
|
||||
List<ByteBuffer> columns = new ArrayList<ByteBuffer>();
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
columns.add(FBUtilities.readShortByteArray(dis));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.cassandra.db;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
import org.apache.cassandra.db.filter.QueryPath;
|
||||
|
|
@ -30,16 +30,16 @@ import org.apache.cassandra.utils.FBUtilities;
|
|||
|
||||
public class SliceFromReadCommand extends ReadCommand
|
||||
{
|
||||
public final byte[] start, finish;
|
||||
public final ByteBuffer start, finish;
|
||||
public final boolean reversed;
|
||||
public final int count;
|
||||
|
||||
public SliceFromReadCommand(String table, byte[] key, ColumnParent column_parent, byte[] start, byte[] finish, boolean reversed, int count)
|
||||
public SliceFromReadCommand(String table, ByteBuffer key, ColumnParent column_parent, ByteBuffer start, ByteBuffer finish, boolean reversed, int count)
|
||||
{
|
||||
this(table, key, new QueryPath(column_parent), start, finish, reversed, count);
|
||||
}
|
||||
|
||||
public SliceFromReadCommand(String table, byte[] key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int count)
|
||||
public SliceFromReadCommand(String table, ByteBuffer key, QueryPath path, ByteBuffer start, ByteBuffer finish, boolean reversed, int count)
|
||||
{
|
||||
super(table, key, path, CMD_TYPE_GET_SLICE);
|
||||
this.start = start;
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.ICompactSerializer2;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class SuperColumn implements IColumn, IColumnContainer
|
||||
|
|
@ -45,20 +45,20 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
return new SuperColumnSerializer(comparator);
|
||||
}
|
||||
|
||||
private byte[] name_;
|
||||
private ConcurrentSkipListMap<byte[], IColumn> columns_;
|
||||
private ByteBuffer name_;
|
||||
private ConcurrentSkipListMap<ByteBuffer, IColumn> columns_;
|
||||
private AtomicInteger localDeletionTime = new AtomicInteger(Integer.MIN_VALUE);
|
||||
private AtomicLong markedForDeleteAt = new AtomicLong(Long.MIN_VALUE);
|
||||
|
||||
public SuperColumn(byte[] name, AbstractType comparator)
|
||||
public SuperColumn(ByteBuffer name, AbstractType comparator)
|
||||
{
|
||||
this(name, new ConcurrentSkipListMap<byte[], IColumn>(comparator));
|
||||
this(name, new ConcurrentSkipListMap<ByteBuffer, IColumn>(comparator));
|
||||
}
|
||||
|
||||
private SuperColumn(byte[] name, ConcurrentSkipListMap<byte[], IColumn> columns)
|
||||
private SuperColumn(ByteBuffer name, ConcurrentSkipListMap<ByteBuffer, IColumn> columns)
|
||||
{
|
||||
assert name != null;
|
||||
assert name.length <= IColumn.MAX_NAME_LENGTH;
|
||||
assert name.remaining() <= IColumn.MAX_NAME_LENGTH;
|
||||
name_ = name;
|
||||
columns_ = columns;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
|
||||
public IColumn cloneMe()
|
||||
{
|
||||
SuperColumn sc = new SuperColumn(name_, new ConcurrentSkipListMap<byte[], IColumn>(columns_));
|
||||
SuperColumn sc = new SuperColumn(name_, new ConcurrentSkipListMap<ByteBuffer, IColumn>(columns_));
|
||||
sc.markForDeleteAt(localDeletionTime.get(), markedForDeleteAt.get());
|
||||
return sc;
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
return markedForDeleteAt.get() > Long.MIN_VALUE;
|
||||
}
|
||||
|
||||
public byte[] name()
|
||||
public ByteBuffer name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
return columns_.values();
|
||||
}
|
||||
|
||||
public IColumn getSubColumn(byte[] columnName)
|
||||
public IColumn getSubColumn(ByteBuffer columnName)
|
||||
{
|
||||
IColumn column = columns_.get(columnName);
|
||||
assert column == null || column instanceof Column;
|
||||
|
|
@ -127,10 +127,10 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
* We need to keep the way we are calculating the column size in sync with the
|
||||
* way we are calculating the size for the column family serializer.
|
||||
*/
|
||||
return DBConstants.shortSize_ + name_.length + DBConstants.intSize_ + DBConstants.longSize_ + DBConstants.intSize_ + size();
|
||||
return DBConstants.shortSize_ + name_.remaining() + DBConstants.intSize_ + DBConstants.longSize_ + DBConstants.intSize_ + size();
|
||||
}
|
||||
|
||||
public void remove(byte[] columnName)
|
||||
public void remove(ByteBuffer columnName)
|
||||
{
|
||||
columns_.remove(columnName);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
return max;
|
||||
}
|
||||
|
||||
public byte[] value()
|
||||
public ByteBuffer value()
|
||||
{
|
||||
throw new UnsupportedOperationException("This operation is not supported for Super Columns.");
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
{
|
||||
assert column instanceof Column : "A super column can only contain simple columns";
|
||||
|
||||
byte[] name = column.name();
|
||||
ByteBuffer name = column.name();
|
||||
IColumn oldColumn = columns_.putIfAbsent(name, column);
|
||||
if (oldColumn != null)
|
||||
{
|
||||
|
|
@ -236,7 +236,7 @@ public class SuperColumn implements IColumn, IColumnContainer
|
|||
public void updateDigest(MessageDigest digest)
|
||||
{
|
||||
assert name_ != null;
|
||||
digest.update(name_);
|
||||
digest.update(name_.array(),name_.position()+name_.arrayOffset(),name_.remaining());
|
||||
DataOutputBuffer buffer = new DataOutputBuffer();
|
||||
try
|
||||
{
|
||||
|
|
@ -326,7 +326,7 @@ class SuperColumnSerializer implements ICompactSerializer2<IColumn>
|
|||
|
||||
public IColumn deserialize(DataInput dis) throws IOException
|
||||
{
|
||||
byte[] name = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer name = FBUtilities.readShortByteArray(dis);
|
||||
SuperColumn superColumn = new SuperColumn(name, comparator);
|
||||
int localDeleteTime = dis.readInt();
|
||||
if (localDeleteTime != Integer.MIN_VALUE && localDeleteTime <= 0)
|
||||
|
|
|
|||
|
|
@ -18,21 +18,20 @@
|
|||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.filter.QueryFilter;
|
||||
|
|
@ -42,25 +41,26 @@ import org.apache.cassandra.dht.IPartitioner;
|
|||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SystemTable
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(SystemTable.class);
|
||||
public static final String STATUS_CF = "LocationInfo"; // keep the old CF string for backwards-compatibility
|
||||
public static final String INDEX_CF = "IndexInfo";
|
||||
private static final byte[] LOCATION_KEY = "L".getBytes(UTF_8);
|
||||
private static final byte[] RING_KEY = "Ring".getBytes(UTF_8);
|
||||
private static final byte[] BOOTSTRAP_KEY = "Bootstrap".getBytes(UTF_8);
|
||||
private static final byte[] COOKIE_KEY = "Cookies".getBytes(UTF_8);
|
||||
private static final byte[] BOOTSTRAP = "B".getBytes(UTF_8);
|
||||
private static final byte[] TOKEN = "Token".getBytes(UTF_8);
|
||||
private static final byte[] GENERATION = "Generation".getBytes(UTF_8);
|
||||
private static final byte[] CLUSTERNAME = "ClusterName".getBytes(UTF_8);
|
||||
private static final byte[] PARTITIONER = "Partioner".getBytes(UTF_8);
|
||||
private static final ByteBuffer LOCATION_KEY = ByteBuffer.wrap("L".getBytes(UTF_8));
|
||||
private static final ByteBuffer RING_KEY = ByteBuffer.wrap("Ring".getBytes(UTF_8));
|
||||
private static final ByteBuffer BOOTSTRAP_KEY = ByteBuffer.wrap("Bootstrap".getBytes(UTF_8));
|
||||
private static final ByteBuffer COOKIE_KEY = ByteBuffer.wrap("Cookies".getBytes(UTF_8));
|
||||
private static final ByteBuffer BOOTSTRAP = ByteBuffer.wrap("B".getBytes(UTF_8));
|
||||
private static final ByteBuffer TOKEN = ByteBuffer.wrap("Token".getBytes(UTF_8));
|
||||
private static final ByteBuffer GENERATION = ByteBuffer.wrap("Generation".getBytes(UTF_8));
|
||||
private static final ByteBuffer CLUSTERNAME = ByteBuffer.wrap("ClusterName".getBytes(UTF_8));
|
||||
private static final ByteBuffer PARTITIONER = ByteBuffer.wrap("Partioner".getBytes(UTF_8));
|
||||
|
||||
private static DecoratedKey decorate(byte[] key)
|
||||
private static DecoratedKey decorate(ByteBuffer key)
|
||||
{
|
||||
return StorageService.getPartitioner().decorateKey(key);
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ public class SystemTable
|
|||
public static void purgeIncompatibleHints() throws IOException
|
||||
{
|
||||
// 0.6->0.7
|
||||
final byte[] hintsPurged6to7 = "Hints purged as part of upgrading from 0.6.x to 0.7".getBytes();
|
||||
final ByteBuffer hintsPurged6to7 = ByteBuffer.wrap("Hints purged as part of upgrading from 0.6.x to 0.7".getBytes());
|
||||
Table table = Table.open(Table.SYSTEM_TABLE);
|
||||
QueryFilter dotSeven = QueryFilter.getNamesFilter(decorate(COOKIE_KEY), new QueryPath(STATUS_CF), hintsPurged6to7);
|
||||
ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(dotSeven);
|
||||
|
|
@ -79,7 +79,7 @@ public class SystemTable
|
|||
logger.info("Upgrading to 0.7. Purging hints if there are any. Old hints will be snapshotted.");
|
||||
new Truncation(Table.SYSTEM_TABLE, HintedHandOffManager.HINTS_CF).apply();
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, COOKIE_KEY);
|
||||
rm.add(new QueryPath(STATUS_CF, null, hintsPurged6to7), "oh yes, it they were purged.".getBytes(), System.currentTimeMillis());
|
||||
rm.add(new QueryPath(STATUS_CF, null, hintsPurged6to7), ByteBuffer.wrap("oh yes, it they were purged.".getBytes()), System.currentTimeMillis());
|
||||
rm.apply();
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ public class SystemTable
|
|||
{
|
||||
IPartitioner p = StorageService.getPartitioner();
|
||||
ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
|
||||
cf.addColumn(new Column(p.getTokenFactory().toByteArray(token), ep.getAddress(), System.currentTimeMillis()));
|
||||
cf.addColumn(new Column(p.getTokenFactory().toByteArray(token), ByteBuffer.wrap(ep.getAddress()), System.currentTimeMillis()));
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, RING_KEY);
|
||||
rm.add(cf);
|
||||
try
|
||||
|
|
@ -177,7 +177,10 @@ public class SystemTable
|
|||
{
|
||||
try
|
||||
{
|
||||
tokenMap.put(p.getTokenFactory().fromByteArray(column.name()), InetAddress.getByAddress(column.value()));
|
||||
byte[] addr = new byte[column.value().remaining()];
|
||||
System.arraycopy(column.value().array(), column.value().position()+column.value().arrayOffset(), addr, 0, column.value().remaining());
|
||||
|
||||
tokenMap.put(p.getTokenFactory().fromByteArray(column.name()), InetAddress.getByAddress(addr));
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
|
|
@ -210,7 +213,7 @@ public class SystemTable
|
|||
throw ex;
|
||||
}
|
||||
|
||||
SortedSet<byte[]> cols = new TreeSet<byte[]>(BytesType.instance);
|
||||
SortedSet<ByteBuffer> cols = new TreeSet<ByteBuffer>(BytesType.instance);
|
||||
cols.add(PARTITIONER);
|
||||
cols.add(CLUSTERNAME);
|
||||
QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF), cols);
|
||||
|
|
@ -235,8 +238,8 @@ public class SystemTable
|
|||
// no system files. this is a new node.
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY);
|
||||
cf = ColumnFamily.create(Table.SYSTEM_TABLE, SystemTable.STATUS_CF);
|
||||
cf.addColumn(new Column(PARTITIONER, DatabaseDescriptor.getPartitioner().getClass().getName().getBytes(UTF_8), FBUtilities.timestampMicros()));
|
||||
cf.addColumn(new Column(CLUSTERNAME, DatabaseDescriptor.getClusterName().getBytes(), FBUtilities.timestampMicros()));
|
||||
cf.addColumn(new Column(PARTITIONER, ByteBuffer.wrap(DatabaseDescriptor.getPartitioner().getClass().getName().getBytes(UTF_8)), FBUtilities.timestampMicros()));
|
||||
cf.addColumn(new Column(CLUSTERNAME, ByteBuffer.wrap(DatabaseDescriptor.getClusterName().getBytes()), FBUtilities.timestampMicros()));
|
||||
rm.add(cf);
|
||||
rm.apply();
|
||||
|
||||
|
|
@ -248,10 +251,13 @@ public class SystemTable
|
|||
IColumn clusterCol = cf.getColumn(CLUSTERNAME);
|
||||
assert partitionerCol != null;
|
||||
assert clusterCol != null;
|
||||
if (!DatabaseDescriptor.getPartitioner().getClass().getName().equals(new String(partitionerCol.value(), UTF_8)))
|
||||
if (!DatabaseDescriptor.getPartitioner().getClass().getName().equals(
|
||||
new String(partitionerCol.value().array(),
|
||||
partitionerCol.value().position()+partitionerCol.value().arrayOffset(),
|
||||
partitionerCol.value().remaining(), UTF_8)))
|
||||
throw new ConfigurationException("Detected partitioner mismatch! Did you change the partitioner?");
|
||||
if (!DatabaseDescriptor.getClusterName().equals(new String(clusterCol.value())))
|
||||
throw new ConfigurationException("Saved cluster name " + new String(clusterCol.value()) + " != configured name " + DatabaseDescriptor.getClusterName());
|
||||
if (!DatabaseDescriptor.getClusterName().equals(new String(clusterCol.value().array(),clusterCol.value().position()+clusterCol.value().arrayOffset(),clusterCol.value().remaining())))
|
||||
throw new ConfigurationException("Saved cluster name " + new String(clusterCol.value().array(),clusterCol.value().position()+clusterCol.value().arrayOffset(),clusterCol.value().remaining()) + " != configured name " + DatabaseDescriptor.getClusterName());
|
||||
}
|
||||
|
||||
public static Token getSavedToken()
|
||||
|
|
@ -299,13 +305,16 @@ public class SystemTable
|
|||
new QueryPath(STATUS_CF),
|
||||
BOOTSTRAP);
|
||||
ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(filter);
|
||||
return cf != null && cf.getColumn(BOOTSTRAP).value()[0] == 1;
|
||||
IColumn c = cf.getColumn(BOOTSTRAP);
|
||||
return cf != null && c.value().array()[c.value().position()+c.value().arrayOffset()] == 1;
|
||||
}
|
||||
|
||||
public static void setBootstrapped(boolean isBootstrapped)
|
||||
{
|
||||
ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
|
||||
cf.addColumn(new Column(BOOTSTRAP, new byte[] { (byte) (isBootstrapped ? 1 : 0) }, System.currentTimeMillis()));
|
||||
cf.addColumn(new Column(BOOTSTRAP,
|
||||
ByteBuffer.wrap(new byte[] { (byte) (isBootstrapped ? 1 : 0) }),
|
||||
System.currentTimeMillis()));
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY);
|
||||
rm.add(cf);
|
||||
try
|
||||
|
|
@ -321,17 +330,17 @@ public class SystemTable
|
|||
public static boolean isIndexBuilt(String table, String indexName)
|
||||
{
|
||||
ColumnFamilyStore cfs = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(INDEX_CF);
|
||||
QueryFilter filter = QueryFilter.getNamesFilter(decorate(table.getBytes(UTF_8)),
|
||||
QueryFilter filter = QueryFilter.getNamesFilter(decorate(ByteBuffer.wrap(table.getBytes(UTF_8))),
|
||||
new QueryPath(INDEX_CF),
|
||||
indexName.getBytes(UTF_8));
|
||||
ByteBuffer.wrap(indexName.getBytes(UTF_8)));
|
||||
return cfs.getColumnFamily(filter) != null;
|
||||
}
|
||||
|
||||
public static void setIndexBuilt(String table, String indexName)
|
||||
{
|
||||
ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, INDEX_CF);
|
||||
cf.addColumn(new Column(indexName.getBytes(UTF_8), ArrayUtils.EMPTY_BYTE_ARRAY, System.currentTimeMillis()));
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, table.getBytes(UTF_8));
|
||||
cf.addColumn(new Column(ByteBuffer.wrap(indexName.getBytes(UTF_8)), FBUtilities.EMPTY_BYTE_BUFFER, System.currentTimeMillis()));
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(table.getBytes(UTF_8)));
|
||||
rm.add(cf);
|
||||
try
|
||||
{
|
||||
|
|
@ -347,8 +356,8 @@ public class SystemTable
|
|||
|
||||
public static void setIndexRemoved(String table, String indexName)
|
||||
{
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, table.getBytes(UTF_8));
|
||||
rm.delete(new QueryPath(INDEX_CF, null, indexName.getBytes(UTF_8)), System.currentTimeMillis());
|
||||
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(table.getBytes(UTF_8)));
|
||||
rm.delete(new QueryPath(INDEX_CF, null, ByteBuffer.wrap(indexName.getBytes(UTF_8))), System.currentTimeMillis());
|
||||
try
|
||||
{
|
||||
rm.apply();
|
||||
|
|
|
|||
|
|
@ -21,19 +21,22 @@ package org.apache.cassandra.db;
|
|||
import java.io.File;
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.commitlog.CommitLog;
|
||||
|
|
@ -47,7 +50,13 @@ import org.apache.cassandra.io.sstable.SSTableReader;
|
|||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.cliffc.high_scale_lib.NonBlockingHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
public class Table
|
||||
{
|
||||
|
|
@ -361,13 +370,13 @@ public class Table
|
|||
continue;
|
||||
}
|
||||
|
||||
SortedSet<byte[]> mutatedIndexedColumns = null;
|
||||
for (byte[] column : cfs.getIndexedColumns())
|
||||
SortedSet<ByteBuffer> mutatedIndexedColumns = null;
|
||||
for (ByteBuffer column : cfs.getIndexedColumns())
|
||||
{
|
||||
if (cf.getColumnNames().contains(column) || cf.isMarkedForDelete())
|
||||
{
|
||||
if (mutatedIndexedColumns == null)
|
||||
mutatedIndexedColumns = new TreeSet<byte[]>(FBUtilities.byteArrayComparator);
|
||||
mutatedIndexedColumns = new TreeSet<ByteBuffer>();
|
||||
mutatedIndexedColumns.add(column);
|
||||
}
|
||||
}
|
||||
|
|
@ -416,7 +425,7 @@ public class Table
|
|||
return memtablesToFlush;
|
||||
}
|
||||
|
||||
private static void ignoreObsoleteMutations(ColumnFamily cf, SortedSet<byte[]> mutatedIndexedColumns, ColumnFamily oldIndexedColumns)
|
||||
private static void ignoreObsoleteMutations(ColumnFamily cf, SortedSet<ByteBuffer> mutatedIndexedColumns, ColumnFamily oldIndexedColumns)
|
||||
{
|
||||
if (oldIndexedColumns == null)
|
||||
return;
|
||||
|
|
@ -440,7 +449,7 @@ public class Table
|
|||
}
|
||||
}
|
||||
|
||||
private static ColumnFamily readCurrentIndexedColumns(DecoratedKey key, ColumnFamilyStore cfs, SortedSet<byte[]> mutatedIndexedColumns)
|
||||
private static ColumnFamily readCurrentIndexedColumns(DecoratedKey key, ColumnFamilyStore cfs, SortedSet<ByteBuffer> mutatedIndexedColumns)
|
||||
{
|
||||
QueryFilter filter = QueryFilter.getNamesFilter(key, new QueryPath(cfs.getColumnFamilyName()), mutatedIndexedColumns);
|
||||
return cfs.getColumnFamily(filter);
|
||||
|
|
@ -450,16 +459,16 @@ public class Table
|
|||
* removes obsolete index entries and creates new ones for the given row key and mutated columns.
|
||||
* @return list of full (index CF) memtables
|
||||
*/
|
||||
private static List<Memtable> applyIndexUpdates(byte[] key,
|
||||
private static List<Memtable> applyIndexUpdates(ByteBuffer key,
|
||||
ColumnFamily cf,
|
||||
ColumnFamilyStore cfs,
|
||||
SortedSet<byte[]> mutatedIndexedColumns,
|
||||
SortedSet<ByteBuffer> mutatedIndexedColumns,
|
||||
ColumnFamily oldIndexedColumns)
|
||||
{
|
||||
List<Memtable> fullMemtables = Collections.emptyList();
|
||||
|
||||
// add new index entries
|
||||
for (byte[] columnName : mutatedIndexedColumns)
|
||||
for (ByteBuffer columnName : mutatedIndexedColumns)
|
||||
{
|
||||
IColumn column = cf.getColumn(columnName);
|
||||
if (column == null || column.isMarkedForDelete())
|
||||
|
|
@ -470,11 +479,11 @@ public class Table
|
|||
if (column instanceof ExpiringColumn)
|
||||
{
|
||||
ExpiringColumn ec = (ExpiringColumn)column;
|
||||
cfi.addColumn(new ExpiringColumn(key, ArrayUtils.EMPTY_BYTE_ARRAY, ec.timestamp, ec.getTimeToLive(), ec.getLocalDeletionTime()));
|
||||
cfi.addColumn(new ExpiringColumn(key, FBUtilities.EMPTY_BYTE_BUFFER, ec.timestamp, ec.getTimeToLive(), ec.getLocalDeletionTime()));
|
||||
}
|
||||
else
|
||||
{
|
||||
cfi.addColumn(new Column(key, ArrayUtils.EMPTY_BYTE_ARRAY, column.timestamp()));
|
||||
cfi.addColumn(new Column(key, FBUtilities.EMPTY_BYTE_BUFFER, column.timestamp()));
|
||||
}
|
||||
Memtable fullMemtable = cfs.getIndexedColumnFamilyStore(columnName).apply(valueKey, cfi);
|
||||
if (fullMemtable != null)
|
||||
|
|
@ -485,9 +494,9 @@ public class Table
|
|||
if (oldIndexedColumns != null)
|
||||
{
|
||||
int localDeletionTime = (int) (System.currentTimeMillis() / 1000);
|
||||
for (Map.Entry<byte[], IColumn> entry : oldIndexedColumns.getColumnsMap().entrySet())
|
||||
for (Map.Entry<ByteBuffer, IColumn> entry : oldIndexedColumns.getColumnsMap().entrySet())
|
||||
{
|
||||
byte[] columnName = entry.getKey();
|
||||
ByteBuffer columnName = entry.getKey();
|
||||
IColumn column = entry.getValue();
|
||||
if (column.isMarkedForDelete())
|
||||
continue;
|
||||
|
|
@ -503,7 +512,7 @@ public class Table
|
|||
return fullMemtables;
|
||||
}
|
||||
|
||||
public IndexBuilder createIndexBuilder(ColumnFamilyStore cfs, SortedSet<byte[]> columns, ReducingKeyIterator iter)
|
||||
public IndexBuilder createIndexBuilder(ColumnFamilyStore cfs, SortedSet<ByteBuffer> columns, ReducingKeyIterator iter)
|
||||
{
|
||||
return new IndexBuilder(cfs, columns, iter);
|
||||
}
|
||||
|
|
@ -511,10 +520,10 @@ public class Table
|
|||
public class IndexBuilder implements ICompactionInfo
|
||||
{
|
||||
private final ColumnFamilyStore cfs;
|
||||
private final SortedSet<byte[]> columns;
|
||||
private final SortedSet<ByteBuffer> columns;
|
||||
private final ReducingKeyIterator iter;
|
||||
|
||||
public IndexBuilder(ColumnFamilyStore cfs, SortedSet<byte[]> columns, ReducingKeyIterator iter)
|
||||
public IndexBuilder(ColumnFamilyStore cfs, SortedSet<ByteBuffer> columns, ReducingKeyIterator iter)
|
||||
{
|
||||
this.cfs = cfs;
|
||||
this.columns = columns;
|
||||
|
|
@ -574,9 +583,9 @@ public class Table
|
|||
}
|
||||
}
|
||||
|
||||
private Object indexLockFor(byte[] key)
|
||||
private Object indexLockFor(ByteBuffer key)
|
||||
{
|
||||
return indexLocks[Math.abs(Arrays.hashCode(key) % indexLocks.length)];
|
||||
return indexLocks[Math.abs(key.hashCode() % indexLocks.length)];
|
||||
}
|
||||
|
||||
public List<Future<?>> flush() throws IOException
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.io.ICompactSerializer;
|
||||
import org.apache.cassandra.net.Message;
|
||||
|
|
@ -51,10 +52,10 @@ public class WriteResponse
|
|||
}
|
||||
|
||||
private final String table_;
|
||||
private final byte[] key_;
|
||||
private final ByteBuffer key_;
|
||||
private final boolean status_;
|
||||
|
||||
public WriteResponse(String table, byte[] key, boolean bVal) {
|
||||
public WriteResponse(String table, ByteBuffer key, boolean bVal) {
|
||||
table_ = table;
|
||||
key_ = key;
|
||||
status_ = bVal;
|
||||
|
|
@ -65,7 +66,7 @@ public class WriteResponse
|
|||
return table_;
|
||||
}
|
||||
|
||||
public byte[] key()
|
||||
public ByteBuffer key()
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
|
|
@ -87,7 +88,7 @@ public class WriteResponse
|
|||
public WriteResponse deserialize(DataInputStream dis) throws IOException
|
||||
{
|
||||
String table = dis.readUTF();
|
||||
byte[] key = FBUtilities.readShortByteArray(dis);
|
||||
ByteBuffer key = FBUtilities.readShortByteArray(dis);
|
||||
boolean status = dis.readBoolean();
|
||||
return new WriteResponse(table, key, status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@ package org.apache.cassandra.db.columniterator;
|
|||
*/
|
||||
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import org.apache.cassandra.db.SuperColumn;
|
||||
import org.apache.cassandra.db.filter.SliceQueryFilter;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class IdentityQueryFilter extends SliceQueryFilter
|
||||
{
|
||||
|
|
@ -33,7 +32,7 @@ public class IdentityQueryFilter extends SliceQueryFilter
|
|||
*/
|
||||
public IdentityQueryFilter()
|
||||
{
|
||||
super(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, Integer.MAX_VALUE);
|
||||
super(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public SuperColumn filterSuperColumn(SuperColumn superColumn, int gcBefore)
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@ package org.apache.cassandra.db.columniterator;
|
|||
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.sstable.IndexHelper;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.util.FileDataInput;
|
||||
import org.apache.cassandra.io.util.FileMark;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
/**
|
||||
* This is a reader that finds the block for a starting column and returns
|
||||
* blocks before/after it for each next call. This function assumes that
|
||||
|
|
@ -50,15 +50,15 @@ class IndexedSliceReader extends AbstractIterator<IColumn> implements IColumnIte
|
|||
|
||||
private final List<IndexHelper.IndexInfo> indexes;
|
||||
private final FileDataInput file;
|
||||
private final byte[] startColumn;
|
||||
private final byte[] finishColumn;
|
||||
private final ByteBuffer startColumn;
|
||||
private final ByteBuffer finishColumn;
|
||||
private final boolean reversed;
|
||||
|
||||
private BlockFetcher fetcher;
|
||||
private Deque<IColumn> blockColumns = new ArrayDeque<IColumn>();
|
||||
private AbstractType comparator;
|
||||
|
||||
public IndexedSliceReader(CFMetaData metadata, FileDataInput input, byte[] startColumn, byte[] finishColumn, boolean reversed)
|
||||
public IndexedSliceReader(CFMetaData metadata, FileDataInput input, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed)
|
||||
{
|
||||
this.file = input;
|
||||
this.startColumn = startColumn;
|
||||
|
|
@ -91,15 +91,15 @@ class IndexedSliceReader extends AbstractIterator<IColumn> implements IColumnIte
|
|||
|
||||
private boolean isColumnNeeded(IColumn column)
|
||||
{
|
||||
if (startColumn.length == 0 && finishColumn.length == 0)
|
||||
if (startColumn.remaining() == 0 && finishColumn.remaining() == 0)
|
||||
return true;
|
||||
else if (startColumn.length == 0 && !reversed)
|
||||
else if (startColumn.remaining() == 0 && !reversed)
|
||||
return comparator.compare(column.name(), finishColumn) <= 0;
|
||||
else if (startColumn.length == 0 && reversed)
|
||||
else if (startColumn.remaining() == 0 && reversed)
|
||||
return comparator.compare(column.name(), finishColumn) >= 0;
|
||||
else if (finishColumn.length == 0 && !reversed)
|
||||
else if (finishColumn.remaining() == 0 && !reversed)
|
||||
return comparator.compare(column.name(), startColumn) >= 0;
|
||||
else if (finishColumn.length == 0 && reversed)
|
||||
else if (finishColumn.remaining() == 0 && reversed)
|
||||
return comparator.compare(column.name(), startColumn) <= 0;
|
||||
else if (!reversed)
|
||||
return comparator.compare(column.name(), startColumn) >= 0 && comparator.compare(column.name(), finishColumn) <= 0;
|
||||
|
|
@ -160,14 +160,14 @@ class IndexedSliceReader extends AbstractIterator<IColumn> implements IColumnIte
|
|||
/* see if this read is really necessary. */
|
||||
if (reversed)
|
||||
{
|
||||
if ((finishColumn.length > 0 && comparator.compare(finishColumn, curColPosition.lastName) > 0) ||
|
||||
(startColumn.length > 0 && comparator.compare(startColumn, curColPosition.firstName) < 0))
|
||||
if ((finishColumn.remaining() > 0 && comparator.compare(finishColumn, curColPosition.lastName) > 0) ||
|
||||
(startColumn.remaining() > 0 && comparator.compare(startColumn, curColPosition.firstName) < 0))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((startColumn.length > 0 && comparator.compare(startColumn, curColPosition.lastName) > 0) ||
|
||||
(finishColumn.length > 0 && comparator.compare(finishColumn, curColPosition.firstName) < 0))
|
||||
if ((startColumn.remaining() > 0 && comparator.compare(startColumn, curColPosition.lastName) > 0) ||
|
||||
(finishColumn.remaining() > 0 && comparator.compare(finishColumn, curColPosition.firstName) < 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -184,9 +184,9 @@ class IndexedSliceReader extends AbstractIterator<IColumn> implements IColumnIte
|
|||
blockColumns.addLast(column);
|
||||
|
||||
/* see if we can stop seeking. */
|
||||
if (!reversed && finishColumn.length > 0)
|
||||
if (!reversed && finishColumn.remaining() > 0)
|
||||
outOfBounds = comparator.compare(column.name(), finishColumn) >= 0;
|
||||
else if (reversed && startColumn.length > 0)
|
||||
else if (reversed && startColumn.remaining() > 0)
|
||||
outOfBounds = comparator.compare(column.name(), startColumn) >= 0;
|
||||
}
|
||||
|
||||
|
|
@ -213,9 +213,9 @@ class IndexedSliceReader extends AbstractIterator<IColumn> implements IColumnIte
|
|||
|
||||
/* see if we can stop seeking. */
|
||||
boolean outOfBounds = false;
|
||||
if (!reversed && finishColumn.length > 0)
|
||||
if (!reversed && finishColumn.remaining() > 0)
|
||||
outOfBounds = comparator.compare(column.name(), finishColumn) >= 0;
|
||||
else if (reversed && startColumn.length > 0)
|
||||
else if (reversed && startColumn.remaining() > 0)
|
||||
outOfBounds = comparator.compare(column.name(), startColumn) >= 0;
|
||||
if (outOfBounds)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ package org.apache.cassandra.db.columniterator;
|
|||
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
|
|
@ -39,6 +41,8 @@ import org.apache.cassandra.io.util.FileDataInput;
|
|||
import org.apache.cassandra.io.util.FileMark;
|
||||
import org.apache.cassandra.utils.BloomFilter;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SSTableNamesIterator extends SimpleAbstractColumnIterator implements IColumnIterator
|
||||
{
|
||||
|
|
@ -46,10 +50,10 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
|
||||
private ColumnFamily cf;
|
||||
private Iterator<IColumn> iter;
|
||||
public final SortedSet<byte[]> columns;
|
||||
public final SortedSet<ByteBuffer> columns;
|
||||
public final DecoratedKey key;
|
||||
|
||||
public SSTableNamesIterator(SSTableReader sstable, DecoratedKey key, SortedSet<byte[]> columns)
|
||||
public SSTableNamesIterator(SSTableReader sstable, DecoratedKey key, SortedSet<ByteBuffer> columns)
|
||||
{
|
||||
assert columns != null;
|
||||
this.columns = columns;
|
||||
|
|
@ -85,7 +89,7 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
}
|
||||
}
|
||||
|
||||
public SSTableNamesIterator(CFMetaData metadata, FileDataInput file, DecoratedKey key, SortedSet<byte[]> columns)
|
||||
public SSTableNamesIterator(CFMetaData metadata, FileDataInput file, DecoratedKey key, SortedSet<ByteBuffer> columns)
|
||||
{
|
||||
assert columns != null;
|
||||
this.columns = columns;
|
||||
|
|
@ -114,8 +118,8 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
// we can't stop before initializing the cf above, in case there's a relevant tombstone
|
||||
cf = ColumnFamily.serializer().deserializeFromSSTableNoColumns(ColumnFamily.create(metadata), file);
|
||||
|
||||
List<byte[]> filteredColumnNames = new ArrayList<byte[]>(columns.size());
|
||||
for (byte[] name : columns)
|
||||
List<ByteBuffer> filteredColumnNames = new ArrayList<ByteBuffer>(columns.size());
|
||||
for (ByteBuffer name : columns)
|
||||
{
|
||||
if (bf.isPresent(name))
|
||||
{
|
||||
|
|
@ -134,7 +138,7 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
iter = cf.getSortedColumns().iterator();
|
||||
}
|
||||
|
||||
private void readSimpleColumns(FileDataInput file, SortedSet<byte[]> columnNames, List<byte[]> filteredColumnNames) throws IOException
|
||||
private void readSimpleColumns(FileDataInput file, SortedSet<ByteBuffer> columnNames, List<ByteBuffer> filteredColumnNames) throws IOException
|
||||
{
|
||||
int columns = file.readInt();
|
||||
int n = 0;
|
||||
|
|
@ -150,7 +154,7 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
}
|
||||
}
|
||||
|
||||
private void readIndexedColumns(CFMetaData metadata, FileDataInput file, SortedSet<byte[]> columnNames, List<byte[]> filteredColumnNames, List<IndexHelper.IndexInfo> indexList)
|
||||
private void readIndexedColumns(CFMetaData metadata, FileDataInput file, SortedSet<ByteBuffer> columnNames, List<ByteBuffer> filteredColumnNames, List<IndexHelper.IndexInfo> indexList)
|
||||
throws IOException
|
||||
{
|
||||
file.readInt(); // column count
|
||||
|
|
@ -158,7 +162,7 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator implement
|
|||
/* get the various column ranges we have to read */
|
||||
AbstractType comparator = metadata.comparator;
|
||||
SortedSet<IndexHelper.IndexInfo> ranges = new TreeSet<IndexHelper.IndexInfo>(IndexHelper.getComparator(comparator));
|
||||
for (byte[] name : filteredColumnNames)
|
||||
for (ByteBuffer name : filteredColumnNames)
|
||||
{
|
||||
int index = IndexHelper.indexFor(name, indexList, comparator, false);
|
||||
if (index == indexList.size())
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ package org.apache.cassandra.db.columniterator;
|
|||
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.util.FileDataInput;
|
||||
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +43,7 @@ public class SSTableSliceIterator implements IColumnIterator
|
|||
private IColumnIterator reader;
|
||||
private DecoratedKey key;
|
||||
|
||||
public SSTableSliceIterator(SSTableReader sstable, DecoratedKey key, byte[] startColumn, byte[] finishColumn, boolean reversed)
|
||||
public SSTableSliceIterator(SSTableReader sstable, DecoratedKey key, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed)
|
||||
{
|
||||
this.key = key;
|
||||
fileToClose = sstable.getFileDataInput(this.key, DatabaseDescriptor.getSlicedReadBufferSizeInKB() * 1024);
|
||||
|
|
@ -79,16 +79,16 @@ public class SSTableSliceIterator implements IColumnIterator
|
|||
* @param finishColumn The end of the slice
|
||||
* @param reversed Results are returned in reverse order iff reversed is true.
|
||||
*/
|
||||
public SSTableSliceIterator(CFMetaData metadata, FileDataInput file, DecoratedKey key, byte[] startColumn, byte[] finishColumn, boolean reversed)
|
||||
public SSTableSliceIterator(CFMetaData metadata, FileDataInput file, DecoratedKey key, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed)
|
||||
{
|
||||
this.key = key;
|
||||
fileToClose = null;
|
||||
reader = createReader(metadata, file, startColumn, finishColumn, reversed);
|
||||
}
|
||||
|
||||
private static IColumnIterator createReader(CFMetaData metadata, FileDataInput file, byte[] startColumn, byte[] finishColumn, boolean reversed)
|
||||
private static IColumnIterator createReader(CFMetaData metadata, FileDataInput file, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed)
|
||||
{
|
||||
return startColumn.length == 0 && !reversed
|
||||
return startColumn.remaining() == 0 && !reversed
|
||||
? new SimpleSliceReader(metadata, file, finishColumn)
|
||||
: new IndexedSliceReader(metadata, file, startColumn, finishColumn, reversed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ package org.apache.cassandra.db.columniterator;
|
|||
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
|
|
@ -39,14 +40,14 @@ import org.apache.cassandra.io.util.FileMark;
|
|||
class SimpleSliceReader extends AbstractIterator<IColumn> implements IColumnIterator
|
||||
{
|
||||
private final FileDataInput file;
|
||||
private final byte[] finishColumn;
|
||||
private final ByteBuffer finishColumn;
|
||||
private final AbstractType comparator;
|
||||
private final ColumnFamily emptyColumnFamily;
|
||||
private final int columns;
|
||||
private int i;
|
||||
private FileMark mark;
|
||||
|
||||
public SimpleSliceReader(CFMetaData metadata, FileDataInput input, byte[] finishColumn)
|
||||
public SimpleSliceReader(CFMetaData metadata, FileDataInput input, ByteBuffer finishColumn)
|
||||
{
|
||||
this.file = input;
|
||||
this.finishColumn = finishColumn;
|
||||
|
|
@ -81,7 +82,7 @@ class SimpleSliceReader extends AbstractIterator<IColumn> implements IColumnIter
|
|||
{
|
||||
throw new RuntimeException("error reading " + i + " of " + columns, e);
|
||||
}
|
||||
if (finishColumn.length > 0 && comparator.compare(column.name(), finishColumn) > 0)
|
||||
if (finishColumn.remaining() > 0 && comparator.compare(column.name(), finishColumn) > 0)
|
||||
return endOfData();
|
||||
|
||||
mark = file.mark();
|
||||
|
|
|
|||
|
|
@ -21,27 +21,35 @@ package org.apache.cassandra.db.filter;
|
|||
*/
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.IColumnContainer;
|
||||
import org.apache.cassandra.db.Memtable;
|
||||
import org.apache.cassandra.db.SuperColumn;
|
||||
import org.apache.cassandra.db.columniterator.IColumnIterator;
|
||||
import org.apache.cassandra.db.columniterator.SSTableNamesIterator;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.util.FileDataInput;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class NamesQueryFilter implements IFilter
|
||||
{
|
||||
public final SortedSet<byte[]> columns;
|
||||
public final SortedSet<ByteBuffer> columns;
|
||||
|
||||
public NamesQueryFilter(SortedSet<byte[]> columns)
|
||||
public NamesQueryFilter(SortedSet<ByteBuffer> columns)
|
||||
{
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public NamesQueryFilter(byte[] column)
|
||||
public NamesQueryFilter(ByteBuffer column)
|
||||
{
|
||||
this(FBUtilities.getSingleColumnSet(column));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,17 +21,28 @@ package org.apache.cassandra.db.filter;
|
|||
*/
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.IColumnContainer;
|
||||
import org.apache.cassandra.db.Memtable;
|
||||
import org.apache.cassandra.db.SuperColumn;
|
||||
import org.apache.cassandra.db.columniterator.IColumnIterator;
|
||||
import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.util.FileDataInput;
|
||||
import org.apache.cassandra.thrift.SlicePredicate;
|
||||
import org.apache.cassandra.thrift.SliceRange;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.ReducingIterator;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -84,7 +95,7 @@ public class QueryFilter
|
|||
}
|
||||
|
||||
// here so it can be used by SQF and NQF. non-package callers should call IFilter.getColumnComparator
|
||||
static Comparator<IColumn> getColumnComparator(final Comparator<byte[]> comparator)
|
||||
static Comparator<IColumn> getColumnComparator(final Comparator<ByteBuffer> comparator)
|
||||
{
|
||||
return new Comparator<IColumn>()
|
||||
{
|
||||
|
|
@ -105,7 +116,7 @@ public class QueryFilter
|
|||
|
||||
protected boolean isEqual(IColumn o1, IColumn o2)
|
||||
{
|
||||
return Arrays.equals(o1.name(), o2.name());
|
||||
return ByteBufferUtil.equals(o1.name(), o2.name());
|
||||
}
|
||||
|
||||
public void reduce(IColumn current)
|
||||
|
|
@ -128,7 +139,8 @@ public class QueryFilter
|
|||
c = filter.filterSuperColumn((SuperColumn)c, gcBefore);
|
||||
((SuperColumn)c).markForDeleteAt(c.getLocalDeletionTime(), deletedAt); // reset sc tombstone time to what it should be
|
||||
}
|
||||
curCF.clear();
|
||||
curCF.clear();
|
||||
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
|
@ -159,7 +171,7 @@ public class QueryFilter
|
|||
* @param reversed true to start with the largest column (as determined by configured sort order) instead of smallest
|
||||
* @param limit maximum number of non-deleted columns to return
|
||||
*/
|
||||
public static QueryFilter getSliceFilter(DecoratedKey key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int limit)
|
||||
public static QueryFilter getSliceFilter(DecoratedKey key, QueryPath path, ByteBuffer start, ByteBuffer finish, boolean reversed, int limit)
|
||||
{
|
||||
return new QueryFilter(key, path, new SliceQueryFilter(start, finish, reversed, limit));
|
||||
}
|
||||
|
|
@ -179,7 +191,7 @@ public class QueryFilter
|
|||
* @param path path to the level to slice at (CF or SuperColumn)
|
||||
* @param columns the column names to restrict the results to
|
||||
*/
|
||||
public static QueryFilter getNamesFilter(DecoratedKey key, QueryPath path, SortedSet<byte[]> columns)
|
||||
public static QueryFilter getNamesFilter(DecoratedKey key, QueryPath path, SortedSet<ByteBuffer> columns)
|
||||
{
|
||||
return new QueryFilter(key, path, new NamesQueryFilter(columns));
|
||||
}
|
||||
|
|
@ -188,7 +200,7 @@ public class QueryFilter
|
|||
{
|
||||
if (predicate.column_names != null)
|
||||
{
|
||||
final SortedSet<byte[]> columnNameSet = new TreeSet<byte[]>(comparator);
|
||||
final SortedSet<ByteBuffer> columnNameSet = new TreeSet<ByteBuffer>(comparator);
|
||||
columnNameSet.addAll(predicate.column_names);
|
||||
return new NamesQueryFilter(columnNameSet);
|
||||
}
|
||||
|
|
@ -200,7 +212,7 @@ public class QueryFilter
|
|||
/**
|
||||
* convenience method for creating a name filter matching a single column
|
||||
*/
|
||||
public static QueryFilter getNamesFilter(DecoratedKey key, QueryPath path, byte[] column)
|
||||
public static QueryFilter getNamesFilter(DecoratedKey key, QueryPath path, ByteBuffer column)
|
||||
{
|
||||
return new QueryFilter(key, path, new NamesQueryFilter(column));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,24 +21,23 @@ package org.apache.cassandra.db.filter;
|
|||
*/
|
||||
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.thrift.ColumnParent;
|
||||
import org.apache.cassandra.thrift.ColumnPath;
|
||||
import org.apache.cassandra.db.ColumnSerializer;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
public class QueryPath
|
||||
{
|
||||
public final String columnFamilyName;
|
||||
public final byte[] superColumnName;
|
||||
public final byte[] columnName;
|
||||
public final ByteBuffer superColumnName;
|
||||
public final ByteBuffer columnName;
|
||||
|
||||
public QueryPath(String columnFamilyName, byte[] superColumnName, byte[] columnName)
|
||||
public QueryPath(String columnFamilyName, ByteBuffer superColumnName, ByteBuffer columnName)
|
||||
{
|
||||
this.columnFamilyName = columnFamilyName;
|
||||
this.superColumnName = superColumnName;
|
||||
|
|
@ -50,7 +49,7 @@ public class QueryPath
|
|||
this(columnParent.column_family, columnParent.super_column, null);
|
||||
}
|
||||
|
||||
public QueryPath(String columnFamilyName, byte[] superColumnName)
|
||||
public QueryPath(String columnFamilyName, ByteBuffer superColumnName)
|
||||
{
|
||||
this(columnFamilyName, superColumnName, null);
|
||||
}
|
||||
|
|
@ -65,7 +64,7 @@ public class QueryPath
|
|||
this(column_path.column_family, column_path.super_column, column_path.column);
|
||||
}
|
||||
|
||||
public static QueryPath column(byte[] columnName)
|
||||
public static QueryPath column(ByteBuffer columnName)
|
||||
{
|
||||
return new QueryPath(null, null, columnName);
|
||||
}
|
||||
|
|
@ -83,18 +82,20 @@ public class QueryPath
|
|||
public void serialize(DataOutputStream dos) throws IOException
|
||||
{
|
||||
assert !"".equals(columnFamilyName);
|
||||
assert superColumnName == null || superColumnName.length > 0;
|
||||
assert columnName == null || columnName.length > 0;
|
||||
assert superColumnName == null || superColumnName.remaining() > 0;
|
||||
assert columnName == null || columnName.remaining() > 0;
|
||||
dos.writeUTF(columnFamilyName == null ? "" : columnFamilyName);
|
||||
FBUtilities.writeShortByteArray(superColumnName == null ? ArrayUtils.EMPTY_BYTE_ARRAY : superColumnName, dos);
|
||||
FBUtilities.writeShortByteArray(columnName == null ? ArrayUtils.EMPTY_BYTE_ARRAY : columnName, dos);
|
||||
FBUtilities.writeShortByteArray(superColumnName == null ? FBUtilities.EMPTY_BYTE_BUFFER : superColumnName, dos);
|
||||
FBUtilities.writeShortByteArray(columnName == null ? FBUtilities.EMPTY_BYTE_BUFFER : columnName, dos);
|
||||
}
|
||||
|
||||
public static QueryPath deserialize(DataInputStream din) throws IOException
|
||||
{
|
||||
String cfName = din.readUTF();
|
||||
byte[] scName = FBUtilities.readShortByteArray(din);
|
||||
byte[] cName = FBUtilities.readShortByteArray(din);
|
||||
return new QueryPath(cfName.isEmpty() ? null : cfName, scName.length == 0 ? null : scName, cName.length == 0 ? null : cName);
|
||||
ByteBuffer scName = FBUtilities.readShortByteArray(din);
|
||||
ByteBuffer cName = FBUtilities.readShortByteArray(din);
|
||||
return new QueryPath(cfName.isEmpty() ? null : cfName,
|
||||
scName.remaining() == 0 ? null : scName,
|
||||
cName.remaining() == 0 ? null : cName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,32 +21,40 @@ package org.apache.cassandra.db.filter;
|
|||
*/
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.collections.comparators.ReverseComparator;
|
||||
import org.apache.commons.collections.iterators.ReverseListIterator;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.IColumnContainer;
|
||||
import org.apache.cassandra.db.Memtable;
|
||||
import org.apache.cassandra.db.SuperColumn;
|
||||
import org.apache.cassandra.db.columniterator.IColumnIterator;
|
||||
import org.apache.cassandra.db.columniterator.SSTableSliceIterator;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.sstable.SSTableReader;
|
||||
import org.apache.cassandra.io.util.FileDataInput;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.comparators.ReverseComparator;
|
||||
import org.apache.commons.collections.iterators.ReverseListIterator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SliceQueryFilter implements IFilter
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(SliceQueryFilter.class);
|
||||
|
||||
public final byte[] start;
|
||||
public final byte[] finish;
|
||||
public final ByteBuffer start;
|
||||
public final ByteBuffer finish;
|
||||
public final boolean reversed;
|
||||
public final int count;
|
||||
|
||||
public SliceQueryFilter(byte[] start, byte[] finish, boolean reversed, int count)
|
||||
public SliceQueryFilter(ByteBuffer start, ByteBuffer finish, boolean reversed, int count)
|
||||
{
|
||||
this.start = start;
|
||||
this.finish = finish;
|
||||
|
|
@ -86,7 +94,7 @@ public class SliceQueryFilter implements IFilter
|
|||
}
|
||||
|
||||
// iterate until we get to the "real" start column
|
||||
Comparator<byte[]> comparator = reversed ? superColumn.getComparator().getReverseComparator() : superColumn.getComparator();
|
||||
Comparator<ByteBuffer> comparator = reversed ? superColumn.getComparator().getReverseComparator() : superColumn.getComparator();
|
||||
while (subcolumns.hasNext())
|
||||
{
|
||||
IColumn column = subcolumns.next();
|
||||
|
|
@ -121,11 +129,11 @@ public class SliceQueryFilter implements IFilter
|
|||
logger.debug(String.format("collecting %s of %s: %s",
|
||||
liveColumns, count, column.getString(comparator)));
|
||||
|
||||
if (finish.length > 0
|
||||
if (finish.remaining() > 0
|
||||
&& ((!reversed && comparator.compare(column.name(), finish) > 0))
|
||||
|| (reversed && comparator.compare(column.name(), finish) < 0))
|
||||
break;
|
||||
|
||||
|
||||
// only count live columns towards the `count` criteria
|
||||
if (!column.isMarkedForDelete()
|
||||
&& (!container.isMarkedForDelete()
|
||||
|
|
|
|||
|
|
@ -21,41 +21,42 @@ package org.apache.cassandra.db.marshal;
|
|||
*/
|
||||
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
|
||||
/**
|
||||
* Specifies a Comparator for a specific type of byte[].
|
||||
* Specifies a Comparator for a specific type of ByteBuffer.
|
||||
*
|
||||
* Note that empty byte[] are used to represent "start at the beginning"
|
||||
* Note that empty ByteBuffer are used to represent "start at the beginning"
|
||||
* or "stop at the end" arguments to get_slice, so the Comparator
|
||||
* should always handle those values even if they normally do not
|
||||
* represent a valid byte[] for the type being compared.
|
||||
* represent a valid ByteBuffer for the type being compared.
|
||||
*/
|
||||
public abstract class AbstractType implements Comparator<byte[]>
|
||||
public abstract class AbstractType implements Comparator<ByteBuffer>
|
||||
{
|
||||
/** get a string representation of the bytes suitable for log messages */
|
||||
public abstract String getString(byte[] bytes);
|
||||
public abstract String getString(ByteBuffer bytes);
|
||||
|
||||
/** validate that the byte array is a valid sequence for the type we are supposed to be comparing */
|
||||
public void validate(byte[] bytes)
|
||||
public void validate(ByteBuffer bytes)
|
||||
{
|
||||
getString(bytes);
|
||||
}
|
||||
|
||||
public Comparator<byte[]> getReverseComparator()
|
||||
public Comparator<ByteBuffer> getReverseComparator()
|
||||
{
|
||||
return new Comparator<byte[]>()
|
||||
return new Comparator<ByteBuffer>()
|
||||
{
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
if (o1.length == 0)
|
||||
if (o1.remaining() == 0)
|
||||
{
|
||||
return o2.length == 0 ? 0 : -1;
|
||||
return o2.remaining() == 0 ? 0 : -1;
|
||||
}
|
||||
if (o2.length == 0)
|
||||
if (o2.remaining() == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -66,10 +67,10 @@ public abstract class AbstractType implements Comparator<byte[]>
|
|||
}
|
||||
|
||||
/** convenience method */
|
||||
public String getString(Collection<byte[]> names)
|
||||
public String getString(Collection<ByteBuffer> names)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (byte[] name : names)
|
||||
for (ByteBuffer name : names)
|
||||
{
|
||||
builder.append(getString(name)).append(",");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.apache.cassandra.db.marshal;
|
|||
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class AsciiType extends BytesType
|
||||
{
|
||||
|
|
@ -30,11 +31,11 @@ public class AsciiType extends BytesType
|
|||
AsciiType() {} // singleton
|
||||
|
||||
@Override
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new String(bytes, "US-ASCII");
|
||||
return new String(bytes.array(),bytes.position()+bytes.arrayOffset(),bytes.remaining(), "US-ASCII");
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ package org.apache.cassandra.db.marshal;
|
|||
*/
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class BytesType extends AbstractType
|
||||
|
|
@ -31,12 +32,17 @@ public class BytesType extends AbstractType
|
|||
|
||||
BytesType() {} // singleton
|
||||
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
return FBUtilities.compareByteArrays(o1, o2);
|
||||
if(null == o1){
|
||||
if(null == o2) return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
return ByteBufferUtil.compare(o1, o2);
|
||||
}
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
return FBUtilities.bytesToHex(bytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,20 +19,22 @@
|
|||
|
||||
package org.apache.cassandra.db.marshal;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public final class IntegerType extends AbstractType
|
||||
{
|
||||
public static final IntegerType instance = new IntegerType();
|
||||
|
||||
private static int findMostSignificantByte(byte[] bytes)
|
||||
private static int findMostSignificantByte(ByteBuffer bytes)
|
||||
{
|
||||
int len = bytes.length - 1;
|
||||
int len = bytes.remaining() - 1;
|
||||
int i = 0;
|
||||
for (; i < len; i++)
|
||||
{
|
||||
byte b0 = bytes[i];
|
||||
byte b0 = bytes.array()[bytes.position()+bytes.arrayOffset()+i];
|
||||
if (b0 != 0 && b0 != -1)
|
||||
break;
|
||||
byte b1 = bytes[i + 1];
|
||||
byte b1 = bytes.array()[bytes.position()+bytes.arrayOffset()+ i + 1];
|
||||
if (b0 == 0 && b1 != 0)
|
||||
{
|
||||
if (b1 > 0)
|
||||
|
|
@ -51,10 +53,10 @@ public final class IntegerType extends AbstractType
|
|||
|
||||
IntegerType() {/* singleton */}
|
||||
|
||||
public int compare(byte[] lhs, byte[] rhs)
|
||||
public int compare(ByteBuffer lhs, ByteBuffer rhs)
|
||||
{
|
||||
int lhsLen = lhs.length;
|
||||
int rhsLen = rhs.length;
|
||||
int lhsLen = lhs.remaining();
|
||||
int rhsLen = rhs.remaining();
|
||||
|
||||
if (lhsLen == 0)
|
||||
return rhsLen == 0 ? 0 : -1;
|
||||
|
|
@ -68,8 +70,8 @@ public final class IntegerType extends AbstractType
|
|||
int lhsLenDiff = lhsLen - lhsMsbIdx;
|
||||
int rhsLenDiff = rhsLen - rhsMsbIdx;
|
||||
|
||||
byte lhsMsb = lhs[lhsMsbIdx];
|
||||
byte rhsMsb = rhs[rhsMsbIdx];
|
||||
byte lhsMsb = lhs.array()[lhs.position()+lhs.arrayOffset()+lhsMsbIdx];
|
||||
byte rhsMsb = rhs.array()[rhs.position()+rhs.arrayOffset()+rhsMsbIdx];
|
||||
|
||||
/* + -
|
||||
* -----------
|
||||
|
|
@ -99,8 +101,8 @@ public final class IntegerType extends AbstractType
|
|||
// remaining bytes are compared unsigned
|
||||
while (lhsMsbIdx < lhsLen)
|
||||
{
|
||||
lhsMsb = lhs[lhsMsbIdx++];
|
||||
rhsMsb = rhs[rhsMsbIdx++];
|
||||
lhsMsb = lhs.array()[lhs.position()+lhs.arrayOffset()+lhsMsbIdx++];
|
||||
rhsMsb = rhs.array()[rhs.position()+rhs.arrayOffset()+rhsMsbIdx++];
|
||||
if (lhsMsb != rhsMsb)
|
||||
return (lhsMsb & 0xFF) - (rhsMsb & 0xFF);
|
||||
}
|
||||
|
|
@ -109,13 +111,13 @@ public final class IntegerType extends AbstractType
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
return "null";
|
||||
if (bytes.length == 0)
|
||||
if (bytes.remaining() == 0)
|
||||
return "empty";
|
||||
|
||||
return new java.math.BigInteger(bytes).toString(10);
|
||||
return new java.math.BigInteger(bytes.array()).toString(10);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,25 +24,26 @@ package org.apache.cassandra.db.marshal;
|
|||
import java.util.UUID;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
|
||||
public class LexicalUUIDType extends AbstractType
|
||||
{
|
||||
public static final LexicalUUIDType instance = new LexicalUUIDType();
|
||||
|
||||
LexicalUUIDType() {} // singleton
|
||||
|
||||
static UUID getUUID(byte[] bytes)
|
||||
static UUID getUUID(ByteBuffer bytes)
|
||||
{
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
return new UUID(bb.getLong(), bb.getLong());
|
||||
return new UUID(bytes.getLong(bytes.position()+bytes.arrayOffset()), bytes.getLong(bytes.position()+bytes.arrayOffset()));
|
||||
}
|
||||
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
if (o1.length == 0)
|
||||
if (o1.remaining() == 0)
|
||||
{
|
||||
return o2.length == 0 ? 0 : -1;
|
||||
return o2.remaining() == 0 ? 0 : -1;
|
||||
}
|
||||
if (o2.length == 0)
|
||||
if (o2.remaining() == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -50,13 +51,13 @@ public class LexicalUUIDType extends AbstractType
|
|||
return getUUID(o1).compareTo(getUUID(o2));
|
||||
}
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
if (bytes.remaining() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 16)
|
||||
if (bytes.remaining() != 16)
|
||||
{
|
||||
throw new MarshalException("UUIDs must be exactly 16 bytes");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.apache.cassandra.db.marshal;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.dht.Token;
|
||||
|
||||
|
|
@ -33,12 +35,12 @@ public class LocalByPartionerType<T extends Token> extends AbstractType
|
|||
this.partitioner = partitioner;
|
||||
}
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
return partitioner.decorateKey(o1).compareTo(partitioner.decorateKey(o2));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ package org.apache.cassandra.db.marshal;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
|
||||
public class LongType extends AbstractType
|
||||
{
|
||||
|
|
@ -31,33 +31,37 @@ public class LongType extends AbstractType
|
|||
|
||||
LongType() {} // singleton
|
||||
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
if (o1.length == 0)
|
||||
if (o1.remaining() == 0)
|
||||
{
|
||||
return o2.length == 0 ? 0 : -1;
|
||||
return o2.remaining() == 0 ? 0 : -1;
|
||||
}
|
||||
if (o2.length == 0)
|
||||
if (o2.remaining() == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int diff = o1[0] - o2[0];
|
||||
int diff = o1.array()[o1.position()+o1.arrayOffset()] - o2.array()[o2.position()+o2.arrayOffset()];
|
||||
if (diff != 0)
|
||||
return diff;
|
||||
return FBUtilities.compareByteArrays(o1, o2);
|
||||
|
||||
|
||||
return ByteBufferUtil.compare(o1, o2);
|
||||
}
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
if (bytes.remaining() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 8)
|
||||
if (bytes.remaining() != 8)
|
||||
{
|
||||
throw new MarshalException("A long is exactly 8 bytes");
|
||||
throw new MarshalException("A long is exactly 8 bytes: "+bytes.remaining());
|
||||
}
|
||||
return String.valueOf(ByteBuffer.wrap(bytes).getLong());
|
||||
|
||||
|
||||
return String.valueOf(bytes.getLong(bytes.position()+bytes.arrayOffset()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ package org.apache.cassandra.db.marshal;
|
|||
*/
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class TimeUUIDType extends AbstractType
|
||||
|
|
@ -30,48 +32,51 @@ public class TimeUUIDType extends AbstractType
|
|||
|
||||
TimeUUIDType() {} // singleton
|
||||
|
||||
public int compare(byte[] o1, byte[] o2)
|
||||
public int compare(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
if (o1.length == 0)
|
||||
if (o1.remaining() == 0)
|
||||
{
|
||||
return o2.length == 0 ? 0 : -1;
|
||||
return o2.remaining() == 0 ? 0 : -1;
|
||||
}
|
||||
if (o2.length == 0)
|
||||
if (o2.remaining() == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int res = compareTimestampBytes(o1, o2);
|
||||
if (res != 0)
|
||||
return res;
|
||||
return FBUtilities.compareByteArrays(o1, o2);
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
|
||||
private static int compareTimestampBytes(byte[] o1, byte[] o2)
|
||||
private static int compareTimestampBytes(ByteBuffer o1, ByteBuffer o2)
|
||||
{
|
||||
int d = (o1[6] & 0xF) - (o2[6] & 0xF);
|
||||
int o1Pos = o1.position()+o1.arrayOffset();
|
||||
int o2Pos = o2.position()+o2.arrayOffset();
|
||||
|
||||
int d = (o1.array()[o1Pos+6] & 0xF) - (o2.array()[o2Pos+6] & 0xF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[7] & 0xFF) - (o2[7] & 0xFF);
|
||||
d = (o1.array()[o1Pos+7] & 0xFF) - (o2.array()[o2Pos+7] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[4] & 0xFF) - (o2[4] & 0xFF);
|
||||
d = (o1.array()[o1Pos+4] & 0xFF) - (o2.array()[o2Pos+4] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[5] & 0xFF) - (o2[5] & 0xFF);
|
||||
d = (o1.array()[o1Pos+5] & 0xFF) - (o2.array()[o2Pos+5] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[0] & 0xFF) - (o2[0] & 0xFF);
|
||||
d = (o1.array()[o1Pos+0] & 0xFF) - (o2.array()[o2Pos+0] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[1] & 0xFF) - (o2[1] & 0xFF);
|
||||
d = (o1.array()[o1Pos+1] & 0xFF) - (o2.array()[o2Pos+1] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
d = (o1[2] & 0xFF) - (o2[2] & 0xFF);
|
||||
d = (o1.array()[o1Pos+2] & 0xFF) - (o2.array()[o2Pos+2] & 0xFF);
|
||||
if (d != 0) return d;
|
||||
return (o1[3] & 0xFF) - (o2[3] & 0xFF);
|
||||
return (o1.array()[o1Pos+3] & 0xFF) - (o2.array()[o2Pos+3] & 0xFF);
|
||||
}
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
if (bytes.remaining() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 16)
|
||||
if (bytes.remaining() != 16)
|
||||
{
|
||||
throw new MarshalException("UUIDs must be exactly 16 bytes");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.cassandra.db.marshal;
|
|||
*
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ public class UTF8Type extends BytesType
|
|||
|
||||
UTF8Type() {} // singleton
|
||||
|
||||
public String getString(byte[] bytes)
|
||||
public String getString(ByteBuffer bytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ public class UTF8Type extends BytesType
|
|||
}
|
||||
catch (CharacterCodingException e)
|
||||
{
|
||||
throw new MarshalException("invalid UTF8 bytes " + Arrays.toString(bytes));
|
||||
throw new MarshalException("invalid UTF8 bytes " + Arrays.toString(bytes.array()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ public abstract class Migration
|
|||
public static final String NAME_VALIDATOR_REGEX = "\\w+";
|
||||
public static final String MIGRATIONS_CF = "Migrations";
|
||||
public static final String SCHEMA_CF = "Schema";
|
||||
public static final byte[] MIGRATIONS_KEY = "Migrations Key".getBytes(UTF_8);
|
||||
public static final byte[] LAST_MIGRATION_KEY = "Last Migration".getBytes(UTF_8);
|
||||
public static final ByteBuffer MIGRATIONS_KEY = ByteBuffer.wrap("Migrations Key".getBytes(UTF_8));
|
||||
public static final ByteBuffer LAST_MIGRATION_KEY = ByteBuffer.wrap("Last Migration".getBytes(UTF_8));
|
||||
|
||||
protected RowMutation rm;
|
||||
protected UUID newVersion;
|
||||
|
|
@ -111,15 +111,15 @@ public abstract class Migration
|
|||
if (!clientMode)
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
byte[] buf = serialize();
|
||||
ByteBuffer buf = serialize();
|
||||
RowMutation migration = new RowMutation(Table.SYSTEM_TABLE, MIGRATIONS_KEY);
|
||||
migration.add(new QueryPath(MIGRATIONS_CF, null, UUIDGen.decompose(newVersion)), buf, now);
|
||||
migration.add(new QueryPath(MIGRATIONS_CF, null, ByteBuffer.wrap(UUIDGen.decompose(newVersion))), buf, now);
|
||||
migration.apply();
|
||||
|
||||
// note that we're storing this in the system table, which is not replicated
|
||||
logger.debug("Applying migration " + newVersion.toString());
|
||||
migration = new RowMutation(Table.SYSTEM_TABLE, LAST_MIGRATION_KEY);
|
||||
migration.add(new QueryPath(SCHEMA_CF, null, LAST_MIGRATION_KEY), UUIDGen.decompose(newVersion), now);
|
||||
migration.add(new QueryPath(SCHEMA_CF, null, LAST_MIGRATION_KEY), ByteBuffer.wrap(UUIDGen.decompose(newVersion)), now);
|
||||
migration.apply();
|
||||
|
||||
// if we fail here, there will be schema changes in the CL that will get replayed *AFTER* the schema is loaded.
|
||||
|
|
@ -218,17 +218,17 @@ public abstract class Migration
|
|||
long now = System.currentTimeMillis();
|
||||
// add a column for each keyspace
|
||||
for (KSMetaData ksm : ksms)
|
||||
rm.add(new QueryPath(SCHEMA_CF, null, ksm.name.getBytes(UTF_8)), SerDeUtils.serialize(ksm.deflate()), now);
|
||||
rm.add(new QueryPath(SCHEMA_CF, null, ByteBuffer.wrap(ksm.name.getBytes(UTF_8))), SerDeUtils.serialize(ksm.deflate()), now);
|
||||
// add the schema
|
||||
rm.add(new QueryPath(SCHEMA_CF,
|
||||
null,
|
||||
DefsTable.DEFINITION_SCHEMA_COLUMN_NAME),
|
||||
org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
|
||||
ByteBuffer.wrap(org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
|
||||
now);
|
||||
return rm;
|
||||
}
|
||||
|
||||
public byte[] serialize() throws IOException
|
||||
public ByteBuffer serialize() throws IOException
|
||||
{
|
||||
// super deflate
|
||||
org.apache.cassandra.db.migration.avro.Migration mi = new org.apache.cassandra.db.migration.avro.Migration();
|
||||
|
|
@ -256,7 +256,7 @@ public abstract class Migration
|
|||
return SerDeUtils.serializeWithSchema(mi);
|
||||
}
|
||||
|
||||
public static Migration deserialize(byte[] bytes) throws IOException
|
||||
public static Migration deserialize(ByteBuffer bytes) throws IOException
|
||||
{
|
||||
// deserialize
|
||||
org.apache.cassandra.db.migration.avro.Migration mi = SerDeUtils.deserializeWithSchema(bytes, new org.apache.cassandra.db.migration.avro.Migration());
|
||||
|
|
@ -276,8 +276,8 @@ public abstract class Migration
|
|||
}
|
||||
|
||||
// super inflate
|
||||
migration.lastVersion = UUIDGen.makeType1UUID(mi.old_version.bytes());
|
||||
migration.newVersion = UUIDGen.makeType1UUID(mi.new_version.bytes());
|
||||
migration.lastVersion = UUIDGen.makeType1UUID(ByteBuffer.wrap(mi.old_version.bytes()));
|
||||
migration.newVersion = UUIDGen.makeType1UUID(ByteBuffer.wrap(mi.new_version.bytes()));
|
||||
try
|
||||
{
|
||||
migration.rm = RowMutation.serializer().deserialize(SerDeUtils.createDataInputStream(mi.row_mutation));
|
||||
|
|
@ -297,14 +297,14 @@ public abstract class Migration
|
|||
DecoratedKey dkey = StorageService.getPartitioner().decorateKey(MIGRATIONS_KEY);
|
||||
Table defs = Table.open(Table.SYSTEM_TABLE);
|
||||
ColumnFamilyStore cfStore = defs.getColumnFamilyStore(Migration.MIGRATIONS_CF);
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(dkey, new QueryPath(MIGRATIONS_CF), UUIDGen.decompose(start), UUIDGen.decompose(end), false, 1000);
|
||||
QueryFilter filter = QueryFilter.getSliceFilter(dkey, new QueryPath(MIGRATIONS_CF), ByteBuffer.wrap(UUIDGen.decompose(start)), ByteBuffer.wrap(UUIDGen.decompose(end)), false, 1000);
|
||||
ColumnFamily cf = cfStore.getColumnFamily(filter);
|
||||
return cf.getSortedColumns();
|
||||
}
|
||||
|
||||
public static byte[] toUTF8Bytes(UUID version)
|
||||
public static ByteBuffer toUTF8Bytes(UUID version)
|
||||
{
|
||||
return version.toString().getBytes(UTF_8);
|
||||
return ByteBuffer.wrap(version.toString().getBytes(UTF_8));
|
||||
}
|
||||
|
||||
public static boolean isLegalName(String s)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
package org.apache.cassandra.db.migration;
|
||||
|
||||
import org.apache.cassandra.config.*;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.ColumnDefinition;
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.config.KSMetaData;
|
||||
import org.apache.cassandra.db.ColumnFamilyStore;
|
||||
import org.apache.cassandra.db.SystemTable;
|
||||
import org.apache.cassandra.db.Table;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.UUIDGen;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
|
@ -84,9 +89,9 @@ public class UpdateColumnFamily extends Migration
|
|||
table.reloadCf(newCfm.cfId);
|
||||
|
||||
// clean up obsolete index data files
|
||||
for (Map.Entry<byte[], ColumnDefinition> entry : oldCfm.column_metadata.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ColumnDefinition> entry : oldCfm.column_metadata.entrySet())
|
||||
{
|
||||
byte[] column = entry.getKey();
|
||||
ByteBuffer column = entry.getKey();
|
||||
ColumnDefinition def = entry.getValue();
|
||||
if (def.index_type != null
|
||||
&& (!newCfm.column_metadata.containsKey(column) || newCfm.column_metadata.get(column).index_type == null))
|
||||
|
|
|
|||
|
|
@ -19,17 +19,14 @@
|
|||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.text.Collator;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
public abstract class AbstractByteOrderedPartitioner implements IPartitioner<BytesToken>
|
||||
{
|
||||
|
|
@ -37,21 +34,45 @@ public abstract class AbstractByteOrderedPartitioner implements IPartitioner<Byt
|
|||
|
||||
public static final BigInteger BYTE_MASK = new BigInteger("255");
|
||||
|
||||
public DecoratedKey<BytesToken> decorateKey(byte[] key)
|
||||
public DecoratedKey<BytesToken> decorateKey(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<BytesToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public DecoratedKey<BytesToken> convertFromDiskFormat(byte[] key)
|
||||
public DecoratedKey<BytesToken> convertFromDiskFormat(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<BytesToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public BytesToken midpoint(BytesToken ltoken, BytesToken rtoken)
|
||||
public BytesToken midpoint(Token ltoken, Token rtoken)
|
||||
{
|
||||
int sigbytes = Math.max(ltoken.token.length, rtoken.token.length);
|
||||
BigInteger left = bigForBytes(ltoken.token, sigbytes);
|
||||
BigInteger right = bigForBytes(rtoken.token, sigbytes);
|
||||
int ll,rl;
|
||||
ByteBuffer lb,rb;
|
||||
|
||||
if(ltoken.token instanceof byte[])
|
||||
{
|
||||
ll = ((byte[])ltoken.token).length;
|
||||
lb = ByteBuffer.wrap(((byte[])ltoken.token));
|
||||
}
|
||||
else
|
||||
{
|
||||
ll = ((ByteBuffer)ltoken.token).remaining();
|
||||
lb = (ByteBuffer)ltoken.token;
|
||||
}
|
||||
|
||||
if(rtoken.token instanceof byte[])
|
||||
{
|
||||
rl = ((byte[])rtoken.token).length;
|
||||
rb = ByteBuffer.wrap(((byte[])rtoken.token));
|
||||
}
|
||||
else
|
||||
{
|
||||
rl = ((ByteBuffer)rtoken.token).remaining();
|
||||
rb = (ByteBuffer)rtoken.token;
|
||||
}
|
||||
int sigbytes = Math.max(ll, rl);
|
||||
BigInteger left = bigForBytes(lb, sigbytes);
|
||||
BigInteger right = bigForBytes(rb, sigbytes);
|
||||
|
||||
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 8*sigbytes);
|
||||
return new BytesToken(bytesForBig(midpair.left, sigbytes, midpair.right));
|
||||
|
|
@ -61,14 +82,23 @@ public abstract class AbstractByteOrderedPartitioner implements IPartitioner<Byt
|
|||
* Convert a byte array containing the most significant of 'sigbytes' bytes
|
||||
* representing a big-endian magnitude into a BigInteger.
|
||||
*/
|
||||
private BigInteger bigForBytes(byte[] bytes, int sigbytes)
|
||||
private BigInteger bigForBytes(ByteBuffer bytes, int sigbytes)
|
||||
{
|
||||
if (bytes.length != sigbytes)
|
||||
byte[] b = new byte[sigbytes];
|
||||
|
||||
// append zeros
|
||||
Arrays.fill(b, (byte) 0);
|
||||
|
||||
if (bytes.remaining() != sigbytes)
|
||||
{
|
||||
System.arraycopy(bytes.array(), bytes.position()+bytes.arrayOffset(), b, 0, bytes.remaining());
|
||||
}
|
||||
else
|
||||
{
|
||||
// append zeros
|
||||
bytes = Arrays.copyOf(bytes, sigbytes);
|
||||
System.arraycopy(bytes.array(), bytes.position()+bytes.arrayOffset(), b, 0, sigbytes);
|
||||
}
|
||||
return new BigInteger(1, bytes);
|
||||
|
||||
return new BigInteger(1, b);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -108,19 +138,19 @@ public abstract class AbstractByteOrderedPartitioner implements IPartitioner<Byt
|
|||
}
|
||||
|
||||
private final Token.TokenFactory<byte[]> tokenFactory = new Token.TokenFactory<byte[]>() {
|
||||
public byte[] toByteArray(Token<byte[]> bytesToken)
|
||||
public ByteBuffer toByteArray(Token<byte[]> bytesToken)
|
||||
{
|
||||
return bytesToken.token;
|
||||
return ByteBuffer.wrap(bytesToken.token);
|
||||
}
|
||||
|
||||
public Token<byte[]> fromByteArray(byte[] bytes)
|
||||
public Token<byte[]> fromByteArray(ByteBuffer bytes)
|
||||
{
|
||||
return new BytesToken(bytes);
|
||||
}
|
||||
|
||||
public String toString(Token<byte[]> bytesToken)
|
||||
{
|
||||
return FBUtilities.bytesToHex(bytesToken.token);
|
||||
return FBUtilities.bytesToHex(ByteBuffer.wrap(bytesToken.token));
|
||||
}
|
||||
|
||||
public Token<byte[]> fromString(String string)
|
||||
|
|
@ -139,5 +169,5 @@ public abstract class AbstractByteOrderedPartitioner implements IPartitioner<Byt
|
|||
return true;
|
||||
}
|
||||
|
||||
public abstract BytesToken getToken(byte[] key);
|
||||
public abstract BytesToken getToken(ByteBuffer key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class ByteOrderedPartitioner extends AbstractByteOrderedPartitioner
|
||||
{
|
||||
public BytesToken getToken(byte[] key)
|
||||
public BytesToken getToken(ByteBuffer key)
|
||||
{
|
||||
if (key.length == 0)
|
||||
if (key.remaining() == 0)
|
||||
return MINIMUM;
|
||||
return new BytesToken(key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,28 +18,54 @@
|
|||
*/
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class BytesToken extends Token<byte[]>
|
||||
{
|
||||
public BytesToken(byte... token)
|
||||
public BytesToken(ByteBuffer token)
|
||||
{
|
||||
super(convertByteBuffer(token));
|
||||
}
|
||||
|
||||
public BytesToken(byte[] token)
|
||||
{
|
||||
super(token);
|
||||
}
|
||||
|
||||
private static byte[] convertByteBuffer(ByteBuffer token)
|
||||
{
|
||||
if(token.position() == 0 && token.arrayOffset() == 0 &&
|
||||
token.limit() == token.capacity())
|
||||
{
|
||||
return token.array();
|
||||
}
|
||||
else
|
||||
{
|
||||
token.mark();
|
||||
byte[] buf = new byte[token.remaining()];
|
||||
token.get(buf);
|
||||
token.reset();
|
||||
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Token(bytes[" + FBUtilities.bytesToHex(token) + "])";
|
||||
return "Token(bytes[" + FBUtilities.bytesToHex(ByteBuffer.wrap(token)) + "])";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Token<byte[]> o)
|
||||
{
|
||||
return FBUtilities.compareByteArrays(token, o.token);
|
||||
{
|
||||
return FBUtilities.compareByteArrays(token, o.token, 0, 0, token.length, o.token.length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
|
|
@ -56,6 +82,7 @@ public class BytesToken extends Token<byte[]>
|
|||
if (!(obj instanceof BytesToken))
|
||||
return false;
|
||||
BytesToken other = (BytesToken) obj;
|
||||
|
||||
return Arrays.equals(token, other.token);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,27 +18,20 @@
|
|||
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.text.Collator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
|
||||
public class CollatingOrderPreservingPartitioner extends AbstractByteOrderedPartitioner
|
||||
{
|
||||
static final Collator collator = Collator.getInstance(new Locale("en", "US"));
|
||||
|
||||
public BytesToken getToken(byte[] key)
|
||||
public BytesToken getToken(ByteBuffer key)
|
||||
{
|
||||
if (key.length == 0)
|
||||
if (key.remaining() == 0)
|
||||
return MINIMUM;
|
||||
|
||||
String skey;
|
||||
|
|
@ -50,6 +43,6 @@ public class CollatingOrderPreservingPartitioner extends AbstractByteOrderedPart
|
|||
{
|
||||
throw new RuntimeException("The provided key was not UTF8 encoded.", e);
|
||||
}
|
||||
return new BytesToken(collator.getCollationKey(skey).toByteArray());
|
||||
return new BytesToken(ByteBuffer.wrap(collator.getCollationKey(skey).toByteArray()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ public interface IPartitioner<T extends Token>
|
|||
* @param key On disk representation
|
||||
* @return DecoratedKey object
|
||||
*/
|
||||
public DecoratedKey<T> convertFromDiskFormat(byte[] key);
|
||||
public DecoratedKey<T> convertFromDiskFormat(ByteBuffer key);
|
||||
|
||||
/**
|
||||
* Transform key to object representation of the on-disk format.
|
||||
|
|
@ -39,7 +39,7 @@ public interface IPartitioner<T extends Token>
|
|||
* @param key the raw, client-facing key
|
||||
* @return decorated version of key
|
||||
*/
|
||||
public DecoratedKey<T> decorateKey(byte[] key);
|
||||
public DecoratedKey<T> decorateKey(ByteBuffer key);
|
||||
|
||||
/**
|
||||
* Calculate a Token representing the approximate "middle" of the given
|
||||
|
|
@ -47,7 +47,7 @@ public interface IPartitioner<T extends Token>
|
|||
*
|
||||
* @return The approximate midpoint between left and right.
|
||||
*/
|
||||
public T midpoint(T left, T right);
|
||||
public Token midpoint(Token left, Token right);
|
||||
|
||||
/**
|
||||
* @return The minimum possible Token in the range that is being partitioned.
|
||||
|
|
@ -59,7 +59,7 @@ public interface IPartitioner<T extends Token>
|
|||
* (This is NOT a method to create a Token from its string representation;
|
||||
* for that, use TokenFactory.fromString.)
|
||||
*/
|
||||
public T getToken(byte[] key);
|
||||
public T getToken(ByteBuffer key);
|
||||
|
||||
/**
|
||||
* @return a randomly generated token
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
public class LocalPartitioner implements IPartitioner<LocalToken>
|
||||
{
|
||||
|
|
@ -33,27 +35,27 @@ public class LocalPartitioner implements IPartitioner<LocalToken>
|
|||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
public DecoratedKey<LocalToken> convertFromDiskFormat(byte[] key)
|
||||
public DecoratedKey<LocalToken> convertFromDiskFormat(ByteBuffer key)
|
||||
{
|
||||
return decorateKey(key);
|
||||
}
|
||||
|
||||
public DecoratedKey<LocalToken> decorateKey(byte[] key)
|
||||
public DecoratedKey<LocalToken> decorateKey(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<LocalToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public LocalToken midpoint(LocalToken left, LocalToken right)
|
||||
public Token midpoint(Token left, Token right)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public LocalToken getMinimumToken()
|
||||
{
|
||||
return new LocalToken(comparator, ArrayUtils.EMPTY_BYTE_ARRAY);
|
||||
return new LocalToken(comparator, FBUtilities.EMPTY_BYTE_BUFFER);
|
||||
}
|
||||
|
||||
public LocalToken getToken(byte[] key)
|
||||
public LocalToken getToken(ByteBuffer key)
|
||||
{
|
||||
return new LocalToken(comparator, key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
|
||||
public class LocalToken extends Token<byte[]>
|
||||
public class LocalToken extends Token<ByteBuffer>
|
||||
{
|
||||
private final AbstractType comparator;
|
||||
|
||||
public LocalToken(AbstractType comparator, byte... token)
|
||||
public LocalToken(AbstractType comparator, ByteBuffer token)
|
||||
{
|
||||
super(token);
|
||||
this.comparator = comparator;
|
||||
|
|
@ -40,7 +41,7 @@ public class LocalToken extends Token<byte[]>
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Token<byte[]> o)
|
||||
public int compareTo(Token<ByteBuffer> o)
|
||||
{
|
||||
return comparator.compare(token, o.token);
|
||||
}
|
||||
|
|
@ -49,7 +50,7 @@ public class LocalToken extends Token<byte[]>
|
|||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
return prime + Arrays.hashCode(token);
|
||||
return prime + token.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -60,7 +61,7 @@ public class LocalToken extends Token<byte[]>
|
|||
if (!(obj instanceof LocalToken))
|
||||
return false;
|
||||
LocalToken other = (LocalToken) obj;
|
||||
return Arrays.equals(token, other.token);
|
||||
return ByteBufferUtil.equals(token, other.token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@ package org.apache.cassandra.dht;
|
|||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
|
|
@ -36,21 +34,21 @@ public class OrderPreservingPartitioner implements IPartitioner<StringToken>
|
|||
|
||||
public static final BigInteger CHAR_MASK = new BigInteger("65535");
|
||||
|
||||
public DecoratedKey<StringToken> decorateKey(byte[] key)
|
||||
public DecoratedKey<StringToken> decorateKey(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<StringToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public DecoratedKey<StringToken> convertFromDiskFormat(byte[] key)
|
||||
public DecoratedKey<StringToken> convertFromDiskFormat(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<StringToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public StringToken midpoint(StringToken ltoken, StringToken rtoken)
|
||||
public StringToken midpoint(Token ltoken, Token rtoken)
|
||||
{
|
||||
int sigchars = Math.max(ltoken.token.length(), rtoken.token.length());
|
||||
BigInteger left = bigForString(ltoken.token, sigchars);
|
||||
BigInteger right = bigForString(rtoken.token, sigchars);
|
||||
int sigchars = Math.max(((StringToken)ltoken).token.length(), ((StringToken)rtoken).token.length());
|
||||
BigInteger left = bigForString(((StringToken)ltoken).token, sigchars);
|
||||
BigInteger right = bigForString(((StringToken)rtoken).token, sigchars);
|
||||
|
||||
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 16*sigchars);
|
||||
return new StringToken(stringForBig(midpair.left, sigchars, midpair.right));
|
||||
|
|
@ -112,11 +110,11 @@ public class OrderPreservingPartitioner implements IPartitioner<StringToken>
|
|||
}
|
||||
|
||||
private final Token.TokenFactory<String> tokenFactory = new Token.TokenFactory<String>() {
|
||||
public byte[] toByteArray(Token<String> stringToken)
|
||||
public ByteBuffer toByteArray(Token<String> stringToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
return stringToken.token.getBytes("UTF-8");
|
||||
return ByteBuffer.wrap(stringToken.token.getBytes("UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
|
|
@ -124,11 +122,11 @@ public class OrderPreservingPartitioner implements IPartitioner<StringToken>
|
|||
}
|
||||
}
|
||||
|
||||
public Token<String> fromByteArray(byte[] bytes)
|
||||
public Token<String> fromByteArray(ByteBuffer bytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new StringToken(new String(bytes, "UTF-8"));
|
||||
return new StringToken(new String(bytes.array(),bytes.position()+bytes.arrayOffset(),bytes.limit(), "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
|
|
@ -157,7 +155,7 @@ public class OrderPreservingPartitioner implements IPartitioner<StringToken>
|
|||
return true;
|
||||
}
|
||||
|
||||
public StringToken getToken(byte[] key)
|
||||
public StringToken getToken(ByteBuffer key)
|
||||
{
|
||||
String skey;
|
||||
try
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@
|
|||
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.cassandra.db.DecoratedKey;
|
||||
|
|
@ -26,8 +29,6 @@ import org.apache.cassandra.utils.FBUtilities;
|
|||
import org.apache.cassandra.utils.GuidGenerator;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
|
||||
/**
|
||||
* This class generates a BigIntegerToken using MD5 hash.
|
||||
*/
|
||||
|
|
@ -39,18 +40,18 @@ public class RandomPartitioner implements IPartitioner<BigIntegerToken>
|
|||
|
||||
private static final byte DELIMITER_BYTE = ":".getBytes()[0];
|
||||
|
||||
public DecoratedKey<BigIntegerToken> decorateKey(byte[] key)
|
||||
public DecoratedKey<BigIntegerToken> decorateKey(ByteBuffer key)
|
||||
{
|
||||
return new DecoratedKey<BigIntegerToken>(getToken(key), key);
|
||||
}
|
||||
|
||||
public DecoratedKey<BigIntegerToken> convertFromDiskFormat(byte[] fromdisk)
|
||||
public DecoratedKey<BigIntegerToken> convertFromDiskFormat(ByteBuffer fromdisk)
|
||||
{
|
||||
// find the delimiter position
|
||||
int splitPoint = -1;
|
||||
for (int i = 0; i < fromdisk.length; i++)
|
||||
for (int i = fromdisk.position()+fromdisk.arrayOffset(); i < fromdisk.limit(); i++)
|
||||
{
|
||||
if (fromdisk[i] == DELIMITER_BYTE)
|
||||
if (fromdisk.array()[i] == DELIMITER_BYTE)
|
||||
{
|
||||
splitPoint = i;
|
||||
break;
|
||||
|
|
@ -59,14 +60,14 @@ public class RandomPartitioner implements IPartitioner<BigIntegerToken>
|
|||
assert splitPoint != -1;
|
||||
|
||||
// and decode the token and key
|
||||
String token = new String(fromdisk, 0, splitPoint, UTF_8);
|
||||
byte[] key = Arrays.copyOfRange(fromdisk, splitPoint + 1, fromdisk.length);
|
||||
return new DecoratedKey<BigIntegerToken>(new BigIntegerToken(token), key);
|
||||
String token = new String(fromdisk.array(), fromdisk.position()+fromdisk.arrayOffset(), splitPoint, UTF_8);
|
||||
byte[] key = Arrays.copyOfRange(fromdisk.array(), splitPoint + 1, fromdisk.limit());
|
||||
return new DecoratedKey<BigIntegerToken>(new BigIntegerToken(token), ByteBuffer.wrap(key));
|
||||
}
|
||||
|
||||
public BigIntegerToken midpoint(BigIntegerToken ltoken, BigIntegerToken rtoken)
|
||||
public Token midpoint(Token ltoken, Token rtoken)
|
||||
{
|
||||
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(ltoken.token, rtoken.token, 127);
|
||||
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(((BigIntegerToken)ltoken).token, ((BigIntegerToken)rtoken).token, 127);
|
||||
// discard the remainder
|
||||
return new BigIntegerToken(midpair.left);
|
||||
}
|
||||
|
|
@ -78,21 +79,25 @@ public class RandomPartitioner implements IPartitioner<BigIntegerToken>
|
|||
|
||||
public BigIntegerToken getRandomToken()
|
||||
{
|
||||
BigInteger token = FBUtilities.md5hash(GuidGenerator.guid().getBytes());
|
||||
BigInteger token = FBUtilities.md5hash(GuidGenerator.guidAsBytes());
|
||||
if ( token.signum() == -1 )
|
||||
token = token.multiply(BigInteger.valueOf(-1L));
|
||||
return new BigIntegerToken(token);
|
||||
}
|
||||
|
||||
private final Token.TokenFactory<BigInteger> tokenFactory = new Token.TokenFactory<BigInteger>() {
|
||||
public byte[] toByteArray(Token<BigInteger> bigIntegerToken)
|
||||
public ByteBuffer toByteArray(Token<BigInteger> bigIntegerToken)
|
||||
{
|
||||
return bigIntegerToken.token.toByteArray();
|
||||
return ByteBuffer.wrap(bigIntegerToken.token.toByteArray());
|
||||
}
|
||||
|
||||
public Token<BigInteger> fromByteArray(byte[] bytes)
|
||||
public Token<BigInteger> fromByteArray(ByteBuffer bytes)
|
||||
{
|
||||
return new BigIntegerToken(new BigInteger(bytes));
|
||||
byte[] b = new byte[bytes.remaining()];
|
||||
bytes.get(b);
|
||||
bytes.rewind();
|
||||
|
||||
return new BigIntegerToken(new BigInteger(b));
|
||||
}
|
||||
|
||||
public String toString(Token<BigInteger> bigIntegerToken)
|
||||
|
|
@ -116,9 +121,9 @@ public class RandomPartitioner implements IPartitioner<BigIntegerToken>
|
|||
return false;
|
||||
}
|
||||
|
||||
public BigIntegerToken getToken(byte[] key)
|
||||
public BigIntegerToken getToken(ByteBuffer key)
|
||||
{
|
||||
if (key.length == 0)
|
||||
if (key.remaining() == 0)
|
||||
return MINIMUM;
|
||||
return new BigIntegerToken(FBUtilities.md5hash(key));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,17 @@
|
|||
package org.apache.cassandra.dht;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
|
||||
/**
|
||||
* A representation of the range that a node is responsible for on the DHT ring.
|
||||
|
|
@ -65,7 +71,7 @@ public class Range extends AbstractBounds implements Comparable<Range>, Serializ
|
|||
/*
|
||||
* This is the range (a, b] where a < b.
|
||||
*/
|
||||
return (bi.compareTo(left) > 0 && right.compareTo(bi) >= 0);
|
||||
return ( compare(bi,left) > 0 && compare(right,bi) >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,13 +87,13 @@ public class Range extends AbstractBounds implements Comparable<Range>, Serializ
|
|||
boolean thatwraps = isWrapAround(that.left, that.right);
|
||||
if (thiswraps == thatwraps)
|
||||
{
|
||||
return left.compareTo(that.left) <= 0 && that.right.compareTo(right) <= 0;
|
||||
return compare(left,that.left) <= 0 && compare(that.right,right) <= 0;
|
||||
}
|
||||
else if (thiswraps)
|
||||
{
|
||||
// wrapping might contain non-wrapping
|
||||
// that is contained if both its tokens are in one of our wrap segments
|
||||
return left.compareTo(that.left) <= 0 || that.right.compareTo(right) <= 0;
|
||||
return compare(left,that.left) <= 0 || compare(that.right,right) <= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -207,7 +213,44 @@ public class Range extends AbstractBounds implements Comparable<Range>, Serializ
|
|||
*/
|
||||
public static boolean isWrapAround(Token left, Token right)
|
||||
{
|
||||
return left.compareTo(right) >= 0;
|
||||
return compare(left,right) >= 0;
|
||||
}
|
||||
|
||||
public static int compare(Token left, Token right){
|
||||
byte[] l,r;
|
||||
int lo,ll,ro,rl;
|
||||
|
||||
if(left.token instanceof byte[])
|
||||
{
|
||||
l = (byte[]) left.token;
|
||||
lo = 0;
|
||||
ll = l.length;
|
||||
}
|
||||
else if(left.token instanceof ByteBuffer)
|
||||
{
|
||||
l = ((ByteBuffer)left.token).array();
|
||||
lo = ((ByteBuffer)left.token).position()+((ByteBuffer)left.token).arrayOffset();
|
||||
ll = ((ByteBuffer)left.token).limit();
|
||||
}else{
|
||||
//Handles other token types
|
||||
return left.compareTo(right);
|
||||
}
|
||||
|
||||
if(right.token instanceof byte[])
|
||||
{
|
||||
r = (byte[]) right.token;
|
||||
ro = 0;
|
||||
rl = r.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = ((ByteBuffer)right.token).array();
|
||||
ro = ((ByteBuffer)right.token).position()+((ByteBuffer)right.token).arrayOffset();
|
||||
rl = ((ByteBuffer)right.token).limit();
|
||||
}
|
||||
|
||||
|
||||
return FBUtilities.compareByteArrays(l, r, lo, ro, ll, rl);
|
||||
}
|
||||
|
||||
public int compareTo(Range rhs)
|
||||
|
|
@ -222,7 +265,7 @@ public class Range extends AbstractBounds implements Comparable<Range>, Serializ
|
|||
if ( isWrapAround(rhs.left, rhs.right) )
|
||||
return 1;
|
||||
|
||||
return right.compareTo(rhs.right);
|
||||
return compare(right,rhs.right);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -246,7 +289,7 @@ public class Range extends AbstractBounds implements Comparable<Range>, Serializ
|
|||
if (!(o instanceof Range))
|
||||
return false;
|
||||
Range rhs = (Range)o;
|
||||
return left.equals(rhs.left) && right.equals(rhs.right);
|
||||
return compare(left,rhs.left) == 0 && compare(right,rhs.right) == 0;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.apache.cassandra.dht;
|
||||
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
|
||||
public class StringToken extends Token<String>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.io.DataInput;
|
|||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.io.ICompactSerializer2;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
|
|
@ -36,7 +37,7 @@ public abstract class Token<T> implements Comparable<Token<T>>, Serializable
|
|||
return serializer;
|
||||
}
|
||||
|
||||
T token;
|
||||
public final T token;
|
||||
|
||||
protected Token(T token)
|
||||
{
|
||||
|
|
@ -68,8 +69,8 @@ public abstract class Token<T> implements Comparable<Token<T>>, Serializable
|
|||
|
||||
public static abstract class TokenFactory<T>
|
||||
{
|
||||
public abstract byte[] toByteArray(Token<T> token);
|
||||
public abstract Token<T> fromByteArray(byte[] bytes);
|
||||
public abstract ByteBuffer toByteArray(Token<T> token);
|
||||
public abstract Token<T> fromByteArray(ByteBuffer bytes);
|
||||
public abstract String toString(Token<T> token); // serialize as string, not necessarily human-readable
|
||||
public abstract Token<T> fromString(String string); // deserialize
|
||||
}
|
||||
|
|
@ -79,9 +80,9 @@ public abstract class Token<T> implements Comparable<Token<T>>, Serializable
|
|||
public void serialize(Token token, DataOutput dos) throws IOException
|
||||
{
|
||||
IPartitioner p = StorageService.getPartitioner();
|
||||
byte[] b = p.getTokenFactory().toByteArray(token);
|
||||
dos.writeInt(b.length);
|
||||
dos.write(b);
|
||||
ByteBuffer b = p.getTokenFactory().toByteArray(token);
|
||||
dos.writeInt(b.remaining());
|
||||
dos.write(b.array(),b.position()+b.arrayOffset(),b.remaining());
|
||||
}
|
||||
|
||||
public Token deserialize(DataInput dis) throws IOException
|
||||
|
|
@ -90,7 +91,7 @@ public abstract class Token<T> implements Comparable<Token<T>>, Serializable
|
|||
int size = dis.readInt();
|
||||
byte[] bytes = new byte[size];
|
||||
dis.readFully(bytes);
|
||||
return p.getTokenFactory().fromByteArray(bytes);
|
||||
return p.getTokenFactory().fromByteArray(ByteBuffer.wrap(bytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,29 +23,36 @@ package org.apache.cassandra.hadoop;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.SortedMap;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.thrift.Cassandra;
|
||||
import org.apache.cassandra.thrift.InvalidRequestException;
|
||||
import org.apache.cassandra.thrift.TokenRange;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.mapreduce.*;
|
||||
import org.apache.hadoop.mapreduce.InputFormat;
|
||||
import org.apache.hadoop.mapreduce.InputSplit;
|
||||
import org.apache.hadoop.mapreduce.JobContext;
|
||||
import org.apache.hadoop.mapreduce.RecordReader;
|
||||
import org.apache.hadoop.mapreduce.TaskAttemptContext;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Hadoop InputFormat allowing map/reduce against Cassandra rows within one ColumnFamily.
|
||||
|
|
@ -64,7 +71,7 @@ import org.apache.thrift.transport.TTransportException;
|
|||
*
|
||||
* The default split size is 64k rows.
|
||||
*/
|
||||
public class ColumnFamilyInputFormat extends InputFormat<byte[], SortedMap<byte[], IColumn>>
|
||||
public class ColumnFamilyInputFormat extends InputFormat<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(StorageService.class);
|
||||
|
||||
|
|
@ -227,7 +234,7 @@ public class ColumnFamilyInputFormat extends InputFormat<byte[], SortedMap<byte[
|
|||
return map;
|
||||
}
|
||||
|
||||
public RecordReader<byte[], SortedMap<byte[], IColumn>> createRecordReader(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException
|
||||
public RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>> createRecordReader(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException
|
||||
{
|
||||
return new ColumnFamilyRecordReader();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,18 +24,30 @@ package org.apache.cassandra.hadoop;
|
|||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.cassandra.auth.SimpleAuthenticator;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.thrift.*;
|
||||
import org.apache.cassandra.thrift.AuthenticationRequest;
|
||||
import org.apache.cassandra.thrift.Cassandra;
|
||||
import org.apache.cassandra.thrift.CfDef;
|
||||
import org.apache.cassandra.thrift.Column;
|
||||
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
|
||||
import org.apache.cassandra.thrift.ColumnParent;
|
||||
import org.apache.cassandra.thrift.ConsistencyLevel;
|
||||
import org.apache.cassandra.thrift.KeyRange;
|
||||
import org.apache.cassandra.thrift.KeySlice;
|
||||
import org.apache.cassandra.thrift.KsDef;
|
||||
import org.apache.cassandra.thrift.SlicePredicate;
|
||||
import org.apache.cassandra.thrift.SuperColumn;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.Pair;
|
||||
|
|
@ -48,11 +60,13 @@ import org.apache.thrift.protocol.TBinaryProtocol;
|
|||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
|
||||
public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byte[], IColumn>>
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
|
||||
{
|
||||
private ColumnFamilySplit split;
|
||||
private RowIterator iter;
|
||||
private Pair<byte[], SortedMap<byte[], IColumn>> currentRow;
|
||||
private Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>> currentRow;
|
||||
private SlicePredicate predicate;
|
||||
private int totalRowCount; // total number of rows to fetch
|
||||
private int batchRowCount; // fetch this many per batch
|
||||
|
|
@ -71,12 +85,12 @@ public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byt
|
|||
}
|
||||
}
|
||||
|
||||
public byte[] getCurrentKey()
|
||||
public ByteBuffer getCurrentKey()
|
||||
{
|
||||
return currentRow.left;
|
||||
}
|
||||
|
||||
public SortedMap<byte[], IColumn> getCurrentValue()
|
||||
public SortedMap<ByteBuffer, IColumn> getCurrentValue()
|
||||
{
|
||||
return currentRow.right;
|
||||
}
|
||||
|
|
@ -172,7 +186,7 @@ public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byt
|
|||
return split.getLocations()[0];
|
||||
}
|
||||
|
||||
private class RowIterator extends AbstractIterator<Pair<byte[], SortedMap<byte[], IColumn>>>
|
||||
private class RowIterator extends AbstractIterator<Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>>>
|
||||
{
|
||||
private List<KeySlice> rows;
|
||||
private String startToken;
|
||||
|
|
@ -255,7 +269,7 @@ public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byt
|
|||
|
||||
// prepare for the next slice to be read
|
||||
KeySlice lastRow = rows.get(rows.size() - 1);
|
||||
byte[] rowkey = lastRow.getKey();
|
||||
ByteBuffer rowkey = lastRow.key;
|
||||
startToken = partitioner.getTokenFactory().toString(partitioner.getToken(rowkey));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -273,7 +287,7 @@ public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byt
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Pair<byte[], SortedMap<byte[], IColumn>> computeNext()
|
||||
protected Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>> computeNext()
|
||||
{
|
||||
maybeInit();
|
||||
if (rows == null)
|
||||
|
|
@ -281,13 +295,13 @@ public class ColumnFamilyRecordReader extends RecordReader<byte[], SortedMap<byt
|
|||
|
||||
totalRead++;
|
||||
KeySlice ks = rows.get(i++);
|
||||
SortedMap<byte[], IColumn> map = new TreeMap<byte[], IColumn>(comparator);
|
||||
SortedMap<ByteBuffer, IColumn> map = new TreeMap<ByteBuffer, IColumn>(comparator);
|
||||
for (ColumnOrSuperColumn cosc : ks.columns)
|
||||
{
|
||||
IColumn column = unthriftify(cosc);
|
||||
map.put(column.name(), column);
|
||||
}
|
||||
return new Pair<byte[], SortedMap<byte[], IColumn>>(ks.key, map);
|
||||
return new Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>>(ks.key, map);
|
||||
}
|
||||
|
||||
private IColumn unthriftify(ColumnOrSuperColumn cosc)
|
||||
|
|
|
|||
|
|
@ -120,8 +120,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
@Override
|
||||
public void write(ByteBuffer keybuff, List<org.apache.cassandra.avro.Mutation> value) throws IOException
|
||||
{
|
||||
byte[] key = copy(keybuff);
|
||||
Range range = ringCache.getRange(key);
|
||||
Range range = ringCache.getRange(keybuff);
|
||||
|
||||
// get the client for the given range, or create a new one
|
||||
RangeClient client = clients.get(range);
|
||||
|
|
@ -134,7 +133,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
}
|
||||
|
||||
for (org.apache.cassandra.avro.Mutation amut : value)
|
||||
client.put(new Pair<byte[],Mutation>(key, avroToThrift(amut)));
|
||||
client.put(new Pair<ByteBuffer,Mutation>(keybuff, avroToThrift(amut)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -155,7 +154,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
else
|
||||
{
|
||||
// super column
|
||||
byte[] scolname = copy(acosc.super_column.name);
|
||||
ByteBuffer scolname = acosc.super_column.name;
|
||||
List<Column> scolcols = new ArrayList<Column>(acosc.super_column.columns.size());
|
||||
for (org.apache.cassandra.avro.Column acol : acosc.super_column.columns)
|
||||
scolcols.add(avroToThrift(acol));
|
||||
|
|
@ -174,9 +173,9 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
else if (apred.column_names != null)
|
||||
{
|
||||
// column names
|
||||
List<byte[]> names = new ArrayList<byte[]>(apred.column_names.size());
|
||||
List<ByteBuffer> names = new ArrayList<ByteBuffer>(apred.column_names.size());
|
||||
for (ByteBuffer name : apred.column_names)
|
||||
names.add(copy(name));
|
||||
names.add(name);
|
||||
deletion.setPredicate(new SlicePredicate().setColumn_names(names));
|
||||
}
|
||||
else
|
||||
|
|
@ -190,12 +189,12 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
|
||||
private SliceRange avroToThrift(org.apache.cassandra.avro.SliceRange asr)
|
||||
{
|
||||
return new SliceRange(copy(asr.start), copy(asr.finish), asr.reversed, asr.count);
|
||||
return new SliceRange(asr.start, asr.finish, asr.reversed, asr.count);
|
||||
}
|
||||
|
||||
private Column avroToThrift(org.apache.cassandra.avro.Column acol)
|
||||
{
|
||||
return new Column(copy(acol.name), copy(acol.value), acol.timestamp);
|
||||
return new Column(acol.name, acol.value, acol.timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -241,7 +240,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
private final List<InetAddress> endpoints;
|
||||
private final String columnFamily = ConfigHelper.getOutputColumnFamily(conf);
|
||||
// A bounded queue of incoming mutations for this range
|
||||
private final BlockingQueue<Pair<byte[], Mutation>> queue = new ArrayBlockingQueue<Pair<byte[],Mutation>>(queueSize);
|
||||
private final BlockingQueue<Pair<ByteBuffer, Mutation>> queue = new ArrayBlockingQueue<Pair<ByteBuffer,Mutation>>(queueSize);
|
||||
|
||||
private volatile boolean run = true;
|
||||
private volatile IOException lastException;
|
||||
|
|
@ -262,7 +261,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
/**
|
||||
* enqueues the given value to Cassandra
|
||||
*/
|
||||
public void put(Pair<byte[],Mutation> value) throws IOException
|
||||
public void put(Pair<ByteBuffer,Mutation> value) throws IOException
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -306,7 +305,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
outer:
|
||||
while (run || !queue.isEmpty())
|
||||
{
|
||||
Pair<byte[], Mutation> mutation;
|
||||
Pair<ByteBuffer, Mutation> mutation;
|
||||
try
|
||||
{
|
||||
mutation = queue.take();
|
||||
|
|
@ -317,7 +316,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<org.apache.cass
|
|||
continue;
|
||||
}
|
||||
|
||||
Map<byte[], Map<String, List<Mutation>>> batch = new HashMap<byte[], Map<String, List<Mutation>>>();
|
||||
Map<ByteBuffer, Map<String, List<Mutation>>> batch = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
|
||||
while (batch.size() < batchThreshold)
|
||||
{
|
||||
Map<String, List<Mutation>> subBatch = Collections.singletonMap(columnFamily, Arrays.asList(mutation.right));
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package org.apache.cassandra.hadoop;
|
|||
*
|
||||
*/
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.thrift.SlicePredicate;
|
||||
|
|
@ -164,7 +166,7 @@ public class ConfigHelper
|
|||
TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
|
||||
try
|
||||
{
|
||||
return FBUtilities.bytesToHex(serializer.serialize(predicate));
|
||||
return FBUtilities.bytesToHex(ByteBuffer.wrap(serializer.serialize(predicate)));
|
||||
}
|
||||
catch (TException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ public class LazilyCompactedRow extends AbstractCompactedRow implements IIterabl
|
|||
@Override
|
||||
protected boolean isEqual(IColumn o1, IColumn o2)
|
||||
{
|
||||
return Arrays.equals(o1.name(), o2.name());
|
||||
return o1.name().equals(o2.name());
|
||||
}
|
||||
|
||||
public void reduce(IColumn current)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue