From ef2f631ebef835d3fe9cfc80f1d31b2f312acedb Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Wed, 29 Apr 2009 02:01:56 +0000 Subject: [PATCH] fix regression introduced by ReadCommand refactor (get_slice can return column_t from a standard cf, or from a supercolumn in a super cf). patch by jbellis. git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@769629 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/cassandra/db/SliceReadCommand.java | 18 ++++++++++-------- test/system/test_server.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/org/apache/cassandra/db/SliceReadCommand.java b/src/org/apache/cassandra/db/SliceReadCommand.java index cdc3b6c8cf..04302a44d4 100644 --- a/src/org/apache/cassandra/db/SliceReadCommand.java +++ b/src/org/apache/cassandra/db/SliceReadCommand.java @@ -23,14 +23,16 @@ import java.io.IOException; public class SliceReadCommand extends ReadCommand { - public final String columnFamily; + /* for a slice of a standard column, cFC should only be the CF name. + for a supercolumn slice, it will be CF:supercolumn. */ + public final String columnFamilyColumn; public final int start; public final int count; - public SliceReadCommand(String table, String key, String columnFamily, int start, int count) + public SliceReadCommand(String table, String key, String columnFamilyColumn, int start, int count) { super(table, key, CMD_TYPE_GET_SLICE); - this.columnFamily = columnFamily; + this.columnFamilyColumn = columnFamilyColumn; this.start = start; this.count = count; } @@ -38,13 +40,13 @@ public class SliceReadCommand extends ReadCommand @Override public String getColumnFamilyName() { - return columnFamily; + return RowMutation.getColumnAndColumnFamily(columnFamilyColumn)[0]; } @Override public ReadCommand copy() { - ReadCommand readCommand= new SliceReadCommand(table, key, columnFamily, start, count); + ReadCommand readCommand = new SliceReadCommand(table, key, columnFamilyColumn, start, count); readCommand.setDigestQuery(isDigestQuery()); return readCommand; } @@ -52,7 +54,7 @@ public class SliceReadCommand extends ReadCommand @Override public Row getRow(Table table) throws IOException { - return table.getRow(key, columnFamily, start, count); + return table.getRow(key, columnFamilyColumn, start, count); } @Override @@ -61,7 +63,7 @@ public class SliceReadCommand extends ReadCommand return "GetSliceReadMessage(" + "table='" + table + '\'' + ", key='" + key + '\'' + - ", columnFamily='" + columnFamily + '\'' + + ", columnFamily='" + columnFamilyColumn + '\'' + ", start='" + start + '\'' + ", count='" + count + '\'' + ')'; @@ -77,7 +79,7 @@ class SliceReadCommandSerializer extends ReadCommandSerializer dos.writeBoolean(realRM.isDigestQuery()); dos.writeUTF(realRM.table); dos.writeUTF(realRM.key); - dos.writeUTF(realRM.columnFamily); + dos.writeUTF(realRM.columnFamilyColumn); dos.writeInt(realRM.start); dos.writeInt(realRM.count); } diff --git a/test/system/test_server.py b/test/system/test_server.py index 9c0473f737..af8a969ccf 100644 --- a/test/system/test_server.py +++ b/test/system/test_server.py @@ -197,7 +197,7 @@ class TestMutations(CassandraTester): client.remove('Table1', 'key1', 'Super1:sc2', 5, True) time.sleep(0.1) _expect_missing(lambda: client.get_column('Table1', 'key1', 'Super1:sc2:c5')) - actual = client.get_slice_super('Table1', 'key1', 'Super1:sc2', -1, -1) + actual = client.get_slice('Table1', 'key1', 'Super1:sc2', -1, -1) assert actual == [], actual scs = [superColumn_t(name='sc1', columns=[column_t(columnName='c4', value='value4', timestamp=0)])]