You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/07/16 02:38:54 UTC
svn commit: r794474 - in /incubator/cassandra/trunk: interface/
interface/gen-java/org/apache/cassandra/service/
src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/cql/common/
src/java/org/apache/cassandra/cql/compiler/sem/ src/java/org/a...
Author: jbellis
Date: Thu Jul 16 00:38:53 2009
New Revision: 794474
URL: http://svn.apache.org/viewvc?rev=794474&view=rev
Log:
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
Modified:
incubator/cassandra/trunk/interface/cassandra.thrift
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
incubator/cassandra/trunk/test/system/test_server.py
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
Modified: incubator/cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/cassandra.thrift?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/cassandra.thrift (original)
+++ incubator/cassandra/trunk/interface/cassandra.thrift Thu Jul 16 00:38:53 2009
@@ -116,7 +116,7 @@
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 @@
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)
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java Thu Jul 16 00:38:53 2009
@@ -24,7 +24,7 @@
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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
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 @@
String start,
String finish,
boolean is_ascending,
- int offset,
int count)
{
this();
@@ -2187,8 +2178,6 @@
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 @@
}
__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 @@
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 @@
}
break;
- case OFFSET:
- if (value == null) {
- unsetOffset();
- } else {
- setOffset((Integer)value);
- }
- break;
-
case COUNT:
if (value == null) {
unsetCount();
@@ -2497,9 +2454,6 @@
case IS_ASCENDING:
return new Boolean(isIs_ascending());
- case OFFSET:
- return new Integer(getOffset());
-
case COUNT:
return new Integer(getCount());
@@ -2523,8 +2477,6 @@
return isSetFinish();
case IS_ASCENDING:
return isSetIs_ascending();
- case OFFSET:
- return isSetOffset();
case COUNT:
return isSetCount();
default:
@@ -2599,15 +2551,6 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
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 @@
String start,
String finish,
boolean is_ascending,
- int offset,
int count)
{
this();
@@ -7642,8 +7563,6 @@
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 @@
}
__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 @@
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 @@
}
break;
- case OFFSET:
- if (value == null) {
- unsetOffset();
- } else {
- setOffset((Integer)value);
- }
- break;
-
case COUNT:
if (value == null) {
unsetCount();
@@ -7952,9 +7839,6 @@
case IS_ASCENDING:
return new Boolean(isIs_ascending());
- case OFFSET:
- return new Integer(getOffset());
-
case COUNT:
return new Integer(getCount());
@@ -7978,8 +7862,6 @@
return isSetFinish();
case IS_ASCENDING:
return isSetIs_ascending();
- case OFFSET:
- return isSetOffset();
case COUNT:
return isSetCount();
default:
@@ -8054,15 +7936,6 @@
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 @@
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 @@
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 @@
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;
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Thu Jul 16 00:38:53 2009
@@ -135,7 +135,7 @@
{
// 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(); )
{
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java Thu Jul 16 00:38:53 2009
@@ -43,7 +43,6 @@
private CFMetaData cfMetaData_;
private OperandDef rowKey_;
private OperandDef superColumnKey_;
- private int offset_;
private int limit_;
/**
@@ -53,12 +52,11 @@
* 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 @@
* 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 @@
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 @@
" Column Family: %s\n" +
" RowKey: %s\n" +
"%s" +
- " Offset: %d\n" +
" Limit: %d\n" +
" Order By: %s",
cfMetaData_.columnType,
@@ -159,7 +154,7 @@
cfMetaData_.cfName,
rowKey_.explain(),
(superColumnKey_ == null) ? "" : " SuperColumnKey: " + superColumnKey_.explain() + "\n",
- offset_, limit_,
+ limit_,
cfMetaData_.indexProperty_);
}
}
\ No newline at end of file
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java Thu Jul 16 00:38:53 2009
@@ -41,8 +41,6 @@
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 @@
* "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 @@
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 @@
" 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_);
}
}
\ No newline at end of file
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java Thu Jul 16 00:38:53 2009
@@ -189,12 +189,12 @@
{
// 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 @@
{
// 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);
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Thu Jul 16 00:38:53 2009
@@ -1421,9 +1421,9 @@
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
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java Thu Jul 16 00:38:53 2009
@@ -30,22 +30,20 @@
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 @@
@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 @@
@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 @@
", start='" + start + '\'' +
", finish='" + finish + '\'' +
", isAscending=" + isAscending +
- ", offset=" + offset +
", count=" + count +
')';
}
@@ -98,7 +95,6 @@
dos.writeUTF(realRM.start);
dos.writeUTF(realRM.finish);
dos.writeBoolean(realRM.isAscending);
- dos.writeInt(realRM.offset);
dos.writeInt(realRM.count);
}
@@ -106,7 +102,7 @@
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;
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Thu Jul 16 00:38:53 2009
@@ -711,7 +711,7 @@
}
// 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);
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java Thu Jul 16 00:38:53 2009
@@ -9,7 +9,7 @@
*/
public IdentityQueryFilter(String key, QueryPath path)
{
- super(key, path, "", "", true, 0, Integer.MAX_VALUE);
+ super(key, path, "", "", true, Integer.MAX_VALUE);
}
@Override
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java Thu Jul 16 00:38:53 2009
@@ -13,15 +13,14 @@
{
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 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 @@
if (!column.isMarkedForDelete())
liveColumns++;
- if (liveColumns > offset)
- returnCF.addColumn(column);
+ returnCF.addColumn(column);
}
}
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java Thu Jul 16 00:38:53 2009
@@ -150,7 +150,7 @@
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 @@
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 @@
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 @@
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 @@
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;
Modified: incubator/cassandra/trunk/test/system/test_server.py
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/test_server.py?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/test_server.py (original)
+++ incubator/cassandra/trunk/test/system/test_server.py Thu Jul 16 00:38:53 2009
@@ -41,12 +41,12 @@
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 @@
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 @@
_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 @@
_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 @@
# 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 @@
# 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 @@
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 @@
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 @@
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)]:
Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java Thu Jul 16 00:38:53 2009
@@ -50,11 +50,11 @@
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());
}
Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java?rev=794474&r1=794473&r2=794474&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java Thu Jul 16 00:38:53 2009
@@ -100,16 +100,16 @@
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 @@
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 @@
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 @@
{
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 @@
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 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");
}