mirror of https://github.com/apache/cassandra
r/m offset from slice api; we could live with being inefficient but not with breaking read repair.
patch by jbellis; reviewed by Evan Weaver for CASSANDRA-286 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@794474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b1aeda97c
commit
ff764ff22b
|
|
@ -116,7 +116,7 @@ service Cassandra {
|
|||
list<Column> get_slice_by_names(1:string table, 2:string key, 3:ColumnParent column_parent, 4:list<string> column_names)
|
||||
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
|
||||
|
||||
list<Column> get_slice(1:string table, 2:string key, 3:ColumnParent column_parent, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 offset, 8:i32 count=100)
|
||||
list<Column> get_slice(1:string table, 2:string key, 3:ColumnParent column_parent, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 count=100)
|
||||
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
|
||||
|
||||
Column get_column(1:string table, 2:string key, 3:ColumnPath column_path)
|
||||
|
|
@ -137,7 +137,7 @@ service Cassandra {
|
|||
list<Column> get_columns_since(1:string table, 2:string key, 3:ColumnParent column_parent, 4:i64 timeStamp)
|
||||
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
|
||||
|
||||
list<SuperColumn> get_slice_super(1:string table, 2:string key, 3:string column_family, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 offset, 8:i32 count=100)
|
||||
list<SuperColumn> get_slice_super(1:string table, 2:string key, 3:string column_family, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 count=100)
|
||||
throws (1: InvalidRequestException ire),
|
||||
|
||||
list<SuperColumn> get_slice_super_by_names(1:string table, 2:string key, 3:string column_family, 4:list<string> super_column_names)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class Cassandra {
|
|||
|
||||
public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<String> column_names) throws InvalidRequestException, NotFoundException, TException;
|
||||
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int offset, int count) throws InvalidRequestException, NotFoundException, TException;
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException;
|
||||
|
||||
public Column get_column(String table, String key, ColumnPath column_path) throws InvalidRequestException, NotFoundException, TException;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ public class Cassandra {
|
|||
|
||||
public List<Column> get_columns_since(String table, String key, ColumnParent column_parent, long timeStamp) throws InvalidRequestException, NotFoundException, TException;
|
||||
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int offset, int count) throws InvalidRequestException, TException;
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, TException;
|
||||
|
||||
public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<String> super_column_names) throws InvalidRequestException, TException;
|
||||
|
||||
|
|
@ -127,13 +127,13 @@ public class Cassandra {
|
|||
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_slice_by_names failed: unknown result");
|
||||
}
|
||||
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int offset, int count) throws InvalidRequestException, NotFoundException, TException
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException
|
||||
{
|
||||
send_get_slice(table, key, column_parent, start, finish, is_ascending, offset, count);
|
||||
send_get_slice(table, key, column_parent, start, finish, is_ascending, count);
|
||||
return recv_get_slice();
|
||||
}
|
||||
|
||||
public void send_get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int offset, int count) throws TException
|
||||
public void send_get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws TException
|
||||
{
|
||||
oprot_.writeMessageBegin(new TMessage("get_slice", TMessageType.CALL, seqid_));
|
||||
get_slice_args args = new get_slice_args();
|
||||
|
|
@ -143,7 +143,6 @@ public class Cassandra {
|
|||
args.start = start;
|
||||
args.finish = finish;
|
||||
args.is_ascending = is_ascending;
|
||||
args.offset = offset;
|
||||
args.count = count;
|
||||
args.write(oprot_);
|
||||
oprot_.writeMessageEnd();
|
||||
|
|
@ -413,13 +412,13 @@ public class Cassandra {
|
|||
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_columns_since failed: unknown result");
|
||||
}
|
||||
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int offset, int count) throws InvalidRequestException, TException
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, TException
|
||||
{
|
||||
send_get_slice_super(table, key, column_family, start, finish, is_ascending, offset, count);
|
||||
send_get_slice_super(table, key, column_family, start, finish, is_ascending, count);
|
||||
return recv_get_slice_super();
|
||||
}
|
||||
|
||||
public void send_get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int offset, int count) throws TException
|
||||
public void send_get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws TException
|
||||
{
|
||||
oprot_.writeMessageBegin(new TMessage("get_slice_super", TMessageType.CALL, seqid_));
|
||||
get_slice_super_args args = new get_slice_super_args();
|
||||
|
|
@ -429,7 +428,6 @@ public class Cassandra {
|
|||
args.start = start;
|
||||
args.finish = finish;
|
||||
args.is_ascending = is_ascending;
|
||||
args.offset = offset;
|
||||
args.count = count;
|
||||
args.write(oprot_);
|
||||
oprot_.writeMessageEnd();
|
||||
|
|
@ -837,7 +835,7 @@ public class Cassandra {
|
|||
iprot.readMessageEnd();
|
||||
get_slice_result result = new get_slice_result();
|
||||
try {
|
||||
result.success = iface_.get_slice(args.table, args.key, args.column_parent, args.start, args.finish, args.is_ascending, args.offset, args.count);
|
||||
result.success = iface_.get_slice(args.table, args.key, args.column_parent, args.start, args.finish, args.is_ascending, args.count);
|
||||
} catch (InvalidRequestException ire) {
|
||||
result.ire = ire;
|
||||
} catch (NotFoundException nfe) {
|
||||
|
|
@ -1046,7 +1044,7 @@ public class Cassandra {
|
|||
iprot.readMessageEnd();
|
||||
get_slice_super_result result = new get_slice_super_result();
|
||||
try {
|
||||
result.success = iface_.get_slice_super(args.table, args.key, args.column_family, args.start, args.finish, args.is_ascending, args.offset, args.count);
|
||||
result.success = iface_.get_slice_super(args.table, args.key, args.column_family, args.start, args.finish, args.is_ascending, args.count);
|
||||
} catch (InvalidRequestException ire) {
|
||||
result.ire = ire;
|
||||
} catch (Throwable th) {
|
||||
|
|
@ -2114,8 +2112,7 @@ public class Cassandra {
|
|||
private static final TField START_FIELD_DESC = new TField("start", TType.STRING, (short)4);
|
||||
private static final TField FINISH_FIELD_DESC = new TField("finish", TType.STRING, (short)5);
|
||||
private static final TField IS_ASCENDING_FIELD_DESC = new TField("is_ascending", TType.BOOL, (short)6);
|
||||
private static final TField OFFSET_FIELD_DESC = new TField("offset", TType.I32, (short)7);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)8);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)7);
|
||||
|
||||
public String table;
|
||||
public static final int TABLE = 1;
|
||||
|
|
@ -2129,15 +2126,12 @@ public class Cassandra {
|
|||
public static final int FINISH = 5;
|
||||
public boolean is_ascending;
|
||||
public static final int IS_ASCENDING = 6;
|
||||
public int offset;
|
||||
public static final int OFFSET = 7;
|
||||
public int count;
|
||||
public static final int COUNT = 8;
|
||||
public static final int COUNT = 7;
|
||||
|
||||
private final Isset __isset = new Isset();
|
||||
private static final class Isset implements java.io.Serializable {
|
||||
public boolean is_ascending = false;
|
||||
public boolean offset = false;
|
||||
public boolean count = false;
|
||||
}
|
||||
|
||||
|
|
@ -2154,8 +2148,6 @@ public class Cassandra {
|
|||
new FieldValueMetaData(TType.STRING)));
|
||||
put(IS_ASCENDING, new FieldMetaData("is_ascending", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
put(OFFSET, new FieldMetaData("offset", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
put(COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
}});
|
||||
|
|
@ -2176,7 +2168,6 @@ public class Cassandra {
|
|||
String start,
|
||||
String finish,
|
||||
boolean is_ascending,
|
||||
int offset,
|
||||
int count)
|
||||
{
|
||||
this();
|
||||
|
|
@ -2187,8 +2178,6 @@ public class Cassandra {
|
|||
this.finish = finish;
|
||||
this.is_ascending = is_ascending;
|
||||
this.__isset.is_ascending = true;
|
||||
this.offset = offset;
|
||||
this.__isset.offset = true;
|
||||
this.count = count;
|
||||
this.__isset.count = true;
|
||||
}
|
||||
|
|
@ -2214,8 +2203,6 @@ public class Cassandra {
|
|||
}
|
||||
__isset.is_ascending = other.__isset.is_ascending;
|
||||
this.is_ascending = other.is_ascending;
|
||||
__isset.offset = other.__isset.offset;
|
||||
this.offset = other.offset;
|
||||
__isset.count = other.__isset.count;
|
||||
this.count = other.count;
|
||||
}
|
||||
|
|
@ -2362,28 +2349,6 @@ public class Cassandra {
|
|||
this.__isset.is_ascending = value;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
this.__isset.offset = true;
|
||||
}
|
||||
|
||||
public void unsetOffset() {
|
||||
this.__isset.offset = false;
|
||||
}
|
||||
|
||||
// Returns true if field offset is set (has been asigned a value) and false otherwise
|
||||
public boolean isSetOffset() {
|
||||
return this.__isset.offset;
|
||||
}
|
||||
|
||||
public void setOffsetIsSet(boolean value) {
|
||||
this.__isset.offset = value;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
|
@ -2456,14 +2421,6 @@ public class Cassandra {
|
|||
}
|
||||
break;
|
||||
|
||||
case OFFSET:
|
||||
if (value == null) {
|
||||
unsetOffset();
|
||||
} else {
|
||||
setOffset((Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case COUNT:
|
||||
if (value == null) {
|
||||
unsetCount();
|
||||
|
|
@ -2497,9 +2454,6 @@ public class Cassandra {
|
|||
case IS_ASCENDING:
|
||||
return new Boolean(isIs_ascending());
|
||||
|
||||
case OFFSET:
|
||||
return new Integer(getOffset());
|
||||
|
||||
case COUNT:
|
||||
return new Integer(getCount());
|
||||
|
||||
|
|
@ -2523,8 +2477,6 @@ public class Cassandra {
|
|||
return isSetFinish();
|
||||
case IS_ASCENDING:
|
||||
return isSetIs_ascending();
|
||||
case OFFSET:
|
||||
return isSetOffset();
|
||||
case COUNT:
|
||||
return isSetCount();
|
||||
default:
|
||||
|
|
@ -2599,15 +2551,6 @@ public class Cassandra {
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_offset = true;
|
||||
boolean that_present_offset = true;
|
||||
if (this_present_offset || that_present_offset) {
|
||||
if (!(this_present_offset && that_present_offset))
|
||||
return false;
|
||||
if (this.offset != that.offset)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_count = true;
|
||||
boolean that_present_count = true;
|
||||
if (this_present_count || that_present_count) {
|
||||
|
|
@ -2680,14 +2623,6 @@ public class Cassandra {
|
|||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case OFFSET:
|
||||
if (field.type == TType.I32) {
|
||||
this.offset = iprot.readI32();
|
||||
this.__isset.offset = true;
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case COUNT:
|
||||
if (field.type == TType.I32) {
|
||||
this.count = iprot.readI32();
|
||||
|
|
@ -2741,9 +2676,6 @@ public class Cassandra {
|
|||
oprot.writeFieldBegin(IS_ASCENDING_FIELD_DESC);
|
||||
oprot.writeBool(this.is_ascending);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldBegin(OFFSET_FIELD_DESC);
|
||||
oprot.writeI32(this.offset);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldBegin(COUNT_FIELD_DESC);
|
||||
oprot.writeI32(this.count);
|
||||
oprot.writeFieldEnd();
|
||||
|
|
@ -2800,10 +2732,6 @@ public class Cassandra {
|
|||
sb.append(this.is_ascending);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("offset:");
|
||||
sb.append(this.offset);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("count:");
|
||||
sb.append(this.count);
|
||||
first = false;
|
||||
|
|
@ -7569,8 +7497,7 @@ public class Cassandra {
|
|||
private static final TField START_FIELD_DESC = new TField("start", TType.STRING, (short)4);
|
||||
private static final TField FINISH_FIELD_DESC = new TField("finish", TType.STRING, (short)5);
|
||||
private static final TField IS_ASCENDING_FIELD_DESC = new TField("is_ascending", TType.BOOL, (short)6);
|
||||
private static final TField OFFSET_FIELD_DESC = new TField("offset", TType.I32, (short)7);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)8);
|
||||
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)7);
|
||||
|
||||
public String table;
|
||||
public static final int TABLE = 1;
|
||||
|
|
@ -7584,15 +7511,12 @@ public class Cassandra {
|
|||
public static final int FINISH = 5;
|
||||
public boolean is_ascending;
|
||||
public static final int IS_ASCENDING = 6;
|
||||
public int offset;
|
||||
public static final int OFFSET = 7;
|
||||
public int count;
|
||||
public static final int COUNT = 8;
|
||||
public static final int COUNT = 7;
|
||||
|
||||
private final Isset __isset = new Isset();
|
||||
private static final class Isset implements java.io.Serializable {
|
||||
public boolean is_ascending = false;
|
||||
public boolean offset = false;
|
||||
public boolean count = false;
|
||||
}
|
||||
|
||||
|
|
@ -7609,8 +7533,6 @@ public class Cassandra {
|
|||
new FieldValueMetaData(TType.STRING)));
|
||||
put(IS_ASCENDING, new FieldMetaData("is_ascending", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
put(OFFSET, new FieldMetaData("offset", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
put(COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
}});
|
||||
|
|
@ -7631,7 +7553,6 @@ public class Cassandra {
|
|||
String start,
|
||||
String finish,
|
||||
boolean is_ascending,
|
||||
int offset,
|
||||
int count)
|
||||
{
|
||||
this();
|
||||
|
|
@ -7642,8 +7563,6 @@ public class Cassandra {
|
|||
this.finish = finish;
|
||||
this.is_ascending = is_ascending;
|
||||
this.__isset.is_ascending = true;
|
||||
this.offset = offset;
|
||||
this.__isset.offset = true;
|
||||
this.count = count;
|
||||
this.__isset.count = true;
|
||||
}
|
||||
|
|
@ -7669,8 +7588,6 @@ public class Cassandra {
|
|||
}
|
||||
__isset.is_ascending = other.__isset.is_ascending;
|
||||
this.is_ascending = other.is_ascending;
|
||||
__isset.offset = other.__isset.offset;
|
||||
this.offset = other.offset;
|
||||
__isset.count = other.__isset.count;
|
||||
this.count = other.count;
|
||||
}
|
||||
|
|
@ -7817,28 +7734,6 @@ public class Cassandra {
|
|||
this.__isset.is_ascending = value;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
this.__isset.offset = true;
|
||||
}
|
||||
|
||||
public void unsetOffset() {
|
||||
this.__isset.offset = false;
|
||||
}
|
||||
|
||||
// Returns true if field offset is set (has been asigned a value) and false otherwise
|
||||
public boolean isSetOffset() {
|
||||
return this.__isset.offset;
|
||||
}
|
||||
|
||||
public void setOffsetIsSet(boolean value) {
|
||||
this.__isset.offset = value;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
|
@ -7911,14 +7806,6 @@ public class Cassandra {
|
|||
}
|
||||
break;
|
||||
|
||||
case OFFSET:
|
||||
if (value == null) {
|
||||
unsetOffset();
|
||||
} else {
|
||||
setOffset((Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case COUNT:
|
||||
if (value == null) {
|
||||
unsetCount();
|
||||
|
|
@ -7952,9 +7839,6 @@ public class Cassandra {
|
|||
case IS_ASCENDING:
|
||||
return new Boolean(isIs_ascending());
|
||||
|
||||
case OFFSET:
|
||||
return new Integer(getOffset());
|
||||
|
||||
case COUNT:
|
||||
return new Integer(getCount());
|
||||
|
||||
|
|
@ -7978,8 +7862,6 @@ public class Cassandra {
|
|||
return isSetFinish();
|
||||
case IS_ASCENDING:
|
||||
return isSetIs_ascending();
|
||||
case OFFSET:
|
||||
return isSetOffset();
|
||||
case COUNT:
|
||||
return isSetCount();
|
||||
default:
|
||||
|
|
@ -8054,15 +7936,6 @@ public class Cassandra {
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_offset = true;
|
||||
boolean that_present_offset = true;
|
||||
if (this_present_offset || that_present_offset) {
|
||||
if (!(this_present_offset && that_present_offset))
|
||||
return false;
|
||||
if (this.offset != that.offset)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_count = true;
|
||||
boolean that_present_count = true;
|
||||
if (this_present_count || that_present_count) {
|
||||
|
|
@ -8134,14 +8007,6 @@ public class Cassandra {
|
|||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case OFFSET:
|
||||
if (field.type == TType.I32) {
|
||||
this.offset = iprot.readI32();
|
||||
this.__isset.offset = true;
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case COUNT:
|
||||
if (field.type == TType.I32) {
|
||||
this.count = iprot.readI32();
|
||||
|
|
@ -8195,9 +8060,6 @@ public class Cassandra {
|
|||
oprot.writeFieldBegin(IS_ASCENDING_FIELD_DESC);
|
||||
oprot.writeBool(this.is_ascending);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldBegin(OFFSET_FIELD_DESC);
|
||||
oprot.writeI32(this.offset);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldBegin(COUNT_FIELD_DESC);
|
||||
oprot.writeI32(this.count);
|
||||
oprot.writeFieldEnd();
|
||||
|
|
@ -8254,10 +8116,6 @@ public class Cassandra {
|
|||
sb.append(this.is_ascending);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("offset:");
|
||||
sb.append(this.offset);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("count:");
|
||||
sb.append(this.count);
|
||||
first = false;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class CliClient
|
|||
{
|
||||
// table.cf['key']
|
||||
List<Column> columns = new ArrayList<Column>();
|
||||
columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), "", "", true, 0, 1000000);
|
||||
columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), "", "", true, 1000000);
|
||||
int size = columns.size();
|
||||
for (Iterator<Column> colIter = columns.iterator(); colIter.hasNext(); )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
private CFMetaData cfMetaData_;
|
||||
private OperandDef rowKey_;
|
||||
private OperandDef superColumnKey_;
|
||||
private int offset_;
|
||||
private int limit_;
|
||||
|
||||
/**
|
||||
|
|
@ -53,12 +52,11 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
* Note: "limit" of -1 is the equivalent of no limit.
|
||||
* "offset" specifies the number of rows to skip. An offset of 0 implies from the first row.
|
||||
*/
|
||||
public ColumnRangeQueryRSD(CFMetaData cfMetaData, OperandDef rowKey, int offset, int limit)
|
||||
public ColumnRangeQueryRSD(CFMetaData cfMetaData, OperandDef rowKey, int limit)
|
||||
{
|
||||
cfMetaData_ = cfMetaData;
|
||||
rowKey_ = rowKey;
|
||||
superColumnKey_ = null;
|
||||
offset_ = offset;
|
||||
limit_ = limit;
|
||||
}
|
||||
|
||||
|
|
@ -69,13 +67,11 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
* Note: "limit" of -1 is the equivalent of no limit.
|
||||
* "offset" specifies the number of rows to skip. An offset of 0 implies the first row.
|
||||
*/
|
||||
public ColumnRangeQueryRSD(CFMetaData cfMetaData, ConstantOperand rowKey, ConstantOperand superColumnKey,
|
||||
int offset, int limit)
|
||||
public ColumnRangeQueryRSD(CFMetaData cfMetaData, ConstantOperand rowKey, ConstantOperand superColumnKey, int limit)
|
||||
{
|
||||
cfMetaData_ = cfMetaData;
|
||||
rowKey_ = rowKey;
|
||||
superColumnKey_ = superColumnKey;
|
||||
offset_ = offset;
|
||||
limit_ = limit;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +94,7 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
try
|
||||
{
|
||||
String key = (String)(rowKey_.get());
|
||||
ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, path, "", "", true, offset_, limit_);
|
||||
ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, path, "", "", true, limit_);
|
||||
row = StorageProxy.readProtocol(readCommand, StorageService.ConsistencyLevel.WEAK);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -151,7 +147,6 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
" Column Family: %s\n" +
|
||||
" RowKey: %s\n" +
|
||||
"%s" +
|
||||
" Offset: %d\n" +
|
||||
" Limit: %d\n" +
|
||||
" Order By: %s",
|
||||
cfMetaData_.columnType,
|
||||
|
|
@ -159,7 +154,7 @@ public class ColumnRangeQueryRSD extends RowSourceDef
|
|||
cfMetaData_.cfName,
|
||||
rowKey_.explain(),
|
||||
(superColumnKey_ == null) ? "" : " SuperColumnKey: " + superColumnKey_.explain() + "\n",
|
||||
offset_, limit_,
|
||||
limit_,
|
||||
cfMetaData_.indexProperty_);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +41,6 @@ public class SuperColumnRangeQueryRSD extends RowSourceDef
|
|||
private final static Logger logger_ = Logger.getLogger(SuperColumnRangeQueryRSD.class);
|
||||
private CFMetaData cfMetaData_;
|
||||
private OperandDef rowKey_;
|
||||
private OperandDef superColumnKey_;
|
||||
private int offset_;
|
||||
private int limit_;
|
||||
|
||||
/**
|
||||
|
|
@ -53,11 +51,10 @@ public class SuperColumnRangeQueryRSD extends RowSourceDef
|
|||
* "offset" specifies the number of rows to skip.
|
||||
* An offset of 0 implies from the first row.
|
||||
*/
|
||||
public SuperColumnRangeQueryRSD(CFMetaData cfMetaData, OperandDef rowKey, int offset, int limit)
|
||||
public SuperColumnRangeQueryRSD(CFMetaData cfMetaData, OperandDef rowKey, int limit)
|
||||
{
|
||||
cfMetaData_ = cfMetaData;
|
||||
rowKey_ = rowKey;
|
||||
offset_ = offset;
|
||||
limit_ = limit;
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +64,7 @@ public class SuperColumnRangeQueryRSD extends RowSourceDef
|
|||
try
|
||||
{
|
||||
String key = (String)(rowKey_.get());
|
||||
ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, new QueryPath(cfMetaData_.cfName), "", "", true, offset_, limit_);
|
||||
ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, new QueryPath(cfMetaData_.cfName), "", "", true, limit_);
|
||||
row = StorageProxy.readProtocol(readCommand, StorageService.ConsistencyLevel.WEAK);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -110,14 +107,13 @@ public class SuperColumnRangeQueryRSD extends RowSourceDef
|
|||
" Table Name: %s\n" +
|
||||
" Column Family: %s\n" +
|
||||
" RowKey: %s\n" +
|
||||
" Offset: %d\n" +
|
||||
" Limit: %d\n" +
|
||||
" Order By: %s",
|
||||
cfMetaData_.columnType,
|
||||
cfMetaData_.tableName,
|
||||
cfMetaData_.cfName,
|
||||
rowKey_.explain(),
|
||||
offset_, limit_,
|
||||
limit_,
|
||||
cfMetaData_.indexProperty_);
|
||||
}
|
||||
}
|
||||
|
|
@ -189,12 +189,12 @@ public class SemanticPhase
|
|||
{
|
||||
// Case: table.super_cf[<rowKey>][<superColumnKey>]
|
||||
ConstantOperand superColumnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));
|
||||
rwsDef = new ColumnRangeQueryRSD(cfMetaData, rowKey, superColumnKey, -1, Integer.MAX_VALUE);
|
||||
rwsDef = new ColumnRangeQueryRSD(cfMetaData, rowKey, superColumnKey, Integer.MAX_VALUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case: table.super_cf[<rowKey>]
|
||||
rwsDef = new SuperColumnRangeQueryRSD(cfMetaData, rowKey, -1, Integer.MAX_VALUE);
|
||||
rwsDef = new SuperColumnRangeQueryRSD(cfMetaData, rowKey, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
else // Standard Column Family
|
||||
|
|
@ -209,7 +209,7 @@ public class SemanticPhase
|
|||
{
|
||||
// Case: table.standard_cf[<rowKey>]
|
||||
logger_.assertLog((dimensionCnt == 0), "invalid dimensionCnt: " + dimensionCnt);
|
||||
rwsDef = new ColumnRangeQueryRSD(cfMetaData, rowKey, -1, Integer.MAX_VALUE);
|
||||
rwsDef = new ColumnRangeQueryRSD(cfMetaData, rowKey, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
return new QueryPlan(rwsDef);
|
||||
|
|
|
|||
|
|
@ -1421,9 +1421,9 @@ public final class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
return writeStats_.mean();
|
||||
}
|
||||
|
||||
public ColumnFamily getColumnFamily(String key, QueryPath path, String start, String finish, boolean isAscending, int offset, int limit) throws IOException
|
||||
public ColumnFamily getColumnFamily(String key, QueryPath path, String start, String finish, boolean isAscending, int limit) throws IOException
|
||||
{
|
||||
return getColumnFamily(new SliceQueryFilter(key, path, start, finish, isAscending, offset, limit));
|
||||
return getColumnFamily(new SliceQueryFilter(key, path, start, finish, isAscending, limit));
|
||||
}
|
||||
|
||||
public ColumnFamily getColumnFamily(String key, QueryPath columnParent, long since) throws IOException
|
||||
|
|
|
|||
|
|
@ -30,22 +30,20 @@ public class SliceFromReadCommand extends ReadCommand
|
|||
public final QueryPath column_parent;
|
||||
public final String start, finish;
|
||||
public final boolean isAscending;
|
||||
public final int offset;
|
||||
public final int count;
|
||||
|
||||
public SliceFromReadCommand(String table, String key, ColumnParent column_parent, String start, String finish, boolean isAscending, int offset, int count)
|
||||
public SliceFromReadCommand(String table, String key, ColumnParent column_parent, String start, String finish, boolean isAscending, int count)
|
||||
{
|
||||
this(table, key, new QueryPath(column_parent), start, finish, isAscending, offset, count);
|
||||
this(table, key, new QueryPath(column_parent), start, finish, isAscending, count);
|
||||
}
|
||||
|
||||
public SliceFromReadCommand(String table, String key, QueryPath columnParent, String start, String finish, boolean isAscending, int offset, int count)
|
||||
public SliceFromReadCommand(String table, String key, QueryPath columnParent, String start, String finish, boolean isAscending, int count)
|
||||
{
|
||||
super(table, key, CMD_TYPE_GET_SLICE);
|
||||
this.column_parent = columnParent;
|
||||
this.start = start;
|
||||
this.finish = finish;
|
||||
this.isAscending = isAscending;
|
||||
this.offset = offset;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +56,7 @@ public class SliceFromReadCommand extends ReadCommand
|
|||
@Override
|
||||
public ReadCommand copy()
|
||||
{
|
||||
ReadCommand readCommand = new SliceFromReadCommand(table, key, column_parent, start, finish, isAscending, offset, count);
|
||||
ReadCommand readCommand = new SliceFromReadCommand(table, key, column_parent, start, finish, isAscending, count);
|
||||
readCommand.setDigestQuery(isDigestQuery());
|
||||
return readCommand;
|
||||
}
|
||||
|
|
@ -66,7 +64,7 @@ public class SliceFromReadCommand extends ReadCommand
|
|||
@Override
|
||||
public Row getRow(Table table) throws IOException
|
||||
{
|
||||
return table.getRow(new SliceQueryFilter(key, column_parent, start, finish, isAscending, offset, count));
|
||||
return table.getRow(new SliceQueryFilter(key, column_parent, start, finish, isAscending, count));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,7 +77,6 @@ public class SliceFromReadCommand extends ReadCommand
|
|||
", start='" + start + '\'' +
|
||||
", finish='" + finish + '\'' +
|
||||
", isAscending=" + isAscending +
|
||||
", offset=" + offset +
|
||||
", count=" + count +
|
||||
')';
|
||||
}
|
||||
|
|
@ -98,7 +95,6 @@ class SliceFromReadCommandSerializer extends ReadCommandSerializer
|
|||
dos.writeUTF(realRM.start);
|
||||
dos.writeUTF(realRM.finish);
|
||||
dos.writeBoolean(realRM.isAscending);
|
||||
dos.writeInt(realRM.offset);
|
||||
dos.writeInt(realRM.count);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +102,7 @@ class SliceFromReadCommandSerializer extends ReadCommandSerializer
|
|||
public ReadCommand deserialize(DataInputStream dis) throws IOException
|
||||
{
|
||||
boolean isDigest = dis.readBoolean();
|
||||
SliceFromReadCommand rm = new SliceFromReadCommand(dis.readUTF(), dis.readUTF(), QueryPath.deserialize(dis), dis.readUTF(), dis.readUTF(), dis.readBoolean(), dis.readInt(), dis.readInt());
|
||||
SliceFromReadCommand rm = new SliceFromReadCommand(dis.readUTF(), dis.readUTF(), QueryPath.deserialize(dis), dis.readUTF(), dis.readUTF(), dis.readBoolean(), dis.readInt());
|
||||
rm.setDigestQuery(isDigest);
|
||||
return rm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ public class Table
|
|||
}
|
||||
// make sure there is actually non-tombstone content associated w/ this key
|
||||
// TODO record the key source(s) somehow and only check that source (e.g., memtable or sstable)
|
||||
if (cfs.getColumnFamily(new SliceQueryFilter(current, new QueryPath(cfName), "", "", true, 0, 1)) != null)
|
||||
if (ColumnFamilyStore.removeDeleted(cfs.getColumnFamily(new SliceQueryFilter(current, new QueryPath(cfName), "", "", true, 1)), Integer.MAX_VALUE) != null)
|
||||
{
|
||||
keys.add(current);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class IdentityQueryFilter extends SliceQueryFilter
|
|||
*/
|
||||
public IdentityQueryFilter(String key, QueryPath path)
|
||||
{
|
||||
super(key, path, "", "", true, 0, Integer.MAX_VALUE);
|
||||
super(key, path, "", "", true, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,15 +13,14 @@ public class SliceQueryFilter extends QueryFilter
|
|||
{
|
||||
public final String start, finish;
|
||||
public final boolean isAscending;
|
||||
public final int offset, count;
|
||||
public final int count;
|
||||
|
||||
public SliceQueryFilter(String key, QueryPath columnParent, String start, String finish, boolean ascending, int offset, int count)
|
||||
public SliceQueryFilter(String key, QueryPath columnParent, String start, String finish, boolean ascending, int count)
|
||||
{
|
||||
super(key, columnParent);
|
||||
this.start = start;
|
||||
this.finish = finish;
|
||||
isAscending = ascending;
|
||||
this.offset = offset;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
|
@ -51,11 +50,10 @@ public class SliceQueryFilter extends QueryFilter
|
|||
public void collectColumns(ColumnFamily returnCF, ReducingIterator<IColumn> reducedColumns)
|
||||
{
|
||||
int liveColumns = 0;
|
||||
int limit = offset + count;
|
||||
|
||||
for (IColumn column : reducedColumns)
|
||||
{
|
||||
if (liveColumns >= limit)
|
||||
if (liveColumns >= count)
|
||||
break;
|
||||
if (!finish.isEmpty()
|
||||
&& ((isAscending && column.name().compareTo(finish) > 0))
|
||||
|
|
@ -64,8 +62,7 @@ public class SliceQueryFilter extends QueryFilter
|
|||
if (!column.isMarkedForDelete())
|
||||
liveColumns++;
|
||||
|
||||
if (liveColumns > offset)
|
||||
returnCF.addColumn(column);
|
||||
returnCF.addColumn(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
return getSlice(new SliceByNamesReadCommand(table, key, column_parent, column_names));
|
||||
}
|
||||
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int offset, int count)
|
||||
public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count)
|
||||
throws InvalidRequestException, NotFoundException
|
||||
{
|
||||
logger.debug("get_slice_from");
|
||||
|
|
@ -163,7 +163,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
if (!"Name".equals(DatabaseDescriptor.getCFMetaData(table, column_parent.column_family).indexProperty_))
|
||||
throw new InvalidRequestException("get_slice requires CF indexed by name");
|
||||
|
||||
return getSlice(new SliceFromReadCommand(table, key, column_parent, start, finish, is_ascending, offset, count));
|
||||
return getSlice(new SliceFromReadCommand(table, key, column_parent, start, finish, is_ascending, count));
|
||||
}
|
||||
|
||||
public Column get_column(String table, String key, ColumnPath column_path)
|
||||
|
|
@ -224,7 +224,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
if (DatabaseDescriptor.isNameSortingEnabled(table, column_parent.column_family)
|
||||
&& column_parent.super_column == null)
|
||||
{
|
||||
cfamily = readColumnFamily(new SliceFromReadCommand(table, key, column_parent, "", "", true, 0, Integer.MAX_VALUE));
|
||||
cfamily = readColumnFamily(new SliceFromReadCommand(table, key, column_parent, "", "", true, Integer.MAX_VALUE));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -336,7 +336,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
return thriftSuperColumns;
|
||||
}
|
||||
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int offset, int count)
|
||||
public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count)
|
||||
throws InvalidRequestException
|
||||
{
|
||||
logger.debug("get_slice_super");
|
||||
|
|
@ -345,7 +345,7 @@ public class CassandraServer implements Cassandra.Iface
|
|||
if (count <= 0)
|
||||
throw new InvalidRequestException("get_slice_super requires positive count");
|
||||
|
||||
ColumnFamily cfamily = readColumnFamily(new SliceFromReadCommand(table, key, new QueryPath(column_family), start, finish, is_ascending, offset, count));
|
||||
ColumnFamily cfamily = readColumnFamily(new SliceFromReadCommand(table, key, new QueryPath(column_family), start, finish, is_ascending, count));
|
||||
if (cfamily == null)
|
||||
{
|
||||
return EMPTY_SUPERCOLUMNS;
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ def _insert_batch(block):
|
|||
|
||||
def _verify_batch():
|
||||
_verify_simple()
|
||||
L = client.get_slice('Table1', 'key1', ColumnParent('Standard2'), '', '', True, 0, 1000)
|
||||
L = client.get_slice('Table1', 'key1', ColumnParent('Standard2'), '', '', True, 1000)
|
||||
assert L == _SIMPLE_COLUMNS, L
|
||||
|
||||
def _verify_simple():
|
||||
assert client.get_column('Table1', 'key1', ColumnPath('Standard1', column='c1')) == Column('c1', 'value1', 0)
|
||||
L = client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000)
|
||||
L = client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000)
|
||||
assert L == _SIMPLE_COLUMNS, L
|
||||
|
||||
def _insert_super():
|
||||
|
|
@ -62,21 +62,21 @@ def _insert_range():
|
|||
time.sleep(0.1)
|
||||
|
||||
def _verify_range():
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'c1', 'c2', True, 0, 1000)
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'c1', 'c2', True, 1000)
|
||||
assert len(result) == 2
|
||||
assert result[0].name == 'c1'
|
||||
assert result[1].name == 'c2'
|
||||
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'a', 'z' , True, 0, 1000)
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'a', 'z' , True, 1000)
|
||||
assert len(result) == 3, result
|
||||
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'a', 'z' , True, 0, 2)
|
||||
result = client.get_slice('Table1','key1', ColumnParent('Standard1'), 'a', 'z' , True, 2)
|
||||
assert len(result) == 2, result
|
||||
|
||||
|
||||
def _verify_super(supercf='Super1'):
|
||||
assert client.get_column('Table1', 'key1', ColumnPath(supercf, 'sc1', 'c4')) == Column('c4', 'value4', 0)
|
||||
slice = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
slice = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert slice == _SUPER_COLUMNS, slice
|
||||
|
||||
def _expect_exception(fn, type_):
|
||||
|
|
@ -97,10 +97,10 @@ class TestMutations(CassandraTester):
|
|||
_verify_simple()
|
||||
|
||||
def test_empty_slice(self):
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard2'), '', '', True, 0, 1000) == []
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard2'), '', '', True, 1000) == []
|
||||
|
||||
def test_empty_slice_super(self):
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000) == []
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000) == []
|
||||
|
||||
def test_missing_super(self):
|
||||
_expect_missing(lambda: client.get_column('Table1', 'key1', ColumnPath('Super1', 'sc1', 'c1')))
|
||||
|
|
@ -160,22 +160,22 @@ class TestMutations(CassandraTester):
|
|||
_expect_missing(lambda: client.get_column('Table1', 'key1', ColumnPath('Standard1', column='c1')))
|
||||
assert client.get_column('Table1', 'key1', ColumnPath('Standard1', column='c2')) \
|
||||
== Column('c2', 'value2', 0)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) \
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) \
|
||||
== [Column('c2', 'value2', 0)]
|
||||
|
||||
# New insert, make sure it shows up post-remove:
|
||||
client.insert('Table1', 'key1', ColumnPath('Standard1', column='c3'), 'value3', 0, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == \
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == \
|
||||
[Column('c2', 'value2', 0), Column('c3', 'value3', 0)]
|
||||
|
||||
# Test resurrection. First, re-insert the value w/ older timestamp,
|
||||
# and make sure it stays removed
|
||||
client.insert('Table1', 'key1', ColumnPath('Standard1', column='c1'), 'value1', 0, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == \
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == \
|
||||
[Column('c2', 'value2', 0), Column('c3', 'value3', 0)]
|
||||
# Next, w/ a newer timestamp; it should come back:
|
||||
client.insert('Table1', 'key1', ColumnPath('Standard1', column='c1'), 'value1', 2, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == \
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == \
|
||||
[Column('c1', 'value1', 2), Column('c2', 'value2', 0), Column('c3', 'value3', 0)]
|
||||
|
||||
|
||||
|
|
@ -185,16 +185,16 @@ class TestMutations(CassandraTester):
|
|||
|
||||
# Remove the key1:Standard1 cf:
|
||||
client.remove('Table1', 'key1', ColumnPathOrParent('Standard1'), 3, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == []
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == []
|
||||
_verify_super()
|
||||
|
||||
# Test resurrection. First, re-insert a value w/ older timestamp,
|
||||
# and make sure it stays removed:
|
||||
client.insert('Table1', 'key1', ColumnPath('Standard1', column='c1'), 'value1', 0, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == []
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == []
|
||||
# Next, w/ a newer timestamp; it should come back:
|
||||
client.insert('Table1', 'key1', ColumnPath('Standard1', column='c1'), 'value1', 4, True)
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 0, 1000) == \
|
||||
assert client.get_slice('Table1', 'key1', ColumnParent('Standard1'), '', '', True, 1000) == \
|
||||
[Column('c1', 'value1', 4)]
|
||||
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ class TestMutations(CassandraTester):
|
|||
# Make sure remove clears out what it's supposed to, and _only_ that:
|
||||
client.remove('Table1', 'key1', ColumnPathOrParent('Super1', 'sc2', 'c5'), 5, True)
|
||||
_expect_missing(lambda: client.get_column('Table1', 'key1', ColumnPath('Super1', 'sc2', 'c5')))
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000) == \
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000) == \
|
||||
[SuperColumn(name='sc1', columns=[Column('c4', 'value4', 0)]),
|
||||
SuperColumn(name='sc2', columns=[Column('c6', 'value6', 0)])]
|
||||
_verify_simple()
|
||||
|
|
@ -216,17 +216,17 @@ class TestMutations(CassandraTester):
|
|||
SuperColumn(name='sc2',
|
||||
columns=[Column('c6', 'value6', 0), Column('c7', 'value7', 0)])]
|
||||
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000) == scs
|
||||
assert client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000) == scs
|
||||
|
||||
# Test resurrection. First, re-insert the value w/ older timestamp,
|
||||
# and make sure it stays removed:
|
||||
client.insert('Table1', 'key1', ColumnPath('Super1', 'sc2', 'c5'), 'value5', 0, True)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert actual == scs, actual
|
||||
|
||||
# Next, w/ a newer timestamp; it should come back
|
||||
client.insert('Table1', 'key1', ColumnPath('Super1', 'sc2', 'c5'), 'value5', 6, True)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert actual == \
|
||||
[SuperColumn(name='sc1', columns=[Column('c4', 'value4', 0)]),
|
||||
SuperColumn(name='sc2', columns=[Column('c5', 'value5', 6),
|
||||
|
|
@ -243,19 +243,19 @@ class TestMutations(CassandraTester):
|
|||
actual = client.get_columns_since('Table1', 'key1', ColumnParent('Super1', 'sc2'), -1)
|
||||
assert actual == [], actual
|
||||
scs = [SuperColumn(name='sc1', columns=[Column('c4', 'value4', 0)])]
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert actual == scs, actual
|
||||
_verify_simple()
|
||||
|
||||
# Test resurrection. First, re-insert the value w/ older timestamp,
|
||||
# and make sure it stays removed:
|
||||
client.insert('Table1', 'key1', ColumnPath('Super1', 'sc2', 'c5'), 'value5', 0, True)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert actual == scs, actual
|
||||
|
||||
# Next, w/ a newer timestamp; it should come back
|
||||
client.insert('Table1', 'key1', ColumnPath('Super1', 'sc2', 'c5'), 'value5', 6, True)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 0, 1000)
|
||||
actual = client.get_slice_super('Table1', 'key1', 'Super1', '', '', True, 1000)
|
||||
assert actual == \
|
||||
[SuperColumn(name='sc1', columns=[Column('c4', 'value4', 0)]),
|
||||
SuperColumn(name='sc2', columns=[Column('c5', 'value5', 6)])], actual
|
||||
|
|
@ -272,7 +272,8 @@ class TestMutations(CassandraTester):
|
|||
|
||||
client.remove('Table1', 'key1', ColumnPathOrParent('Standard1', column='c1'), 1, True)
|
||||
client.remove('Table1', 'key1', ColumnPathOrParent('Standard1', column='c2'), 1, True)
|
||||
assert client.get_key_range('Table1', 'Standard1', '', '', 1000) == []
|
||||
actual = client.get_key_range('Table1', 'Standard1', '', '', 1000)
|
||||
assert not actual, actual
|
||||
|
||||
def test_range_collation(self):
|
||||
for key in ['-a', '-b', 'a', 'b'] + [str(i) for i in xrange(100)]:
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ public class ReadMessageTest
|
|||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assert rm2.toString().equals(rm.toString());
|
||||
|
||||
rm = new SliceFromReadCommand("Table1", "row1", new QueryPath("foo"), "", "", true, 0, 2);
|
||||
rm = new SliceFromReadCommand("Table1", "row1", new QueryPath("foo"), "", "", true, 2);
|
||||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assert rm2.toString().equals(rm.toString());
|
||||
|
||||
rm = new SliceFromReadCommand("Table1", "row1", new QueryPath("foo"), "a", "z", true, 0, 5);
|
||||
rm = new SliceFromReadCommand("Table1", "row1", new QueryPath("foo"), "a", "z", true, 5);
|
||||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assertEquals(rm2.toString(), rm.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,16 +100,16 @@ public class TableTest extends CleanupHelper
|
|||
rm.add(cf);
|
||||
rm.apply();
|
||||
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "c", true, 0, 100);
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "c", true, 100);
|
||||
assertEquals(2, cf.getColumnCount());
|
||||
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "b", true, 0, 100);
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "b", true, 100);
|
||||
assertEquals(1, cf.getColumnCount());
|
||||
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "c", true, 0, 1);
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "b", "c", true, 1);
|
||||
assertEquals(1, cf.getColumnCount());
|
||||
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "c", "b", true, 0, 1);
|
||||
cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "c", "b", true, 1);
|
||||
assertNull(cf);
|
||||
}
|
||||
|
||||
|
|
@ -150,11 +150,11 @@ public class TableTest extends CleanupHelper
|
|||
ColumnFamily cf;
|
||||
|
||||
// key before the rows that exists
|
||||
cf = cfStore.getColumnFamily("a", new QueryPath("Standard2"), "", "", true, 0, 1);
|
||||
cf = cfStore.getColumnFamily("a", new QueryPath("Standard2"), "", "", true, 1);
|
||||
assertColumns(cf);
|
||||
|
||||
// key after the rows that exist
|
||||
cf = cfStore.getColumnFamily("z", new QueryPath("Standard2"), "", "", true, 0, 1);
|
||||
cf = cfStore.getColumnFamily("z", new QueryPath("Standard2"), "", "", true, 1);
|
||||
assertColumns(cf);
|
||||
}
|
||||
|
||||
|
|
@ -193,22 +193,23 @@ public class TableTest extends CleanupHelper
|
|||
Row result;
|
||||
ColumnFamily cf;
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col5", "", true, 0, 2);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col5", "", true, 2);
|
||||
assertColumns(cf, "col5", "col7");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col4", "", true, 0, 2);
|
||||
assertColumns(cf, "col5", "col7");
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col4", "", true, 2);
|
||||
assertColumns(cf, "col4", "col5", "col7");
|
||||
assertColumns(ColumnFamilyStore.removeDeleted(cf, Integer.MAX_VALUE), "col5", "col7");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col5", "", false, 0, 2);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col5", "", false, 2);
|
||||
assertColumns(cf, "col3", "col4", "col5");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col6", "", false, 0, 2);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col6", "", false, 2);
|
||||
assertColumns(cf, "col3", "col4", "col5");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col95", "", true, 0, 2);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col95", "", true, 2);
|
||||
assertColumns(cf);
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col0", "", false, 0, 2);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col0", "", false, 2);
|
||||
assertColumns(cf);
|
||||
}
|
||||
};
|
||||
|
|
@ -255,7 +256,7 @@ public class TableTest extends CleanupHelper
|
|||
{
|
||||
ColumnFamily cf;
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col2", "", true, 0, 3);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col2", "", true, 3);
|
||||
assertColumns(cf, "col2", "col3", "col4");
|
||||
assertEquals(new String(cf.getColumn("col2").value()), "valx");
|
||||
assertEquals(new String(cf.getColumn("col3").value()), "valx");
|
||||
|
|
@ -281,37 +282,25 @@ public class TableTest extends CleanupHelper
|
|||
rm.apply();
|
||||
cfStore.forceBlockingFlush();
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1000", "", true, 0, 3);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1000", "", true, 3);
|
||||
assertColumns(cf, "col1000", "col1001", "col1002");
|
||||
assertEquals(new String(cf.getColumn("col1000").value()), "vvvvvvvvvvvvvvvv1000");
|
||||
assertEquals(new String(cf.getColumn("col1001").value()), "vvvvvvvvvvvvvvvv1001");
|
||||
assertEquals(new String(cf.getColumn("col1002").value()), "vvvvvvvvvvvvvvvv1002");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1195", "", true, 0, 3);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1195", "", true, 3);
|
||||
assertColumns(cf, "col1195", "col1196", "col1197");
|
||||
assertEquals(new String(cf.getColumn("col1195").value()), "vvvvvvvvvvvvvvvv1195");
|
||||
assertEquals(new String(cf.getColumn("col1196").value()), "vvvvvvvvvvvvvvvv1196");
|
||||
assertEquals(new String(cf.getColumn("col1197").value()), "vvvvvvvvvvvvvvvv1197");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1195", "", true, 10, 3);
|
||||
assertColumns(cf, "col1205", "col1206", "col1207");
|
||||
assertEquals(new String(cf.getColumn("col1205").value()), "vvvvvvvvvvvvvvvv1205");
|
||||
assertEquals(new String(cf.getColumn("col1206").value()), "vvvvvvvvvvvvvvvv1206");
|
||||
assertEquals(new String(cf.getColumn("col1207").value()), "vvvvvvvvvvvvvvvv1207");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1196", "", false, 0, 3);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1196", "", false, 3);
|
||||
assertColumns(cf, "col1194", "col1195", "col1196");
|
||||
assertEquals(new String(cf.getColumn("col1194").value()), "vvvvvvvvvvvvvvvv1194");
|
||||
assertEquals(new String(cf.getColumn("col1195").value()), "vvvvvvvvvvvvvvvv1195");
|
||||
assertEquals(new String(cf.getColumn("col1196").value()), "vvvvvvvvvvvvvvvv1196");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1196", "", false, 10, 3);
|
||||
assertColumns(cf, "col1184", "col1185", "col1186");
|
||||
assertEquals(new String(cf.getColumn("col1184").value()), "vvvvvvvvvvvvvvvv1184");
|
||||
assertEquals(new String(cf.getColumn("col1185").value()), "vvvvvvvvvvvvvvvv1185");
|
||||
assertEquals(new String(cf.getColumn("col1186").value()), "vvvvvvvvvvvvvvvv1186");
|
||||
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1990", "", true, 0, 3);
|
||||
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), "col1990", "", true, 3);
|
||||
assertColumns(cf, "col1990", "col1991", "col1992");
|
||||
assertEquals(new String(cf.getColumn("col1990").value()), "vvvvvvvvvvvvvvvv1990");
|
||||
assertEquals(new String(cf.getColumn("col1991").value()), "vvvvvvvvvvvvvvvv1991");
|
||||
|
|
@ -343,7 +332,7 @@ public class TableTest extends CleanupHelper
|
|||
{
|
||||
public void run() throws Exception
|
||||
{
|
||||
ColumnFamily cf = cfStore.getColumnFamily(ROW, new QueryPath("Super1"), "", "", true, 0, 10);
|
||||
ColumnFamily cf = cfStore.getColumnFamily(ROW, new QueryPath("Super1"), "", "", true, 10);
|
||||
assertColumns(cf, "sc1");
|
||||
assertEquals(new String(cf.getColumn("sc1").getSubColumn("col1").value()), "val1");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue